Welcome to fdisk (util-linux 2.32.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command.
Device does not contain a recognized partition table. Created a new DOS disklabel with disk identifier 0x32b86b54.
Command (m forhelp): m
Help:
DOS (MBR) a toggle a bootable flag b edit nested BSD disklabel c toggle the dos compatibility flag
Generic d delete a partition F list free unpartitioned space l list known partition types n add a new partition p print the partition table t change a partition type v verify the partition table i print information about a partition
Misc m print this menu u change display/entry units x extra functionality (experts only)
Script I load disk layout from sfdisk script file O dump disk layout to sfdisk script file
Save & Exit w write table to disk and exit q quit without saving changes
Create a new label g create a new empty GPT partition table G create a new empty SGI (IRIX) partition table o create a new empty DOS partition table s create a new empty Sun partition table
Welcome to fdisk (util-linux 2.32.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command.
Device does not contain a recognized partition table. Created a new DOS disklabel with disk identifier 0xd54cf8f7.
Command (m forhelp): n # create new sector Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): p # primary disk Partition number (1-4, default 1): First sector (2048-10485759, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-10485759, default 10485759): +5G Value out of range. Last sector, +sectors or +size{K,M,G,T,P} (2048-10485759, default 10485759):+5G Value out of range. # can't assign all spaces to this disk(maybe caused by 2048 sector for Partition Table) Last sector, +sectors or +size{K,M,G,T,P} (2048-10485759, default 10485759): 10485759
Created a new partition 1 of type'Linux' and of size 5 GiB.
Command (m forhelp): p # print the partition table Disk /dev/sdb: 5 GiB, 5368709120 bytes, 10485760 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xd54cf8f7
Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 10485759 10483712 5G 83 Linux
Command (m forhelp): w # save change and quit The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks.
Welcome to fdisk (util-linux 2.32.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command.
Device does not contain a recognized partition table. Created a new DOS disklabel with disk identifier 0xdaf75f95.
Command (m forhelp): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): p Partition number (1-4, default 1): First sector (2048-2097151, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-2097151, default 2097151):
Created a new partition 1 of type'Linux' and of size 1023 MiB.
Command (m forhelp): p Disk /dev/sdc: 1 GiB, 1073741824 bytes, 2097152 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xdaf75f95
Device Boot Start End Sectors Size Id Type /dev/sdc1 2048 2097151 2095104 1023M 83 Linux
Command (m forhelp): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks.
格式化磁盘为 swap 分区
[root@ray_d62 ~]# mkswap /dev/sdc1 Setting up swapspace version 1, size = 1023 MiB (1072689152 bytes) no label, UUID=3b5c866b-bd62-4365-b362-ffd189cc8f8e
将新分区添加到 swap 中
[root@ray_d62 ~]# free -m total used free shared buff/cache available Mem: 3912 332 3320 9 258 3344 Swap: 2047 0 2047 [root@ray_d62 ~]# swapon /dev/sdc1 [root@ray_d62 ~]# free -m total used free shared buff/cache available Mem: 3912 333 3310 9 267 3342 Swap: 3070 0 3070