# Compression and large disk images

**URL:** <https://hub.mender.io/t/compression-and-large-disk-images/4968>\
**Category:** General Discussions\
**Created:** [May 17, 2022, 10:08pm UTC](https://hub.mender.io/t/compression-and-large-disk-images/4968 "2022-05-17T22:08:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lmrogp](https://avatars.discourse-cdn.com/v4/letter/l/c4cdca/32.png) [@lmrogp](https://hub.mender.io/u/lmrogp)\
**Post date:** [May 17, 2022, 10:08pm UTC](https://hub.mender.io/t/compression-and-large-disk-images/4968/1 "2022-05-17T22:08:45Z")

</div>

I have a 128 GB golden image, and do the initial mender-convert, which gives me the image in mender format. Everything is fine with the conversion, but the output `.img` file is also 128 GB, which makes it slow to burn to SD and not so easy to copy, share, etc.

I experimented with the MENDER\_COMPRESS\_DISK\_IMAGE setting, trying the gzip and lzma options, but that setting does not appear to affect the size of the generated `.img` file, which is still 128 GB. I have also used PiShrink on the `.img` after conversion, which works well for reducing its size. But PiShrink is not designed for Mender’s four partition layout, so at first boot expansion the empty disk space is assigned to the root partition. The pre-shrunk Mender image had a 102.5 GB `/data` partition, and most all of it is lost to root.

Am I missing a setting in Mender that will shrink the initial `.img` file, so that it will expand with correct partition sizes at first boot of the SD? If not, is there something like PiShrink that can handle the Mender partition layout? My workaround now with PiShrink is to use `parted` to manually resize the `/data` partition after first boot , then another reboot followed by running `resize2fs` on the partition. It works, but is not acceptable as a long term solution.

Thanks.
