# Linux Kernel Module Cheat

### 26.7. BR2_TARGET_ROOTFS_EXT2_SIZE

When adding new large package to the Buildroot root filesystem, it may fail with the message:

    Maybe you need to increase the filesystem size (BR2_TARGET_ROOTFS_EXT2_SIZE)

The solution is to simply add:

    ./build-buildroot --config 'BR2_TARGET_ROOTFS_EXT2_SIZE="512M"'

where 512Mb is "large enough".

Note that dots cannot be used as in `1.5G`, so just use Megs as in `1500M` instead.

Unfortunately, TODO we don’t have a perfect way to find the right value for `BR2_TARGET_ROOTFS_EXT2_SIZE`. One good heuristic is:

    du -hsx "$(./getvar --arch arm buildroot_target_dir)"

Some promising ways to overcome this problem include:

- SquashFS TODO benchmark: would gem5 suffer a considerable disk read performance hit due to decompressing SquashFS?

- libguestfs: https://serverfault.com/questions/246835/convert-directory-to-qemu-kvm-virtual-disk-image/916697#916697, in particular `vfs-minimum-size`

- use methods described at: Section 24.6.3, “gem5 checkpoint restore and run a different script” instead of putting builds on the root filesystem

Bibliography: https://stackoverflow.com/questions/49211241/is-there-a-way-to-automatically-detect-the-minimum-required-br2-target-rootfs-ex

- SquashFS