2

Background:

I have an embedded system with both flash and SD storage.

Currently I use flash just for booting (uBoot, kernel, initramfs).

Root filesystem (/) is on SD (ext3 on /dev/mmcblk0p2).

I (sometimes) experience SD failures when power is suddenly removed (I cannot prevent that, unfortunately).

I would like to divide Root filesystem in two overlays, so that the bulk of the system is 'lower' read/only, stored in flash (possibly replacing initramfs) while the application dependent "upper" overlay is on another read/write ext3/4 partition on SD.

ALL pieces needed to full boot should be on "lower", so that the system can work if "upper" is (temporarily) lost.

/tmp, /var and other place needing to be read/write are already on tmpfs, so system can boot with a read/only /.

In case of failure "lower" can try to recover and, as last resort completely mkfs.ext4 /dev/mmcblk0p3 and reinitialize it.

Question:

How can I mount a partition overlay over / ?

I read documentation, but I'm a bit confused as all examples seem to work with directories different from /; can I do something like:

mount /dev/mmcblk0p3 /ovr
mount -t overlay -o lowerdir=/,upperdir=/ovr,workdir=/ovr overlayfs-root /

early after boot (ideally in /etc/inittab, as I'm using Busybox init)?

1 Answer 1

1

Yes, see: https://askubuntu.com/questions/109413/how-do-i-use-overlayfs

In a nutshell, you have to mount / somewhere else, or bind mount it there, before you mount the overlayfs.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .