# \[Meta-mender\] Add new partition

**URL:** <https://hub.mender.io/t/meta-mender-add-new-partition/213>\
**Category:** General Discussions\
**Created:** [February 12, 2019, 10:04am UTC](https://hub.mender.io/t/meta-mender-add-new-partition/213 "2019-02-12T10:04:55Z")\
**Posts on this page:** 20\
**Page:** 2

<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:** [February 13, 2019, 10:17am UTC](https://hub.mender.io/t/meta-mender-add-new-partition/213/21 "2019-02-13T10:17:57Z")

</div>

apologies, i keep forgetting that there’s no read only anonymous access to mender issue tracker.  
Below is the issue info:

> “we should allow extra wic partition lines to be specified and appended to the mender dynamically generated wic file. Possibly another mender variable that contains extras lines to be appended. Lines will need to be parsed for --fixed-size and --size parameters so that the mender a/b rootfs size calculation can adjust accordingly”

---

<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:** [February 13, 2019, 10:21am UTC](https://hub.mender.io/t/meta-mender-add-new-partition/213/22 "2019-02-13T10:21:11Z")

</div>

> keep forgetting that there’s no read only anonymous access to mender issue tracker

There is read-only anonymous access,

[https://tracker.mender.io/browse/MEN-2362](https://tracker.mender.io/browse/MEN-2362)

The problem was that you had a “?filter=2”, appended to the URL which seems to require an account to view.

---

<div class="post-metadata">

**Author:** ![jorisoffouga](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/jorisoffouga/32/64_2.png) [@jorisoffouga](https://hub.mender.io/u/jorisoffouga)\
**Post date:** [February 13, 2019, 10:29am UTC](https://hub.mender.io/t/meta-mender-add-new-partition/213/23 "2019-02-13T10:29:56Z")

</div>

Thanks Mirzak 😀

---

<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:** [February 13, 2019, 10:30am UTC](https://hub.mender.io/t/meta-mender-add-new-partition/213/24 "2019-02-13T10:30:02Z")

</div>

apologies, i took the filter off of the label but not off of the url itself. it should work now

---

<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:** [February 13, 2019, 10:32am UTC](https://hub.mender.io/t/meta-mender-add-new-partition/213/25 "2019-02-13T10:32:21Z")

</div>

Actually, there is, it’s the link that contains a filter value which is  
not permitted. The bug itself is public. This is the correct link:  
[https://tracker.mender.io/browse/MEN-2362](https://tracker.mender.io/browse/MEN-2362)

---

<div class="post-metadata">

**Author:** ![jorisoffouga](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/jorisoffouga/32/64_2.png) [@jorisoffouga](https://hub.mender.io/u/jorisoffouga)\
**Post date:** [February 13, 2019, 10:33am UTC](https://hub.mender.io/t/meta-mender-add-new-partition/213/26 "2019-02-13T10:33:17Z")

</div>

Yes a variable with the size and the / app for example.  
Is it warned to be able to update other partition than A / B? If I take an example on rauc with we can update a specific slot

---

<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:** [February 13, 2019, 10:48am UTC](https://hub.mender.io/t/meta-mender-add-new-partition/213/27 "2019-02-13T10:48:30Z")

</div>

its early stages at the moment, just kicking around ideas.

---

<div class="post-metadata">

**Author:** ![uttaravadina](https://avatars.discourse-cdn.com/v4/letter/u/e99b99/32.png) [@uttaravadina](https://hub.mender.io/u/uttaravadina)\
**Post date:** [November 18, 2019, 5:28am UTC](https://hub.mender.io/t/meta-mender-add-new-partition/213/28 "2019-11-18T05:28:34Z")

</div>

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

---

<div class="post-metadata">

**Author:** ![uttaravadina](https://avatars.discourse-cdn.com/v4/letter/u/e99b99/32.png) [@uttaravadina](https://hub.mender.io/u/uttaravadina)\
**Post date:** [November 18, 2019, 5:30am UTC](https://hub.mender.io/t/meta-mender-add-new-partition/213/29 "2019-11-18T05:30:23Z")

</div>

@drewmoseley

@dellgreen Can you provide the logical steps for the same to replicate this behaviour on [mender-convert](https://github.com/mendersoftware/mender-convert)?

I have been trying to use **mender-convert** and **add an extra partition** which was **exceeding** the maximum number (4) of primary partitions allowed on **MBR partition table**. So, I forcefully tried to **create an extended partition** and then add the extra partition along with the data partition as a logical partition.

I am getting an Error, **“Error: The location 7176190 is outside of the device /mender-convert/output/image.sdimg.”** \*

What am I doing wrong here?

Below is the link to the **patch file** that came out of the commits I made locally, the **log file** and output of **fdisk -u -l image.img**. The branch used was **1.2.x** in **mender-convert**

[patch file](https://yadi.sk/d/5cDd7umEn7YYyg)  
[log file](https://yadi.sk/d/ED-0jMDvWYDHRw)  
[fdisk.out](https://yadi.sk/d/DQHUFRY_uiFArA)

Thanks in advance

---

<div class="post-metadata">

**Author:** ![uttaravadina](https://avatars.discourse-cdn.com/v4/letter/u/e99b99/32.png) [@uttaravadina](https://hub.mender.io/u/uttaravadina)\
**Post date:** [November 19, 2019, 7:51am UTC](https://hub.mender.io/t/meta-mender-add-new-partition/213/31 "2019-11-19T07:51:42Z")

</div>

[Add support for GPT partition tables](https://tracker.mender.io/browse/MEN-2151?focusedCommentId=91274&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel)

@drewmoseley I think if the above one is introduced then the Problem can be resolved for adding extra partitions for mender-convert

@dellgreen looking forward to your reply

---

<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:** [November 19, 2019, 8:32am UTC](https://hub.mender.io/t/meta-mender-add-new-partition/213/32 "2019-11-19T08:32:55Z")

</div>

I’ll have to defer this one, as i have no experience with mender-convert, and the yocto work i was doing on this has been shelved for now as other priorities have taken over.

---

<div class="post-metadata">

**Author:** ![uttaravadina](https://avatars.discourse-cdn.com/v4/letter/u/e99b99/32.png) [@uttaravadina](https://hub.mender.io/u/uttaravadina)\
**Post date:** [November 19, 2019, 8:58am UTC](https://hub.mender.io/t/meta-mender-add-new-partition/213/33 "2019-11-19T08:58:41Z")

</div>

I will do give a try to Yocto as I have some experience but mender-convert seemed convenient enough.  
Will it be possible for you @dellgreen to guide me through this? The goal is to add an extra partition but currently the total number of partitions exceed 4 and MBR is limited to 4 primary partitions.

Is there any other way?

---

<div class="post-metadata">

**Author:** ![marizonne.villafranc](https://avatars.discourse-cdn.com/v4/letter/m/ad7895/32.png) [@marizonne.villafranc](https://hub.mender.io/u/marizonne.villafranc)\
**Post date:** [August 9, 2021, 5:04am UTC](https://hub.mender.io/t/meta-mender-add-new-partition/213/34 "2021-08-09T05:04:29Z")

</div>

Hi,

Is this issue resolved? How do I add a new partition outside of /data ?  
I am tasked to create additional two partitions:

mmcblk1p1 = rootfs A  
mmcblk1p2 = rootfs B  
mmcblk1p3 = data  
mmcblk1p4 = factorydata  
mmcblk1p5 = userdata

Please help. Thank you!

---

<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:** [August 9, 2021, 6:41am UTC](https://hub.mender.io/t/meta-mender-add-new-partition/213/35 "2021-08-09T06:41:58Z")

</div>

Yes, use the [`MENDER_EXTRA_PARTS`](https://docs.mender.io/system-updates-yocto-project/variables#mender_extra_parts) variable.

---

<div class="post-metadata">

**Author:** ![marizonne.villafranc](https://avatars.discourse-cdn.com/v4/letter/m/ad7895/32.png) [@marizonne.villafranc](https://hub.mender.io/u/marizonne.villafranc)\
**Post date:** [August 10, 2021, 2:00am UTC](https://hub.mender.io/t/meta-mender-add-new-partition/213/36 "2021-08-10T02:00:25Z")

</div>

Hi,

This is what I did but nothing happens. I did not see any directories under /mnt

```auto
# Extra partitions to create after the data partition
MENDER_EXTRA_PARTS = "factorydata userdata"
#
# Size (in MB) of specified extra partition
MENDER_EXTRA_PARTS_SIZES_MB[factorydata] = "512"
MENDER_EXTRA_PARTS_SIZES_MB[userdata] = "2048"
#
# FSTAB options of specified extra partition (optional)
MENDER_EXTRA_PARTS_FSTAB[factorydata] = "auto,defaults,nofail,0,0"
MENDER_EXTRA_PARTS_FSTAB[userdata] = "auto,defaults,nofail,0,0"

```

---

<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:** [August 10, 2021, 10:05am UTC](https://hub.mender.io/t/meta-mender-add-new-partition/213/37 "2021-08-10T10:05:12Z")

</div>

Which meta-mender branch are you using? This first appeared in zeus, I believe.

Also, I discovered that the documentation is slightly wrong. It should be specified [like this](https://github.com/mendersoftware/mender-docs/pull/1521/files).

---

<div class="post-metadata">

**Author:** ![marizonne.villafranc](https://avatars.discourse-cdn.com/v4/letter/m/ad7895/32.png) [@marizonne.villafranc](https://hub.mender.io/u/marizonne.villafranc)\
**Post date:** [August 12, 2021, 4:12am UTC](https://hub.mender.io/t/meta-mender-add-new-partition/213/38 "2021-08-12T04:12:46Z")

</div>

Hi @kacf ,

I am using zues branch.

I changed the fstab options to:

```auto
MENDER_EXTRA_PARTS_FSTAB[factorydata] = "auto defaults,nofail 0 0"
MENDER_EXTRA_PARTS_FSTAB[userdata] = "auto defaults,nofail 0 0"

```

still, I can’t see any additional partitions.

---

<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:** [August 12, 2021, 11:53am UTC](https://hub.mender.io/t/meta-mender-add-new-partition/213/39 "2021-08-12T11:53:04Z")

</div>

In that case I think you will have to do some manual debugging and find out why [this](https://github.com/mendersoftware/meta-mender/blob/zeus/meta-mender-core/classes/mender-part-images.bbclass#L144) doesn’t expand correctly (the function itself is in `mender-helpers.bbclass`).

---

<div class="post-metadata">

**Author:** ![marizonne.villafranc](https://avatars.discourse-cdn.com/v4/letter/m/ad7895/32.png) [@marizonne.villafranc](https://hub.mender.io/u/marizonne.villafranc)\
**Post date:** [August 25, 2021, 1:37am UTC](https://hub.mender.io/t/meta-mender-add-new-partition/213/40 "2021-08-25T01:37:01Z")

</div>

Hi,

I was able to successfully create a partition but seems like I can’t create a folder or put any files on it.

```auto
# Extra partitions to create after the data parition
MENDER_EXTRA_PARTS = "part1"
MENDER_EXTRA_PARTS[part1] = "--label=hero-secc --fstype=ext4 --fixed-size=2048"
#
# Size (in MB) of specified extra partition
MENDER_EXTRA_PARTS_SIZES_MB[part1] = "2048"
#
# FSTAB options of specified extra partition (optional)
MENDER_EXTRA_PARTS_FSTAB[part1] = "auto defaults 0 2"

```

This is how I create folder on it:

```auto
SRC_URI += " file://config.json \
             file://productionData.json \
"

FILES_${PN} = "/data/hero-secc/factorydata \
               /mnt/hero-secc/userdata \		        
"

do_install() {
	install -d -m 755 ${D}/data/hero-secc/factorydata
	install -m 755 ${WORKDIR}/productionData.json ${D}/data/hero-secc/factorydata

	install -d -m 755 ${D}/mnt/hero-secc/userdata
	install -m 755 ${WORKDIR}/config.json ${D}/mnt/hero-secc/userdata
}

```

This is the fstab:

```auto
root@hero-secc:/data/hero-secc/factorydata# cd
# stock fstab - you probably want to override this with a machine specific one

/dev/root / auto ro,ro 1 0
proc /proc proc defaults 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
tmpfs /run tmpfs mode=0755,nodev,nosuid,stri
ctatime 0 0
tmpfs /var/volatile tmpfs defaults 0 0

# uncomment this if your device has a SD/MMC/Transflash slot
#/dev/mmcblk0p1 /media/card auto defaults,sync,noauto 0 0

/dev/mmcblk1p3 /data auto defaults 0 2
/dev/mmcblk1p4 /mnt/hero-secc auto defaults 0 2

```

Please advise. Thank you!

---

<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:** [August 25, 2021, 8:43am UTC](https://hub.mender.io/t/meta-mender-add-new-partition/213/41 "2021-08-25T08:43:55Z")

</div>

I think this is not supported yet, actually. There are two things that would need to be implemented for this to work:

1. The mount paths for the partitions in `MENDER_EXTRA_PARTS` need to be added to `IMAGE_ROOTFS_EXCLUDE_PATH`. This makes sure that any files added to these folders are not included in the root filesystem.
2. In the `get_extra_parts_wks` function, it needs to take into account that it should reference those folders. I don’t recall the exact syntax off the top of my head, but it’s something like `--rootfs=${IMAGE_ROOTFS}/mnt/hero-secc`. The last `hero-secc` part should be extracted from `MENDER_EXTRA_PARTS`, ideally, and not be hard coded. This makes sure that the folder do get included in the extra partitions’ filesystems.

You can either hardcode those things locally, or even better if you can make it generic and submit a pull request!

[Previous page](https://hub.mender.io/t/meta-mender-add-new-partition/213.md?page=1)

[Next page](https://hub.mender.io/t/meta-mender-add-new-partition/213.md?page=3)
