# Mender-growfs-data and extra partitions

**URL:** <https://hub.mender.io/t/mender-growfs-data-and-extra-partitions/4050>\
**Category:** General Discussions\
**Tags:** mender\_extra\_parts\
**Created:** [September 1, 2021, 2:52pm UTC](https://hub.mender.io/t/mender-growfs-data-and-extra-partitions/4050 "2021-09-01T14:52:19Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![gschmott](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@gschmott](https://hub.mender.io/u/gschmott)\
**Post date:** [September 1, 2021, 2:52pm UTC](https://hub.mender.io/t/mender-growfs-data-and-extra-partitions/4050/1 "2021-09-01T14:52:19Z")

</div>

I have an embedded ZyboZ7 board running Yocto Zeus. It boots from a 4GB SDcard and I’m getting the following error from the mender-grow-data.service:

> mender-client-resize-data-part[92]: Error: Can’t have overlapping partitions.

This systemd service calls:

/usr/bin/mender-client-resize-data-part

Which in turn tries to resize (grow) my ‘data’ partition (5):

/usr/sbin/parted -s /dev/mmcblk0 resizepart 5 100%

My Mender configuration adds an extra partition using the MENDER\_EXTRA\_PARTS mechanism. Here is my configuration:

```auto
# Mender Configuration

# The Mender storage device.
MENDER_STORAGE_DEVICE = "/dev/mmcblk0"

# Size of the memory device in MiB.
MENDER_STORAGE_TOTAL_SIZE_MB = "3700"

# Partition alignment
MENDER_PARTITION_ALIGNMENT = "4096"

MENDER_BOOT_PART_SIZE_MB = "16"
MENDER_BOOT_PART = "${MENDER_STORAGE_DEVICE_BASE}1"
MENDER_ROOTFS_PART_A = "${MENDER_STORAGE_DEVICE_BASE}2"
MENDER_ROOTFS_PART_B = "${MENDER_STORAGE_DEVICE_BASE}3"
# An extra partition will result in the creation of an extended msdos
# partition in place of the primary partition typically used by the
# Mender 'data' partition. By default 'data' partition starts at "4" but it
# is now an extended partition. The "new" data partition will now
# shift to partition "5" and subsequent extra partitions will follow
# afterwards (e.g. "6", "7", ...).
MENDER_DATA_PART = "${MENDER_STORAGE_DEVICE_BASE}5"
MENDER_DATA_PART_FSTAB_OPTS_append = ",sync"

# Extra partitions
MENDER_EXTRA_PARTS = "dante"
MENDER_EXTRA_PARTS[dante] = "--label=dante --fstype=ext4"
MENDER_EXTRA_PARTS_SIZES_MB[dante] = "4"
MENDER_EXTRA_PARTS_FSTAB[dante] = "auto defaults,sync"

MENDER_ARTIFACT_NAME = "${DISTRO}-2021-05-18"

MENDER_FEATURES_ENABLE_append = " mender-image mender-image-sd mender-client-install mender-uboot mender-systemd mender-growfs-data"

# This needs equal (2 * (BOOTENV_SIZE + (BOOTENV_SIZE % MENDER_PARTITION_ALIGNMENT)))
MENDER_RESERVED_SPACE_BOOTLOADER_DATA = "262144"

```

And my SDCard partitioning looks like the following:

```auto
# parted /dev/mmcblk0 unit s print
Model: SD SA04G (sd/mmc)
Disk /dev/mmcblk0: 7626752s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number Start End Size Type File system Flags
 1 520s 33287s 32768s primary fat16 boot, lba
 2 33288s 3670271s 3636984s primary ext4
 3 3670272s 7307255s 3636984s primary ext4
 4 7307263s 7577607s 270345s extended lba
 5 7307264s 7569407s 262144s logical ext4
 6 7569416s 7577607s 8192s logical ext4

```

So basically, the `data` and `dante` partitions (5 & 6) are part of an extended msdos partition (4). The error occurs when `parted` attempts to grow the `data` partition but cannot because the `dante` partition follows immediately after it. It seems this is the issue. Ideally I want the `data` partition to follow the `dante` partition (rather than vice-versa) so it could grow. Is there any way to configure Mender to place the data partition _ **after** _ the extra partitions so that it can grow automatically? Are extra partitions incompatible with auto growing the `data` partition?

---

<div class="post-metadata">

**Author:** ![oleorhagen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/oleorhagen/32/297_2.png) [@oleorhagen](https://hub.mender.io/u/oleorhagen)\
**Post date:** [September 3, 2021, 8:17am UTC](https://hub.mender.io/t/mender-growfs-data-and-extra-partitions/4050/2 "2021-09-03T08:17:10Z")

</div>

Hi @gschmott

As far as I can understand, as it is now, the data partition extension is incompatible with the extra partitions.

But I’m not intricately familiar with the image functionality.

Perhaps @kacf could help shed some further light on the issue?

---

<div class="post-metadata">

**Author:** ![gschmott](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@gschmott](https://hub.mender.io/u/gschmott)\
**Post date:** [September 3, 2021, 1:10pm UTC](https://hub.mender.io/t/mender-growfs-data-and-extra-partitions/4050/3 "2021-09-03T13:10:31Z")

</div>

Hi @oleorhagen -

This is what I understand as well after seeing the error reported in the systemd logs. I was hoping there was a work-around other than disabling the auto-growth functionality and doing a better job estimating the size I need up-front for the data partition.

Hoping someone else can suggest a work-around 😉

---

<div class="post-metadata">

**Author:** ![dellgreen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/dellgreen/32/85_2.png) [@dellgreen](https://hub.mender.io/u/dellgreen)\
**Post date:** [September 3, 2021, 1:56pm UTC](https://hub.mender.io/t/mender-growfs-data-and-extra-partitions/4050/4 "2021-09-03T13:56:40Z")

</div>

I would say you have 2 possible work-arounds,

1. Investigate how to bbappend the mender yocto recipes to fix up the necessary files to target the last a partition for growth rather than the data partition
2. disable mender growfs and add you own system service that handles growing the last partition and its file system on boot.

---

<div class="post-metadata">

**Author:** ![gschmott](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@gschmott](https://hub.mender.io/u/gschmott)\
**Post date:** [September 3, 2021, 2:21pm UTC](https://hub.mender.io/t/mender-growfs-data-and-extra-partitions/4050/5 "2021-09-03T14:21:24Z")

</div>

> [@dellgreen](#):
>
> Investigate how to bbappend the mender yocto recipes to fix up the necessary files to target the last a partition for growth rather than the data partition

That’s the thing, I do not want the `dante` (extra) partition to grow but rather _only_ the `data` partition. What this means is **always** placing the extra partitions **before** the `data` partition so that `data` can be grown into the unused space. I suspect this is easier said than be done and likely requires more than a bbappend fix since (if I recall) much of the functionality is located in a Mender bbclass.

> [@dellgreen](#):
>
> disable mender growfs and add you own system service that handles growing the last partition and its file system on boot.

I wouldn’t have to disable Mender’s growfs systemd service if I could move the `data` partition _after_ the extra partitions. But this essentially is the crux of the problem - the placement of the extra partitions in relation to the `data` partition.

---

<div class="post-metadata">

**Author:** ![dellgreen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/dellgreen/32/85_2.png) [@dellgreen](https://hub.mender.io/u/dellgreen)\
**Post date:** [September 3, 2021, 2:39pm UTC](https://hub.mender.io/t/mender-growfs-data-and-extra-partitions/4050/6 "2021-09-03T14:39:24Z")

</div>

Oh I see, sorry I misunderstood your requirements

---

<div class="post-metadata">

**Author:** ![kacf](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kacf/32/146_2.png) [@kacf](https://hub.mender.io/u/kacf)\
**Post date:** [September 7, 2021, 5:45am UTC](https://hub.mender.io/t/mender-growfs-data-and-extra-partitions/4050/7 "2021-09-07T05:45:08Z")

</div>

Yeah, this isn’t supported at the moment. What would be great is if [this section](https://github.com/mendersoftware/meta-mender/blob/dunfell-v2021.08/meta-mender-core/classes/mender-part-images.bbclass#L139-L145) could take into account which number the `MENDER_DATA_PART` variable has, and use that to place the partition appropriately. This would require changing and probably splitting up [this function](https://github.com/mendersoftware/meta-mender/blob/dunfell-v2021.08/meta-mender-core/classes/mender-helpers.bbclass#L392-L400) into two parts, one for before the data partition, and one for after. It would have to take into account extended partitions too.

A pull request for this would be appreciated!

---

<div class="post-metadata">

**Author:** ![bram](https://avatars.discourse-cdn.com/v4/letter/b/9d8465/32.png) [@bram](https://hub.mender.io/u/bram)\
**Post date:** [October 3, 2023, 10:30am UTC](https://hub.mender.io/t/mender-growfs-data-and-extra-partitions/4050/8 "2023-10-03T10:30:22Z")

</div>

Is there any update on this issue? Has it been resolved in a newer version?

---

<div class="post-metadata">

**Author:** ![kacf](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kacf/32/146_2.png) [@kacf](https://hub.mender.io/u/kacf)\
**Post date:** [October 6, 2023, 7:08am UTC](https://hub.mender.io/t/mender-growfs-data-and-extra-partitions/4050/9 "2023-10-06T07:08:36Z")

</div>

I’m afraid not, no one has stepped up and contributed this yet.
