# Trying to resize an image

**URL:** <https://hub.mender.io/t/trying-to-resize-an-image/5912>\
**Category:** General Discussions\
**Created:** [June 13, 2023, 7:52am UTC](https://hub.mender.io/t/trying-to-resize-an-image/5912 "2023-06-13T07:52:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![edpgcooper](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/edpgcooper/32/1496_2.png) [@edpgcooper](https://hub.mender.io/u/edpgcooper)\
**Post date:** [June 13, 2023, 7:52am UTC](https://hub.mender.io/t/trying-to-resize-an-image/5912/1 "2023-06-13T07:52:37Z")

</div>

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

```auto
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

```

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [June 13, 2023, 2:49pm UTC](https://hub.mender.io/t/trying-to-resize-an-image/5912/2 "2023-06-13T14:49:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![edpgcooper](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/edpgcooper/32/1496_2.png) [@edpgcooper](https://hub.mender.io/u/edpgcooper)\
**Post date:** [June 14, 2023, 6:50am UTC](https://hub.mender.io/t/trying-to-resize-an-image/5912/3 "2023-06-14T06:50:12Z")

</div>

> [@TheYoctoJester](#):
>
> 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?

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?

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [June 14, 2023, 6:55am UTC](https://hub.mender.io/t/trying-to-resize-an-image/5912/4 "2023-06-14T06:55:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![edpgcooper](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/edpgcooper/32/1496_2.png) [@edpgcooper](https://hub.mender.io/u/edpgcooper)\
**Post date:** [June 16, 2023, 3:49pm UTC](https://hub.mender.io/t/trying-to-resize-an-image/5912/5 "2023-06-16T15:49:21Z")

</div>

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

```auto
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

```auto
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.

---

<div class="post-metadata">

**Author:** ![edpgcooper](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/edpgcooper/32/1496_2.png) [@edpgcooper](https://hub.mender.io/u/edpgcooper)\
**Post date:** [June 23, 2023, 1:30pm UTC](https://hub.mender.io/t/trying-to-resize-an-image/5912/6 "2023-06-23T13:30:11Z")

</div>

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