root@OK8MP:~# fdisk /dev/mmcblk2 Welcome to fdisk (util-linux 2.34). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): p //打印分区表 Disk /dev/mmcblk2: 14.69 GiB, 15758000128 bytes, 30777344 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: 0x036f1e8a Device Boot Start End Sectors Size Id Type /dev/mmcblk2p1 16384 186751 170368 83.2M c W95 FAT32 (LBA) /dev/mmcblk2p2 186752 15915391 15728640 7.5G 83 Linux //需扩容的分区 Command (m for help): d //删除分区 Partition number (1,2, default 2): 2 //删除分区2 Partition 2 has been deleted. Command (m for help): n //添加一个新分区 Partition type p primary (1 primary, 0 extended, 3 free) e extended (container for logical partitions) Select (default p): p //打印分区表 Partition number (2-4, default 2): 2 //创建分区2 First sector (2048-30777343, default 2048): 186752 //开始地址(以上一分区的结束地 址为参考) Last sector, +/-sectors or +/-size{K,M,G,T,P} (186752-30777343, default 30777343): 回车 Created a new partition 2 of type 'Linux' and of size 14.6 GiB. Partition #2 contains a ext4 signature. Do you want to remove the signature? [Y]es/[N]o: n //不删除签名 Command (m for help): w //将表写入磁盘并退出 The partition table has been altered. Syncing disks. root@OK8MP:~# resize2fs /dev/mmcblk2p2 resize2fs 1.45.3 (14-Jul-2019)[ 461.996877] EXT4-fs (mmcblk2p2): resizing filesystem from 1966080 to 3823824 blocks Filesystem at /dev/mmcblk2p2 is mounted on /; on-line resizing required old_desc_blocks = 1, new_desc_blocks = 2 [ 462.220981] EXT4-fs (mmcblk2p2): resized filesystem to 3823824 The filesystem on /dev/mmcblk2p2 is now 3823824 (4k) blocks long. |