Solve the problem of insufficient space after the root file system is mounted

Foreword:

In the previous article " Modifying rootfs root file system image content ", a problem was overlooked, that is, after the root file system was mounted, the installation command reported insufficient space, and it was found to have occupied 100% after checking the occupancy.
insert image description here
However /dev/loop0, the disk usage is only 857M, udevbut it takes up 7.8G, which is obviously unreasonable.
At first I thought that this problem could apt-getbe solved by modifying the download directory, but the actual measurement did not improve.
After research, it is found that the small disk space is related to the size of the root file system image, so simply expand the root file system image to completely solve this problem.

Root file system image expansion

command: e2fsck ,resize2fs

  1. Check if the system is working properly
e2fsck -p -f ubuntu.img

output

linuxroot: 24212/65536 files (0.6% non-contiguous), 219507/242275 blocks
  1. expansion
resize2fs ubuntu.img 2G

Expand the root file system to 2G, and output the following command after the expansion is successful

resize2fs 1.44.1 (24-Mar-2018)
Resizing the filesystem on rk3568_ubuntu.img to 524288 (4k) blocks.
The filesystem on rk3568_ubuntu.img is now 524288 (4k) blocks long.

Summarize

At this point, the capacity expansion is completed, and then install the steps in " Modifying rootfs root file system image content
" and you can see it after mounting. The capacity expansion is completed, and the problem of 100% disk usage is solved.
insert image description here

Guess you like

Origin blog.csdn.net/yy1677/article/details/131225709