I'm trying to setup an overlayfs for a chroot environment. The environment is made up from multiple read-only squashfs file systems (lower) and a single writable directory (upper).
The tricky part is that only one of the squashfs file systems has the root directory for chroot, the others do not contain the full chain of ancestors back to root. So I tried:
mount -o ro,loop base.squash /media/foo/myimage
mount -o ro,loop home.squash /media/foo/myimage/home/
mount -t overlay overlay -o lowerdir=/media/foo/myimage,upperdir=/var/lib/myimage,workdir=/var/chache/myimage /media/bar
This had the (surprising) outcome that /media/bar is comprised of only base.squash and /var/lib/myimage. home.squash is ignored leaving /media/bar/home empty.
I've looked in the documents for a way to add home.squash as an additional lower layer but that all seems to assume that all layers will contain the full chain of ancestor directories back to root /.
Without changing the contents of the squashfs images, how should I go about mounting this?