Welcome to fdisk (util-linux 2.38.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command.
This disk is currently in use - repartitioning is probably a bad idea. It's recommended to umount all file systems, and swapoff all swap partitions on this disk.
Command (m for help):
查看分区情况
输入p查看分区情况,输出如下:
1 2 3 4 5 6 7 8 9 10 11 12
Command (m forhelp): p
Disk /dev/mmcblk0p30: 12.93 GiB, 13878935040 bytes, 27107295 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: 0xdab5b7a3
Device Boot Start End Sectors Size Id Type /dev/mmcblk0p30p1 * 2048 499711 497664 243M 83 Linux /dev/mmcblk0p30p2 499712 4923391 4423680 2.1G 83 Linux
记住第二个分区的Start的数值,这里是499712。
删除分区
输入d以进入删除分区的功能,输出如下:
1 2
Command (m forhelp): d Partition number (1,2, default 2):
它会提示我们输入要删除的分区号,我要删除第二个分区,输入2,输出如下:
1 2 3
Partition number (1,2, default 2): 2
Partition 2 has been deleted.
删除成功。
新建分区
输入n以进入新建分区的功能,输出如下:
1 2 3 4 5
Command (m forhelp): n Partition type p primary (1 primary, 0 extended, 3 free) e extended (container for logical partitions) Select (default p):
Partition number (2-4, default 2): First sector (499712-27107294, default 499712): Last sector, +/-sectors or +/-size{K,M,G,T,P} (499712-27107294, default 27107294):
输入完成后输出:
1 2 3 4
Created a new partition 2 of type'Linux' and of size 12.7 GiB. Partition #2 contains a ext4 signature.