接到需求 , 说需要把根目录大小给扩容, 查到资料 可以通过 resize2fs /dev/mmcblk1p8命令。
具体的分区可以通过lsblk查看 , 我固件根目录是/dev/mmcblk1p8 , 执行完就是刚好6个G。
然后看到/dev/mmcblk1p9 22G没有被挂载 , 顺手挂载一下。
root@ubuntu:~# resize2fs /dev/mmcblk1p8 resize2fs 1.45.5 (07-Jan-2020) Filesystem at /dev/mmcblk1p8 is mounted on /; on-line resizing required old_desc_blocks = 1, new_desc_blocks = 1 The filesystem on /dev/mmcblk1p8 is now 1572864 (4k) blocks long. root@ubuntu:~# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT mmcblk1 179:0 0 28.9G 0 disk ├─mmcblk1p1 179:1 0 4M 0 part ├─mmcblk1p2 179:2 0 4M 0 part ├─mmcblk1p3 179:3 0 4M 0 part ├─mmcblk1p4 179:4 0 32M 0 part ├─mmcblk1p5 179:5 0 32M 0 part ├─mmcblk1p6 179:6 0 32M 0 part ├─mmcblk1p7 179:7 0 64M 0 part ├─mmcblk1p8 179:8 0 6G 0 part / └─mmcblk1p9 179:9 0 22.7G 0 part mmcblk1boot0 179:32 0 4M 1 disk mmcblk1boot1 179:64 0 4M 1 disk mmcblk1rpmb 179:96 0 16M 0 disk root@ubuntu:~# df -h Filesystem Size Used Avail Use% Mounted on /dev/root 5.9G 841M 4.8G 15% / devtmpfs 1.9G 0 1.9G 0% /dev tmpfs 1.9G 0 1.9G 0% /dev/shm tmpfs 385M 1.1M 384M 1% /run tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup tmpfs 385M 0 385M 0% /run/user/0 root@ubuntu:~# mount /dev/mmcblk1p9 /mnt/storage/ root@ubuntu:~# df -h Filesystem Size Used Avail Use% Mounted on /dev/root 5.9G 841M 4.8G 15% / devtmpfs 1.9G 0 1.9G 0% /dev tmpfs 1.9G 0 1.9G 0% /dev/shm tmpfs 385M 1.1M 384M 1% /run tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup tmpfs 385M 0 385M 0% /run/user/0 /dev/mmcblk1p9 23G 4.3M 23G 1% /mnt/storage