# Image size created by mender-convert does not match MENDER\_STORAGE\_TOTAL\_SIZE\_MB

**URL:** <https://hub.mender.io/t/image-size-created-by-mender-convert-does-not-match-mender-storage-total-size-mb/2661>\
**Category:** General Discussions\
**Created:** [October 13, 2020, 6:41am UTC](https://hub.mender.io/t/image-size-created-by-mender-convert-does-not-match-mender-storage-total-size-mb/2661 "2020-10-13T06:41:56Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![oernst](https://avatars.discourse-cdn.com/v4/letter/o/65b543/32.png) [@oernst](https://hub.mender.io/u/oernst)\
**Post date:** [October 13, 2020, 6:41am UTC](https://hub.mender.io/t/image-size-created-by-mender-convert-does-not-match-mender-storage-total-size-mb/2661/1 "2020-10-13T06:41:56Z")

</div>

Hi,

I am trying to use mender-convert (latest 2.2.0) to convert a golden image of Raspbian buster lite for Raspberry Pi Zero Wifi. I thought I set it up correctly for a 16GB SD card, but the resulting image is… 17.18GB.

I set the following config values:

> MENDER\_STORAGE\_TOTAL\_SIZE\_MB=“16384”  
> MENDER\_BOOT\_PART\_SIZE\_MB=“256”  
> MENDER\_DATA\_PART\_SIZE\_MB=“256”  
> IMAGE\_ROOTFS\_SIZE=0

I also got the following output:

> 2020-10-13 05:23:27 [INFO] [mender-convert-package] Using configuration file: configs/mender\_convert\_config
> 
> 2020-10-13 05:23:27 [INFO] [mender-convert-package] Using configuration file: watt\_config
> 
> 2020-10-13 05:23:30 [INFO] [mender-convert-package] Rootfs filesystem size will be 3974 MiB
> 
> 2020-10-13 05:23:30 [INFO] [mender-convert-package] Creating a file-system image from: work/rootfs/data/
> 
> 2020-10-13 05:23:30 [INFO] [mender-convert-package] Creating a file-system image from: work/rootfs/
> 
> 2020-10-13 05:27:25 [INFO] [mender-convert-package] Copying root filesystem image to deploy directory
> 
> 2020-10-13 05:27:45 [INFO] [mender-convert-package] Writing Mender artifact to: deploy/101320-raspberrypi0w-mender.mender
> 
> 2020-10-13 05:27:45 [INFO] [mender-convert-package] This can take up to 20 minutes depending on which compression method is used
> 
> 2020-10-13 05:28:40 [INFO] [mender-convert-package] Creating Mender compatible disk-image
> 
> 2020-10-13 05:28:40 [INFO] [mender-convert-package] Total disk size: 16384 MiB
> 
> 2020-10-13 05:28:40 [INFO] [mender-convert-package] Boot partition 256 MiB
> 
> 2020-10-13 05:28:40 [INFO] [mender-convert-package] RootFS partitions 7924 MiB x 2
> 
> 2020-10-13 05:28:40 [INFO] [mender-convert-package] Data partition 256 MiB
> 
> 2020-10-13 05:28:40 [INFO] [mender-convert-package] Using input diskimage partition scheme (dos)
> 
> 2020-10-13 05:28:40 [INFO] [mender-convert-package] Writing DOS (MBR) partition table
> 
> 2020-10-13 05:28:41 [INFO] [mender-convert-package] Writing boot partition image
> 
> 2020-10-13 05:29:37 [INFO] [mender-convert-package] Writing rootfsa partition image
> 
> 2020-10-13 05:53:19 [INFO] [mender-convert-package] Writing rootfsb partition image
> 
> 2020-10-13 06:14:43 [INFO] [mender-convert-package] Writing data partition image
> 
> 2020-10-13 06:14:43 [INFO] [mender-convert-package] Performing platform specific package operations (if any)
> 
> 2020-10-13 06:14:43 [INFO] [mender-convert-package] Running hook: platform\_package
> 
> 2020-10-13 06:14:43 [INFO] [mender-convert-package] Compressing deploy/101320-raspberrypi0w-mender.img.gz

This already confused me:

> Rootfs filesystem size will be 3974 MiB  
> RootFS partitions 7924 MiB x 2

So which is it? I expected 7924 since it is approximately (16GB - 256MB - 256MB)/2.

Is the incorrect final size of the image (17.18GB vs 16GB) related to the fact that a 16GB card is really 2^34 = 17179869184 bits? Not that this helps because I can’t in the end burn the image, it complains the size of the card is too small for the image.

Please let me know if I should provide other details. Thanks!

---

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [October 13, 2020, 1:39pm UTC](https://hub.mender.io/t/image-size-created-by-mender-convert-does-not-match-mender-storage-total-size-mb/2661/2 "2020-10-13T13:39:26Z")

</div>

I think you need to set [IMAGE\_ROOTFS\_SIZE](https://docs.mender.io/system-updates-debian-family/variables#image_rootfs_size) to -1. WIth the value of 0, it will use the size of the input image partition rather than the calculated size.

Drew

---

<div class="post-metadata">

**Author:** ![oernst](https://avatars.discourse-cdn.com/v4/letter/o/65b543/32.png) [@oernst](https://hub.mender.io/u/oernst)\
**Post date:** [October 13, 2020, 4:13pm UTC](https://hub.mender.io/t/image-size-created-by-mender-convert-does-not-match-mender-storage-total-size-mb/2661/3 "2020-10-13T16:13:43Z")

</div>

Thanks for the quick reply.

I tried this now, but I still got an image that is 17.18GB instead of 16. The change I saw in the logs is:

> Rootfs filesystem size will be 7924 MiB  
> RootFS partitions 7924 MiB x 2

So now these two match, which makes more sense.

Is there something else I need to set? Or do you think this is a bug?

I kept the two related flags set to their defaults:

> IMAGE\_ROOTFS\_EXTRA\_SPACE=“0”  
> IMAGE\_OVERHEAD\_FACTOR=“1.5”

Thanks

---

<div class="post-metadata">

**Author:** ![oernst](https://avatars.discourse-cdn.com/v4/letter/o/65b543/32.png) [@oernst](https://hub.mender.io/u/oernst)\
**Post date:** [October 13, 2020, 5:02pm UTC](https://hub.mender.io/t/image-size-created-by-mender-convert-does-not-match-mender-storage-total-size-mb/2661/4 "2020-10-13T17:02:33Z")

</div>

For further context, here is the complete config file I used:

```
RASPBERRYPI_CONFIG="raspberrypi0w"
RASPBERRYPI_KERNEL_IMAGE="kernel.img"
MENDER_KERNEL_IMAGETYPE=zImage
MENDER_DEVICE_TYPE="raspberrypi0w"

source configs/raspberrypi_config

# 16384 here produces disk which is 17.18GB
MENDER_STORAGE_TOTAL_SIZE_MB="16384"
MENDER_BOOT_PART_SIZE_MB="256"
MENDER_DATA_PART_SIZE_MB="256"

IMAGE_ROOTFS_SIZE=0
```

---

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [October 13, 2020, 6:13pm UTC](https://hub.mender.io/t/image-size-created-by-mender-convert-does-not-match-mender-storage-total-size-mb/2661/5 "2020-10-13T18:13:50Z")

</div>

Indeed. 17179869184 is 16 \* 2^30 = 16  
I guess it is the difference between [gigabyte](https://en.wikipedia.org/wiki/Gigabyte) and [gibibyte](https://en.wikipedia.org/wiki/Gibibyte).

Interestingly I did notice the following:

> $ ls -l deploy/2020-05-27-raspios-buster-lite-armhf-raspberrypi0w-mender.img  
> -rw-r–r-- 1 dmoseley dmoseley 17179869184 Oct 13 14:01 deploy/2020-05-27-raspios-buster-lite-armhf-raspberrypi0w-mender.img  
> $ ls -lh deploy/2020-05-27-raspios-buster-lite-armhf-raspberrypi0w-mender.img  
> -rw-r–r-- 1 dmoseley dmoseley 16G Oct 13 14:01 deploy/2020-05-27-raspios-buster-lite-armhf-raspberrypi0w-mender.img

---

<div class="post-metadata">

**Author:** ![oernst](https://avatars.discourse-cdn.com/v4/letter/o/65b543/32.png) [@oernst](https://hub.mender.io/u/oernst)\
**Post date:** [October 13, 2020, 6:31pm UTC](https://hub.mender.io/t/image-size-created-by-mender-convert-does-not-match-mender-storage-total-size-mb/2661/6 "2020-10-13T18:31:24Z")

</div>

Thanks for clarifying, didn’t even know the term gibibyte haha! But yes I can confirm that I get this too for my image:

```
ls -l 101320-raspberrypi0w-mender.img
-rw-r--r-- 1 oernst staff 17179869184 Oct 12 23:32 101320-raspberrypi0w-mender.img

ls -lh 101320-raspberrypi0w-mender.img
-rw-r--r-- 1 oernst staff 16G Oct 12 23:32 101320-raspberrypi0w-mender.img

```

But ApplePiBaker isn’t too happy with that 😕

![Screen Shot 2020-10-13 at 11.30.04 AM](https://canada1.discourse-cdn.com/flex036/uploads/mender/original/1X/7f7850590c07477414628f6490a8da4279460e44.png)

---

<div class="post-metadata">

**Author:** ![oernst](https://avatars.discourse-cdn.com/v4/letter/o/65b543/32.png) [@oernst](https://hub.mender.io/u/oernst)\
**Post date:** [October 14, 2020, 2:22am UTC](https://hub.mender.io/t/image-size-created-by-mender-convert-does-not-match-mender-storage-total-size-mb/2661/7 "2020-10-14T02:22:51Z")

</div>

Sorry, I think I just got it.

So all the variables in the config file that are stated as …\_MB are actually …\_MiB? So if I really wanted a 16384 MB ~ 16GB card (which is probably a bit too big, since the actual size of a 16GB card is usually reported more like 14.8GB), then:

16GB = 15258 MiB

should be the actual value of MENDER\_STORAGE\_TOTAL\_SIZE\_MB. Is that correct?

---

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [October 14, 2020, 1:26pm UTC](https://hub.mender.io/t/image-size-created-by-mender-convert-does-not-match-mender-storage-total-size-mb/2661/8 "2020-10-14T13:26:27Z")

</div>

I didn’t check the math but the principle is correct. The alternative would be to specify it as quite a bit smaller than the actual card size and then enable [MENDER\_DATA\_PART\_GROWFS](https://docs.mender.io/system-updates-debian-family/variables#mender_data_part_growfs) to have the /data partition expanded at runtime to fill the balance of the media.

---

<div class="post-metadata">

**Author:** ![oernst](https://avatars.discourse-cdn.com/v4/letter/o/65b543/32.png) [@oernst](https://hub.mender.io/u/oernst)\
**Post date:** [October 14, 2020, 11:12pm UTC](https://hub.mender.io/t/image-size-created-by-mender-convert-does-not-match-mender-storage-total-size-mb/2661/9 "2020-10-14T23:12:39Z")

</div>

Thanks! That clears up my questions.

I wish the variables were named \_MiB instead of MB haha, but probably it would be too confusing to change.

Thanks
