Skip to content

Customization of Storage Size and root filesystem size on Mender Builds

Dan Walkes edited this page Feb 13, 2021 · 1 revision

General Consideration for storage size customization

One way to control root partition size independent of mender settings is to use the ROOTFSPART_SIZE variable with machine overrides matching the machine in use. For instance:

ROOTFSPART_SIZE_jetson-tx2 = "4294967296"

Use even multiples of 1MiB to avoid issues with bootloader support for partition locations. See https://github.com/OE4T/tegra-demo-distro/issues/37

SD Card

If a non-16G SD card is used, or if the user simply wants a smaller image, TEGRAFLASH_SDCARD_SIZE can be set to a different value. Note, the corresponding flash.xml file at https://github.com/mendersoftware/meta-mender-community/tree/dunfell/meta-mender-tegra/recipes-bsp/tegra-binaries/mender-custom-flash-layout based on your machine type, will also need to be customized in your layer. You can refer to this issue https://github.com/OE4T/meta-tegra/issues/453 for history and more details.

Specifically, you need to update the <device type="sdcard"...> line to increase the num_sectors= parameter to match the actual number of (512-byte) sectors present on the SDcard. The NVIDIA flashing tools use this number to track the amount of space allocated by the partitions, and will generate an error if it detects that the number of sectors allocated exceeds num_sectors. The default number in the XML file (33554432) is for a 16GB card.

If you have a Linux system that you can plug the SDcard into, you can identify the correct number of sectors with:

$ cat /sys/block/DEVNAME/size

where DEVNAME is the base device name for the SDcard, typically mmcblkN (where N is a digit) or sdX (where X is a letter). Alternatively, you can just set num_sectors to a value you know is large enough; for a 32GB card, for example, you could use 67108864 (32GiB / 512 bytes per sector).