[root@myserver ~]# fdisk /dev/sdb 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 0x1fb209a3. Command (m forhelp): n 创建分区 Partition type p primary (0 primary, 0 extended, 4free) 主分区 e extended (container for logical partitions) 扩展分区 Select (default p): p 主分区 Partition number (1-4, default 1): 1 分区号 First sector (2048-41943039, default 2048): 起始位置默认 Last sector, +sectors or +size{K,M,G,T,P}(2048-41943039, default 41943039): +5G 分配5G空间 Created a new partition 1 of type'Linux' and of size 5 GiB. Command (m forhelp): p 打印当前的分区表 Disk /dev/sdb: 20 GiB, 21474836480 bytes, 41943040 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: 0x1fb209a3 Device Boot Start End Sectors Size Id Type /dev/sdb1 20481048780710485760 5G 83 Linux ################################################ ############### 创建第二个分区 ##################### Command (m forhelp): n Partition type p primary (1 primary, 0 extended, 3free) e extended (container for logical partitions) Select (default p): p Partition number (2-4, default 2): First sector (10487808-41943039, default 10487808): Last sector, +sectors or +size{K,M,G,T,P}(10487808-41943039, default 41943039): +6G Created a new partition 2 of type'Linux' and of size 6 GiB. Command (m forhelp): p Disk /dev/sdb: 20 GiB, 21474836480 bytes, 41943040 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: 0x1fb209a3 Device Boot Start End Sectors Size Id Type /dev/sdb1 20481048780710485760 5G 83 Linux /dev/sdb2 104878082307071912582912 6G 83 Linux Command (m forhelp): wq 保存分区表信息并退出