Label for rootfs A & B partition

Hi,
I have a yocto build that use meta-mender-kernel layer. I want to set this variables like this:

MENDER_STORAGE_DEVICE = ""
MENDER_BOOT_PART = "/dev/disk/by-label/BOOT"
MENDER_ROOTFS_PART_A = "/dev/disk/by-label/rootfsa"
MENDER_ROOTFS_PART_B = "/dev/disk/by-label/rootfsb"
MENDER_DATA_PART = "/dev/disk/by-label/data"

If I set the variable like this:

MENDER_STORAGE_DEVICE = "/dev/sda"
MENDER_STORAGE_DEVICE_BASE = "${MENDER_STORAGE_DEVICE}"
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"
MENDER_DATA_PART = "${MENDER_STORAGE_DEVICE_BASE}4"

I’ve found that /dev/sda1 and /dev/sda4 have respectively BOOT label and data label How can I add a label for rootfs partitions?

I believe you can’t. The reason is that it’s not safe to refer to rootfs labels. They will be destroyed every time you make an update, and two partitions can even have the same label depending on what updates you have previously deployed.

Thanks @kacf for the reply. My goal is to make a build that can works with different disk type (sd, nvme, mmcblk, etc…). Using mender-partuuid is not a option because it is not supported in meta-mender-kernel.

@andrearomano31 did you ever find a solution/workaround?

We also produce somewhat “generic” amd64 builds for our product. They are pretty portable and will run over a wide range of machine, except for the MENDER_STORAGE_DEVICE.

Right now we are considering producing a range of images/device types with the only difference being MENDER_STORAGE_DEVICE. i.e. mmcblk0 for mmc devices, sda for sata installs, vda for virtual machines… That seems like such a hack and a waste of resources.

Maybe an exploration as to why meta-mender-kernel doesn’t support partition uuid referencing should happen as what you want to do is exactly what the partuuid is for and I use it for this myself in production for non-yocto mender based projects

So just in case someone finds this thread…

The mender-partuuid feature is exactly what I was looking for. This allowed us to produce a single build that is flashable to sata, mmc or even virtio disks.

The feature requires GRUB, so this only works for intel/pc platforms. For ARM boards, the image is custom and the install media is usually known in advance, so it is a non-issue.

We are not supporting secure boot at the moment, so we don’t need meta-mender-kernel. Be aware of dellgreen’s comment, that mender-partuuid does not work in this case.