How to use Overlayfs in Linux 3.19 to mount multiple lowerdir
The syntax for specifying multiple lower directories is correct and works, as described in https://www.kernel.org/doc/Documentation/filesystems/overlayfs.txt. But apparently the commit that supports this feature went in only for 4.0 and not 3.19.
ravi@tuxpad linux$ git describe --contains a78d9f0d5d5ca9054703376c7c23c901807ddd87
v4.0-rc1~2^2~17^2~8
How to use Overlayfs in Linux 3.19 to mount multiple lowerdir
The syntax for specifying multiple lower directories is correct and works, as described in https://www.kernel.org/doc/Documentation/filesystems/overlayfs.txt. But apparently the commit that supports this feature went in only for 4.0 and not 3.19.
ravi@tuxpad linux$ git describe --contains a78d9f0d5d5ca9054703376c7c23c901807ddd87
v4.0-rc1~2^2~17^2~8
How provide nested mount of overlayfs
If you check dmesg output, you will see the kernel stating an attempt to exceed the max stacking depth:
overlayfs: maximum fs stacking depth exceeded
Indeed, the stacking depth is limited to 2, see the overlayfs dev branch:
- #define FILESYSTEM_MAX_STACK_DEPTH
- stacking depth check
If you want to go beyond this depth, you could try changing the constant and building your own kernel. However, bear in mind the risk of overflowing the stack (per the comments).
Overlayfs: restore removed or changed file from lower
Remove file from /overlay/upper
, and then remount rootfs.
rm /overlay/upper/my/file
mount -o remount /
overlayfs inside docker container
Found something that worked! Mounting the workdir and upperdir as tmpfs does the trick for me.
Like so:
> mkdir /tmp/overlay
> mkdir /tmp/{low,merged}
> mount -t tmpfs tmpfs /tmp/overlay
> mkdir /tmp/overlay/{up,work}
> mount -t overlay overlay -o lowerdir=/tmp/low/,upperdir=/tmp/overlay/up/,workdir=/tmp/overlay/work/ /tmp/merged/
I'd still be interested in an explanation why creating an overlay w/o tmpfs fails within a docker container?
How can I overlayfs the root filesystem on linux?
According to what I've read I don't think it's possible to programmatically do this once the system is started.
Related Topics
How to Get "Instant" Output of "Tail -F" as Input
Monitoring (Sniffing) /Dev/Ttyusb0 Created by Ftdi Usb Serial Converter
Ssh-Add from Bash Script and Automate Passphrase Entry
Bash Script - Auto Fill Answer
Which Is Faster of Two Case or If
Running Shell Script After Boot on Raspberry Pi
Npm Install -G Grunt-Cli Failed in Linux
Getting Root Privileges in Ansible
Using Find But Only in Subdirectories Matching Certain Pattern
Version Control for My Web Server
Time Taken by 'Less' Command to Show Output
Embedded Linux Poll() Returns Constantly
How to Automatically Start an Application That Needs X in Linux