Say I have an arbitrary number of directories, labeled by numbers.

I also have the directory merge.

I can do

mount -t overlay -olowerdir=1:2:50 overlay merge

to get the contents of 1, 2, and 50 in merge.

What is the best way to 'add' more directories to the overlay, say, 23, 81, and 457 as if I had done the command

mount -t overlay -olowerdir=1:2:50:23:81:457 overlay merge

in the first place?

If I want to "unoverlay" a certain directory, say 23, can I do it without unmounting the entire thing?

Conceptually, I guess you could say I want an arbitrary number of directories on the same "level" of overlay.

  • You can mount it again on merge removing 23 from the list, with the earlier mount still present but inaccessible. – muru Jun 22 '15 at 2:43
  • Try the mount -o remount,overlaydir=foo:bar:blah stuff. – Mingye Wang Jun 22 '15 at 3:45

(I have exactly the same problem.) The only info I could find about it, is this:

From https://lkml.org/lkml/2014/11/10/129 :

Maybe it wasn't clear, but the number of lower layers isn't limited by
FILESYSTEM_MAX_STACK_DEPTH, only by the max size of the mount option buffer in
the kernel (1 page, usually 4096bytes).  So you could have a hundred read-only
layers stacked in a single overlayfs mount.

As for changing the stacking while the overlayfs is mounted: currently this is
not supported, the layers specified at the mount time remain there until the
overlay is unmounted.  Currently there's no possibility to add or remove layers
in a dynamic way, and it is definitely more tricky to implement than the static 

-- Miklos Szeredi Mon, 10 Nov 2014

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.