Mender-Convert specific RootFS size

Hi,

I’m trying to create a mender image from raspbian for the raspberry 3.

As I understand, 4 files are concerned by the process:

  • mender_convert_config
  • raspberrypi_config
  • raspberrypi3_config
  • raspberrypi3_raspbian_config

In each of these files (where possible) I set the “IMAGE_ROOTFS_SIZE” to 8192MB.
However, when I create my image, mender-convert will always fill all the sd card size and won’t respect my specific resizing. Thus, my RootFS size are bigger than expected.

Do you have any ideas ?

Thank you in advance

The RootFS should not change size once the device boots, but the last partition (which is mounted at /data) might get expanded to occupy the full disk.

This is control by this variable,

Or I might have misunderstood your question. Can you share the output of fdisk -l <output image>.

Also notice that the IMAGE_ROOTFS_SIZE variable only controls the filesystem image size and not the partition size.

Maybe take a look at this variable as well,

This is the output from fdisk on the device using the created image (checked same from img file):

Device         Boot    Start      End  Sectors                      Size    Id  Type
/dev/mmcblk0p1 *    24576       548863     524288         256M  c   W95 FAT32 (LBA)
/dev/mmcblk0p2      548864     32767999 32219136     15.4G 83 Linux
/dev/mmcblk0p3      32768000 64987135 32219136     15.4G 83 Linux
/dev/mmcblk0p4      64987136 67084287 2097152       1G      83 Linux

As I understood : MENDER_STORAGE_TOTAL_SIZE_MB is used to define the size of the SD Card in total. I defined this to 32768 as my SD Card is a 32GB.

Also what do you mean by filesystem image size ? How does it relate to the partition size ?

MENDER_DATA_PART_GROWFS=y; this part is clear, I setted it to n so the data partition won’t grow up. The problem is that my partitions are already sized badly upon the generation of the image and not on the boot of it.
The output of mender-convert shows :

2020-04-01 14:42:26 [INFO] [mender-convert-package] Total disk size: 32768 MiB
2020-04-01 14:42:26 [INFO] [mender-convert-package] Boot partition 256 MiB
2020-04-01 14:42:26 [INFO] [mender-convert-package] RootFS partitions 15732 MiB x 2
2020-04-01 14:42:26 [INFO] [mender-convert-package] Data partition 1024 MiB

Even though I configured the RootFS to be 8GB in size.

Is it possible to fix the RootFS size to 8192 MB (8GB) ?

Thank you for your help

Is it possible to fix the RootFS size to 8192 MB (8GB) ?

Yes, increase the MENDER_DATA_PART_SIZE_MB.

Below should explain why (copied from Raspberry Pi 3 Model B/B+ Raspbian)

The SD card layout will be the following using the default
arguments (this with the default 8GB size):

Part Type Purpose Size Configure size
mmcblk0p1 vfat Store the bootloader 44MB MENDER_BOOT_PART_SIZE_MB
mmcblk0p2 ext4 Store the root file system and kernel (active) 3908MB MENDER_STORAGE_TOTAL_SIZE_MB 1
mmcblk0p3 ext4 Store the root file system and kernel (inactive) 3908MB MENDER_STORAGE_TOTAL_SIZE_MB 1
mmcblk0p4 ext4 Store persistent data, preserved during Mender updates. 128MB MENDER_DATA_PART_SIZE_MB 2
  1. The rootfs partition size is calculated using the
    following formula:
 (storage-total-size-mb - data-part-size-mb - boot-part-size) / 2

It does not (or well, the rootfs image will go in to the partition in the ned), and that is why IMAGE_ROOTFS_SIZE does not impact partition sizes and only impacts the rootfs image size.

See separate response regarding partition sizes and how rootfs partition size is calculated.