# How to set new partition size with mender-convert

**URL:** https://hub.mender.io/t/how-to-set-new-partition-size-with-mender-convert/399
**Category:** General Discussions
**Tags:** raspbian, mender-convert, rpi0w
**Created:** [March 20, 2019, 8:22pm UTC](https://hub.mender.io/t/how-to-set-new-partition-size-with-mender-convert/399 "2019-03-20T20:22:34Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)
#### Post date: [March 20, 2019, 8:46pm UTC](https://hub.mender.io/t/how-to-set-new-partition-size-with-mender-convert/399/2 "2019-03-20T20:46:24Z")

</div>

I moved this to a separate topic as we are now entering more generic information.

> Is there a way to tell mender-convert that I only want 4GB partitions?

Yes `mender-convert` has an option `--storage-total-size-mb` where you can specify a total size in MB, and this is used to calculate the partition sizes. There is also a variable to set the data part size (`data-part-size-mb`), typically you do not need to set this to a very high number as this will be expanded to occupy the “rest of the disk” on first boot.

To calculate rootfs partition size there is a simple formula,

```
rootfs partition size = (storage-total-size-mb - data-part-size-mb - boot part size (40MB)) / 2

```

But there is a caveat, rootfs partition size can not be smaller then the size of the input image.

> I thought maybe `raw-disk-image-shrink-rootfs` was what I might want to use, but I’m not sure how to use it:

And this is where `raw-disk-image-shrink-rootfs` comes in, to be able to shrink the expanded image to `actual size + 20 % free space`, and then it can be resized using `--storage-total-size-mb`

Also the reason why your rootfs is 15GB is because by default Raspbian will also resize the rootfs partition on first boot to fill the disk, and I am assuming that you have a 16 GB SD card.

The command that you used to run `raw-disk-image-shrink-rootfs` is correct.

The problem you are seeing is fixed [here](https://github.com/mendersoftware/mender-convert/commit/1b6f2425074b8246516f91340dcd6b8881688645). The reason that you are seeing this bug is that the `mender-convert` used for `rpi0w` is not the official [mender-convert repository](https://github.com/mendersoftware/mender-convert) and is instead based on a [fork](https://github.com/nandra/mender-conversion-tools/commits/rpi0w-toolchain). A link to a very long discussion on why can be found [here](https://github.com/mendersoftware/mender-convert/pull/59).

If you look at the linked commit for the `raw-disk-image-shrink-rootfs` fix, you can easily patch that locally for now. But I am sure that @MarekBelisko will sync up his fork when he has some time.

---

_[View the full topic](https://hub.mender.io/t/how-to-set-new-partition-size-with-mender-convert/399)._
