Reduced size of PI image from 12 GB to 2 GB#353
Conversation
Size of boot has been reduced to 1.4 GB and rootfs to 200 MB to free up more space in persist.
Reduced the size of the image allocation from 12G to 2G.
|
Hey @rschueler thanks I'll merge today. I think it should still be slightly larger - maybe 4GB because when updating the system with the ssh based install it has to hold two copies of rootfs squashfs at a time. I haven't checked the size of that recently, can you have a look? |
|
The size of my Raspberry Pi 4 image is approximately 240 MB, so two copies of the files should fit without issues into the root partition. However, I identified another problem while using this image: With the persist partition set to an initial size of 400 MB, inode exhaustion occurs quickly. For example on my 32 GB SD card the FS only provides around 11K inodes, which is insufficient for many use cases. I will change the size to 4GB |
|
There is a flag that can be set to force a certain inode allocation amount can you check that? |
|
Yes, we can use the -N flag (fixed inode count) or the -i flag (bytes-per-inode ratio) during formatting. The issue is that for a 400MB partition, mkfs.ext4 defaults to a 1024-byte block size and a small metadata reservation. This is what prevents the inode table from scaling properly when the partition is expanded to fill the SD card. To fix this while keeping the 2GB image layout, we can force the 'large partition' standards during creation: Alternatively, increasing the image to 4GB (making the initial partition 2.4GB) also works because mkfs will switch to these 4k defaults automatically. Both are valid fixes. While a 4GB image zips well for downloading, it would double the raw flashing time (e.g., via dd). Therefore, using the -b and -i flags is likely the more efficient choice. Which approach do you prefer? |
|
I've seen the "set inode count" approach used elsewhere in the past, I think it's commonly done. Let's do that - a smaller image size is always better I think! Thanks |
I reduced the size of boot = 1.4 GB, rootfs = 200 MB to free up more space on small SD for persist. The image builds and boots fine. Was there any reason why boot FS was that big?