How to mount overlay fs over root (/) with my own set of utilities?
by amenar from LinuxQuestions.org on (#6MNVD)
Hi,
I am testing my own utilities with different configurations and I need to place specific file into different directories. I came up with overlay filesystem idea and now I want to mount overlay over root fs of an active server (Debian 12, if it matters). The problem is that I can't find a way to make a correct mount.
My set of utilities come in tar.gz format that mimics the rootfs, so it has /bin, /etc and other directories with required files in them. What I need is just to unpack them into upper (say, /tmp/upper) directory and overlay it over root (/), so what I did is the following:
Code:mount -t overlay overlay -o lowerdir=/,upperdir=/tmp/upper,workdir=/tmp/wrkdir /And it gives no error but still it does not work - I can't see my files from /tmp/upper in / (root).
I tried traversal of /tmp/upper with find utility and mount overlay for each directory, but then I got an error: the filesystem is busy. Needless to say that I can't always reboot server when I am done with tests - I need a clean unmount process with no traces left in the system.
What is the most correct approach of mounting side tree over root (/) with overlay? Where am I wrong?
I am testing my own utilities with different configurations and I need to place specific file into different directories. I came up with overlay filesystem idea and now I want to mount overlay over root fs of an active server (Debian 12, if it matters). The problem is that I can't find a way to make a correct mount.
My set of utilities come in tar.gz format that mimics the rootfs, so it has /bin, /etc and other directories with required files in them. What I need is just to unpack them into upper (say, /tmp/upper) directory and overlay it over root (/), so what I did is the following:
Code:mount -t overlay overlay -o lowerdir=/,upperdir=/tmp/upper,workdir=/tmp/wrkdir /And it gives no error but still it does not work - I can't see my files from /tmp/upper in / (root).
I tried traversal of /tmp/upper with find utility and mount overlay for each directory, but then I got an error: the filesystem is busy. Needless to say that I can't always reboot server when I am done with tests - I need a clean unmount process with no traces left in the system.
What is the most correct approach of mounting side tree over root (/) with overlay? Where am I wrong?