Difficulties shrinking read-only rootfs image

"Levi Shafter" <[email protected]>
Newsgroups org.yoctoproject.lists.yocto
Message-ID <[email protected]>
Hello,

My team and I have been running into issues with reaching better disk utilization for our read-only root file system image:

root@beaglebone:~# df -h .
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       604M  340M  219M  61% /
We are building an ext4 image using OpenEmbedded's oe_mkext234fs(), which makes use of the mke2fs command to generate the image from the rootfs directory. We then run a resize2fs to try for a disk utilization equal to the sum of our utilization and 5% of that utilization for root inodes, as we do not need additional space for our read-only image. However, our utilization is quite small.

I tried passing a few options to optimize for our use case:

EXTRA_IMAGECMD_ext4 = " \
   -b 1024 \
   -i 65536 \
   -m 0 \
   -O ^has_journal,^resize,^quota,^dir_index,sparse_super2 \
   -E packed_meta_blocks=1,num_backup_sb=0,lazy_itable_init=1,lazy_journal_init=1 \
   -L ${IMAGE_NAME} \
This did not improve our utilization much. I also tried adding a pretend to oe_mkext234fs(), effectively preparing a dynamically sized image before generating the filesystem from the rootfs directory. While this worked well for our more modular builds closer to 225M in size, we still require a safety buffer of about 20% for our full-sized image. Otherwise, we get:

| Copying files into the device: __populate_fs: Could not allocate block in ext2 filesystem while writing file "hll"
| mkfs.ext4: Could not allocate block in ext2 filesystem while populating file system I am wondering if anyone has experienced similar difficulties, or if anyone might have any more ideas. We are planning on moving to a more appropriate file system such as SquashFS in the future, but we currently rely on ext4 for compatibility reasons.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.