linux 扩展根目录分区

发布时间 2024-01-12 10:08:17作者: *^VV^*

[root]~# fdisk /dev/mmcblk0

The number of cylinders for this disk is set to 60672.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p
Disk /dev/mmcblk0: 1896 MB, 1988100096 bytes, 3883008 sectors
60672 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/mmcblk0p1 0,32,33 16,113,33 2048 264191 262144 128M 83 Linux
/dev/mmcblk0p2 16,113,34 49,20,35 264192 788479 524288 256M 83 Linux

Command (m for help): d
Partition number (1-4): 2

Command (m for help): n
Partition type
p primary partition (1-4)
e extended
p
Partition number (1-4): 2
First sector (16-3883007, default 16): 264192
Last sector or +size{,K,M,G,T} (264192-3883007, default 3883007):
Using default value 3883007

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table
fdisk: WARNING: rereading partition table failed, kernel still uses old table: Resource busy

[root]~# reboot

[root]~# resize2fs /dev/mmcblk0p2
resize2fs 1.46.2 (28-Feb-2021)
Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/mmcblk0p2 is now 452352 (4k) blocks long.

[root]~# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 1.6G 39.8M 1.5G 3% /
devtmpfs 14.4M 0 14.4M 0% /dev
tmpfs 14.5M 0 14.5M 0% /dev/shm
tmpfs 14.5M 44.0K 14.4M 0% /tmp
tmpfs 14.5M 20.0K 14.5M 0% /run