╭─root@du ~ ╰─➤ fdisk /dev/sdb Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them. Be careful before using the write command.
Command (m forhelp): n #添加新分区 Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): e #选择扩展分区 Partition number (2-4, default 2): First sector (10487808-41943039, default 10487808): Using default value 10487808 Last sector, +sectors or +size{K,M,G} (10487808-41943039, default 41943039): +5G #5G大小 Partition 2 of type Extended and of size 5 GiB is set
Command (m forhelp): P #查看分区
Disk /dev/sdb: 21.5 GB, 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 Disk label type: dos Disk identifier: 0xe140b235
Device Boot Start End Blocks Id System /dev/sdb1 2048 10487807 5242880 83 Linux /dev/sdb2 10487808 20973567 5242880 5 Extended
Command (m forhelp): w #保存退出 The partition table has been altered!
Calling ioctl() to re-read partition table. Syncing disks.
#第二步:创建逻辑分区
╭─root@du ~ ╰─➤ fdisk /dev/sdb Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them. Be careful before using the write command.
Command (m forhelp): n Partition type: p primary (1 primary, 1 extended, 2 free) l logical (numbered from 5) Select (default p): l #创建逻辑分区 Adding logical partition 5 First sector (10489856-20973567, default 10489856): Using default value 10489856 Last sector, +sectors or +size{K,M,G} (10489856-20973567, default 20973567): +10G #逻辑分区大小不能超过扩展分区大小 Value out of range. Last sector, +sectors or +size{K,M,G} (10489856-20973567, default 20973567): +2g Unsupported suffix: ‘g’. Supported: 10^N: KB (KiloByte), MB (MegaByte), GB (GigaByte) 2^N: K (KibiByte), M (MebiByte), G (GibiByte) Last sector, +sectors or +size{K,M,G} (10489856-20973567, default 20973567): +2G Partition 5 of type Linux and of size 2 GiB is set
Command (m forhelp): P
Disk /dev/sdb: 21.5 GB, 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 Disk label type: dos Disk identifier: 0xe140b235
Device Boot Start End Blocks Id System /dev/sdb1 2048 10487807 5242880 83 Linux /dev/sdb2 10487808 20973567 5242880 5 Extended /dev/sdb5 10489856 14684159 2097152 83 Linux
Command (m forhelp): W The partition table has been altered!
Calling ioctl() to re-read partition table. Syncing disks.