Trying to resize an image

We’ve deployed over 100 devices using Mender from a golden-image we built over a year ago, all has been working well, however our supplier seems to have shrunk their latest 8GB SD cards, so they are now smaller than previously.

I reduced the size of the image by reducing the parameter MENDER_STORAGE_TOTAL_SIZE_MB, and regenerated, this seemed to work a treat, fdisk -l on the image showed the same partition layout but with smaller “A” and “B” partitions.

I wrote this new image to the SD cards using balenaetcher, however, the Pi doesn’t boot, it gets the rainbow screen and then goes to a black screen and doesn’t boot any further.

Any ideas?

My config

RASPBERRYPI_CONFIG="raspberrypi3"
RASPBERRYPI_KERNEL_IMAGE="kernel7.img"
MENDER_KERNEL_IMAGETYPE="zImage"
MENDER_DEVICE_TYPE="raspberrypi3"
MENDER_STORAGE_TOTAL_SIZE_MB="7296"
MENDER_ADDON_CONNECT_INSTALL="y"
MENDER_ADDON_CONFIGURE_INSTALL="y"
MENDER_BOOT_PART_SIZE_MB="256"
MENDER_DATA_PART_SIZE_MB="512"

source configs/raspberrypi_config

Hi @edpgcooper,

Thanks for reaching out. Are there other things that might have changed since the original golden image? Is it the actual same configuration with just the size changed, or have there been other modifications?

As an additional first debugging step, is there anything on the serial terminal?

Greetz,
Josef

I don’t think there have been any changes. I’m running mender-convert 2.6 as that’s the version that was the latest when we first set this system up.

The golden image was captured from the original batch of SD cards, so it is too large to write to the new ones, if I write it to the old ones it will boot fine. Perhaps I need to work out how to shrink that image and then regenerate? However, I was hoping MENDER_STORAGE_TOTAL_SIZE_MB would just magically deal with everything for me. Could it be the block size/layout is different and that’s causing a problem?

Ah @edpgcooper so the golden image is already too big? That’s an interesting use case, I’ll check what I can find out. Generally I would try shrinking it before putting it into mender-convert. Using resize2fs and parted in target should be quite straightforward.

Greetz,
Josef

I have installed the latest mender-convert on a new VM on Ubuntu 22.04

I’ve shrunk down the source/golden image to the new SD card size.

I’m struggling to get mender-convert to respect my configuration. I have a configuration file configs/raspberrypi3_rcl_config which includes

MENDER_ADDON_CONNECT_INSTALL="y"
MENDER_ADDON_CONFIGURE_INSTALL="y"
MENDER_BOOT_PART_SIZE_MB="256"
MENDER_DATA_PART_SIZE_MB="512"
MENDER_STORAGE_TOTAL_SIZE_MB="7380"

I also tried without the double quote marks.

When I run mender-convert I get the following output

2023-06-16 15:44:47 [INFO] [mender-convert-package] Using configuration file: configs/mender_convert_config
2023-06-16 15:44:47 [INFO] [mender-convert-package] Using configuration file: ./work/override_compression_config
2023-06-16 15:44:47 [INFO] [mender-convert-package] Using configuration file: configs/raspberrypi3_rcl_config
2023-06-16 15:44:47 [WARN] [mender-convert-package] The allocated boot part size 40 MiB is too small.
2023-06-16 15:44:47 [WARN] [mender-convert-package] The actual boot part size is 256 MiB
2023-06-16 15:44:47 [WARN] [mender-convert-package] Will adjust MENDER_BOOT_PART_SIZE_MB automatically
2023-06-16 15:44:47 [WARN] [mender-convert-package] Consider adjusting the configuration file to avoid this message

Seems like it’s ignoring my configuration, as I have set MENDER_BOOT_PART_SIZE_MB to 256, maybe that’s my main issue.

Never resolved this, mender-convert just won’t create a bootable volume with the new size SD cards, disappointing.