Why is my root filesystem so much smaller than my root partition?

I am trying to create a new mender artifact for a Ubuntu Server 22 system. My golden image is a bit less than 30GB. I am now using mender-convert to make the Mender image.

I am using the generic_x86-64_hdd_config and I have set MENDER_STORAGE_TOTAL_SIZE_MB=61440 in the config.

During my conversion, I noticed a line that stood out to me:

2025-02-13 15:02:14 [INFO] [mender-convert-package] Rootfs filesystem size will be 16102 MiB

I figured this might have been an issue with my partitions but then later in the logs I saw:

2025-02-13 15:07:50 [INFO] [mender-convert-package] Creating Mender compatible disk-image
2025-02-13 15:07:50 [INFO] [mender-convert-package] Total disk size: 61440 MiB
2025-02-13 15:07:50 [INFO] [mender-convert-package]   Boot partition    1080 MiB
2025-02-13 15:07:50 [INFO] [mender-convert-package]   RootFS partitions 30104 MiB x 2
2025-02-13 15:07:50 [INFO] [mender-convert-package]   Data partition    128 MiB

which looks correct to me. So why is the actual root filesystem so much smaller than its partition? I am aware that some space is reserved when using an ext4 filesystem but my filesystem is roughly half of the partition size.

I tried installing the new image anyway to see what would happen. Sure enough, it matches the output of mender-convert. The partition sizes of the rootfs are each ~30GB but the rootfs (according to df -h) is only about ~16GB. Is there something I need to set in Mender to tell it to resize the root filesystem to use as much of the root partition as it can?

Any help or insight would be appreciated!

I managed to answer my own question after going through my config for mender-convert line by line. I had set IMAGE_ROOTFS_SIZE to the default 0 thinking this meant it would match the filesystem size on my golden image, but it actually sets it to the size of the filesystem content according to the docs.

Simply setting that to -1 instead fixed my issue! Hopefully someone will find this helpful in the future to avoid my mistake.

1 Like

Thanks a lot @JamesTann for sharing so our future selves can benefit from it!