overlayroot should support multiple lowerdir mounts

Bug #1499853 reported by Ryan Harper
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
cloud-initramfs-tools (Ubuntu)
Confirmed
Wishlist
Unassigned

Bug Description

As of 3.19+, overlayfs supports multiple lowerdir mount points to enable merging multiple read-only layers together which is useful for composing multiple layers together and then imposing an specific upper layer (say tmpfs).

From the kernel documentation[1]

| Multiple lower layers
| ---------------------
|
| Multiple lower layers can now be given using the the colon (":") as a
| separator character between the directory names. For example:
|
| mount -t overlay overlay -olowerdir=/lower1:/lower2:/lower3 /merged
|
| As the example shows, "upperdir=" and "workdir=" may be omitted. In
| that case the overlay will be read-only.
|
| The specified lower directories will be stacked beginning from the
| rightmost one and going left. In the above example lower1 will be the
| top, lower2 the middle and lower3 the bottom layer.

To enable this in overlayroot, we'd extend the the overlayroot parameter to take multiple lower= parameters:

Take for example a current command line used to boot a cloudimg and use a tmpfs backed rw layer:

root=LABEL=cloudimg-rootfs overlayroot=tmpfs

If we had a second device/partition that we wanted to stack on top of the root fs, we'd pass this on the command line

root=LABEL=cloudimg-rootfs overlayroot=tmpfs,lower=LABEL=myoverlay

which would:

1. ensure that we mounted LABEL=myoverlay on the root filesystem (say /media/lower1-ro)
2. then run the following overlay mount

mount -t overlay -o lowerdir=/media/lower1:/media/root-ro,upperdir=/media/root-rw/overlay,workdir=/media/root-rw/overlay-work

Giving us a final stack of:

[tmpfs]
[LABEL=myoverlay]
[LABEL=cloudimg-rootfs

We also may want to stack more than one extra lower, specifying top-most layer first, on to the lower layers.

root=LABEL=cloudimg-rootfs overlayroot=tmpfs,lower=LABEL=myoverlay,lower=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0,lower=/dev/vdc

resulting in:

[tmpfs]
[LABEL=myoverlay]
[iscsi]
[vdc]
[LABEL=cloudimg-rootfs]

1. https://www.kernel.org/doc/Documentation/filesystems/overlayfs.txt

Scott Moser (smoser)
Changed in cloud-initramfs-tools (Ubuntu):
status: New → Confirmed
importance: Undecided → Low
Scott Moser (smoser)
Changed in cloud-initramfs-tools (Ubuntu):
importance: Low → Wishlist
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.