Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
6
votes
1
answers
2267
views
Can I use a read-write root filesystem disk image as an OverlayFS upperdir?
Is it possible to union-mount an existing disk image containing a root filesystem to the `upperdir` of an `overlayfs` mount for read-write access? I'm trying to union-mount some old disk images to a `/tmp/` directory on an Ubuntu 16.04 machine using pre-existing scripts (originally written on Ubuntu...
Is it possible to union-mount an existing disk image containing a root filesystem to the
upperdir
of an overlayfs
mount for read-write access?
I'm trying to union-mount some old disk images to a /tmp/
directory on an Ubuntu 16.04 machine using pre-existing scripts (originally written on Ubuntu 12.04 and ported to 14.04).
The old automation scripts used overlayfs
to create and union-mount writable ext2/3
disk images on top of squashfs
images — something like this:
cd /tmp
mkdir lower upper union
losetup /dev/loop1 /tmp/image.sfs
losetup /dev/loop2 /tmp/image.ext2
mount -t squashfs -o ro /dev/loop1 /tmp/lower
mount -t ext2 -o rw /dev/loop2 /tmp/upper
mount -t overlayfs -o rw,lowerdir=/tmp/lower,upperdir=/tmp/upper overlayfs /tmp/union
They were last used on an 3.x kernel (likely pre-3.18), and that method doesn't seem to work anymore. Overlay now requires a workdir
option—e.g.:
mount -t overlay -o rw,lowerdir=/tmp/lower,upperdir=/tmp/upper,workdir=/tmp/work overlay /tmp/union
**Q:** Is it possible to tweak the automation scripts to mount and use the existing images in a writable state on a 4.x kernel? Can I avoid reformulating them to contain something like root
and work
directories? In some cases that may break their use elsewhere.
Per the documentation, the workdir
has to be an empty directory on the same filesystem as the upperdir
to allow for atomic writes. That sounds to me like it is impossible to union-mount root filesystem images as read-write. The workdir
would have to exist within the images (separate from their data directory) which isn't possible in a root filesystem image.
I've considered loading up stock Ubuntu 14.04 in a VM for a couple one-offs, but it's not a long term solution.
---
**Best Attempt So Far:**
The only solution I've come up with that avoids double-writing the same data to disk is to mount both images as lowerdir
values, with upperdir
and workdir
directories sitting on a tmpfs
mount. Then I can use rsync
to copy the changes from the tmpfs
location to the mounted ext2/3
image after the automated writes are complete and the overlay union has been unmounted—i.e.:
mount -t overlay -o rw,lowerdir=/tmp/upper:/tmp/lower,upperdir=/tmp/tmpfs/root,workdir=/tmp/tmpfs/work overlay /tmp/union
...perform automated reads/writes...
umount /tmp/union
...rsync contents from /tmp/tmpfs/root to /tmp/upper...
It's strictly limited to available RAM, though, and it's an ugly hack to add to all of the automation scripts.
codewithmichael
(456 rep)
Sep 10, 2016, 01:28 AM
• Last activity: May 17, 2025, 05:00 PM
1
votes
2
answers
4381
views
Overlay : filesystem not supported on lowerdir
I tried to mount an external storage device (a usb flash drive) with overlay (as the lowerdir the usb and as upper a temporary ramdisk) mkdir /data mkdir /data/lower mkdir /data/rw mkdir /data/root Then creating the ramdisk mount -t tmpfs none /data/rw mkdir /data/rw/upper mkdir /data/rw/work I moun...
I tried to mount an external storage device (a usb flash drive) with overlay (as the lowerdir the usb and as upper a temporary ramdisk)
mkdir /data
mkdir /data/lower
mkdir /data/rw
mkdir /data/root
Then creating the ramdisk
mount -t tmpfs none /data/rw
mkdir /data/rw/upper
mkdir /data/rw/work
I mounted the usb device
mount -t vfat /dev/sdb1 /data/lower
To finally use overlay :
mount -t overlay -o lowerdir=/data/lower,upperdir=/data/rw/upper,workdi=/data/rw/work none /data/root
Which give me the folowwing error
> wrong fs type, bad option, bad superblock on overlay,
missing codepage or helper program, or other error
> overlayfs: filesystem on '/data/lower' not supported
But according to the documentation
> The lower filesystem can be any filesystem supported by Linux and does
not need to be writable
Is there a link with automount and if so how I can fix it ?
Ben W
(113 rep)
Apr 30, 2019, 12:23 PM
• Last activity: Oct 7, 2024, 04:15 AM
0
votes
1
answers
110
views
How to instruct systemd to use a specific unionfs for /home
Context: Say I have two workplaces. Currently, I carry a laptop along, and have external HDs staying in these workplaces to hold backups. Now, I'm given the opportunity to have a desktop in both workplaces, so I'd rather carry along an external HD (USB SSD) holding my files, and use the internal HDs...
Context:
Say I have two workplaces. Currently, I carry a laptop along, and have external HDs staying in these workplaces to hold backups. Now, I'm given the opportunity to have a desktop in both workplaces, so I'd rather carry along an external HD (USB SSD) holding my files, and use the internal HDs of the desktops to hold backups.
The desktops don't have the same hardware, so I'd keep config files specific, thus not store them on the external HD. The external HD would only hold ~/Documents ~/Images etc.
The plan is to have /home mounted this way:
unionfs /HomeLocal=RW:/mnt/external_drive/HomeRoaming=RW /home
/HomeLocal will hold dotfiles and dotdirs.
How should I instruct systemd to mount /home this way before users may log in? This is Linux Mint.
L. Levrel
(1523 rep)
Jul 27, 2023, 07:18 AM
• Last activity: Jan 1, 2024, 01:28 PM
24
votes
5
answers
18788
views
Merge changes to upper filesystem to lower filesystem in Linux Overlay (OverlayFS) mount
I would like to be able to merge changes from the upper filesystem of an overlay mount to a lower filesystem. I am interested both **online** (i.e. merge *while* the overlay is mounted) and **offline** (unmount the overlay and then merge) solutions. I have found a couple of offline solutions, which...
I would like to be able to merge changes from the upper filesystem of an overlay mount to a lower filesystem.
I am interested both **online** (i.e. merge *while* the overlay is mounted) and **offline** (unmount the overlay and then merge) solutions.
I have found a couple of offline solutions, which I have added as answers.
Does anyone know of any **online** solutions? It would be good to have a "commit" type command you could run to merge down the layers while the overlay is still mounted.
Something like this has been asked in the following questions with no answer:
- Is there anyway to modify one file and sync to the lower directory in OverlayFs?
- How to modify a lower file through an OverlayFS directory?
- OverlayFS Seamlessly Edit File in Lower Directory
- OverlayFS - How to make changes to upper filesystem persistent without unmounting?
Comments in these posts suggest variously mergerfs and bcache , both of which solve specific use cases but not the generic filesytem-agnostic use case that overlays provide.
My goal is to have a safe filesystem sandbox with snapshots that can be used with any Linux application over any (where practical) underlying filesystem, allowing you to roll back changes or manually commit them when you are ready.
I have a suspicion that modern mainline Linux has all the necessary features to do this built-in, thanks to all the sandboxing/virtualization innovations of the last few years, if only I knew how to use them.
ejm
(651 rep)
Sep 23, 2017, 02:45 AM
• Last activity: Dec 3, 2023, 05:28 PM
10
votes
4
answers
9061
views
Mount /var/logs as tmpfs, with help of overlayfs to save changes sometimes
Instead of just mounting tmpfs on `/var/log` I want to use overlayfs. 1. /var/log are writable tmpfs, but containing files were there before tmpfs mount. This old files are not in memory of tmpfs but in lower layer. 2. only changes are stored in tmpfs, while old and unmodified files stored on SSD 3....
Instead of just mounting tmpfs on
/var/log
I want to use overlayfs.
1. /var/log are writable tmpfs, but containing files were there before
tmpfs mount. This old files are not in memory of tmpfs but in lower layer.
2. only changes are stored in tmpfs, while old and unmodified files
stored on SSD
3. sometimes it should be possible to write changes to SSD, for example
via cron. This should free up tmpfs memory
So, result should be: logs written to RAM, old and new boot logs accesable via same path. Changes are written sometimes to disk, by script.
Point is to speed up a little, and safe SSD from many writes.
(_I saw similar thing in puppy linux, not for logs, but for all changes to root_, but without installing it can't do the same, documentation not helps)
I will do same for browser cookies/cache based on answer. But persistent write will be done on browser close. Can't turn off browser cache, need at least small cache to have same bugs in my web development as users can have because of cache.
LeonidMew
(270 rep)
Feb 15, 2018, 10:46 AM
• Last activity: Dec 14, 2022, 06:55 PM
3
votes
1
answers
584
views
overlay-filesystem that can differentiate between metadata and file content?
AFAIK with [`aufs`](https://en.wikipedia.org/wiki/Aufs) when a file is `touch`ed (ie. only it's metadata changed, not it's contents), then the copy-on-write mechanism of the file system will copy the whole file into the r/w layer, essentially duplicating the file. Say, I only want to change the **me...
AFAIK with [
aufs
](https://en.wikipedia.org/wiki/Aufs) when a file is touch
ed (ie. only it's metadata changed, not it's contents), then the copy-on-write mechanism of the file system will copy the whole file into the r/w layer, essentially duplicating the file.
Say, I only want to change the **metadata** (modification time, permissions, owner, etc.) of a *lot* of files, is there some union-type file system (OverlayFS perhaps?) that only keeps track of the metadata changes, unless the file *content* is altered - resulting in much less duplication?
Or maybe some other trick can lead to the desired result?
Udo G
(1143 rep)
Dec 16, 2015, 04:35 PM
• Last activity: Sep 17, 2021, 01:03 PM
0
votes
0
answers
237
views
Overlayfs as a solution to copying central file systems everywhere. In what way?
I have searched the whole internet and have watched my lecture multiple times just to understand one thing: I still can't quite understand, how is overlayFS a solution to copying the central FS for each user? Is the lowerdir set to be the root directory? Or do we create an alternative rootfs and use...
I have searched the whole internet and have watched my lecture multiple times just to understand one thing: I still can't quite understand, how is overlayFS a solution to copying the central FS for each user?
Is the lowerdir set to be the root directory? Or do we create an alternative rootfs and use it everywhere as a lowerdir for each new filesystem for each user?
I apologize but there's some understanding gap. I don't understand in what way are we saving storage, and if someone could just put it in simple terms, it would be wonderful. Thank you!
Sara
(1 rep)
Jul 10, 2021, 08:59 AM
2
votes
0
answers
736
views
How to appropriately set spindown (Power Management) when using SnapRaid?
I run `openmediavault 4.1` and changed from `RAID6` to `SnapRaid` with 7 hard drives for data plus parity. I remember reading installation advice on RAID setup that said "never set spindown for HDD" while using `autoshutdown`. So I was running fine for some years having the whole system shut down af...
I run
openmediavault 4.1
and changed from RAID6
to SnapRaid
with 7 hard drives for data plus parity.
I remember reading installation advice on RAID setup that said "never set spindown for HDD" while using autoshutdown
. So I was running fine for some years having the whole system shut down after 30 minutes of beeing idle - instead of having the disks beeing spun down and leaving the rest on power consumption.
Now I changed my setup to SnapRaid
with mergerfs
and I wonder if I have to reset my spindown settings in Power Management. Access on a RAID
array spins up all of the disks at once. With SnapRaid
only the one disk with the actual data on it will be activated. So it would make sense to put all of them to spindown because most of them will not be used anyway.
I decided so put it on "minimum consumption WITH spindown" and set spindown to 10 minutes. The whole system shuts down after 60 minutes of beeing ide.
I think this is better because SnapRaid
will spin up only the one disk it needs if there is some access.
Is this a good setup?
bomben
(549 rep)
Sep 10, 2020, 07:23 AM
2
votes
0
answers
383
views
Using unionfs or similar as root file system in Linux?
After building Linux From Scratch several times I realized that package management is really a hard thing to do. After thinking for some time, I came across an idea. My idea is to install all packages into separate directories, then combine them into one file system and mount as root (required). Als...
After building Linux From Scratch several times I realized that package management is really a hard thing to do. After thinking for some time, I came across an idea. My idea is to install all packages into separate directories, then combine them into one file system and mount as root (required). Also, I want to attach and detach packages without a reboot (optional, preferred).
How can I do this from scratch (or with a package)? (No problem if I need to program (C or C++ preferred))
Akib Azmain Turja
(249 rep)
Aug 19, 2020, 05:27 PM
1
votes
0
answers
1241
views
Does remounting after changes to overlayfs underlying filesystem (UB) necessarily restore consistency?
The [overlayfs documentation](https://www.kernel.org/doc/html/latest/filesystems/overlayfs.html) states that "if the underlying filesystem is changed, the behavior of the overlay is undefined, though it will not result in a crash or deadlock." And, indeed, I've observed that when I make changes to t...
The [overlayfs documentation](https://www.kernel.org/doc/html/latest/filesystems/overlayfs.html) states that "if the underlying filesystem is changed, the behavior of the overlay is undefined, though it will not result in a crash or deadlock."
And, indeed, I've observed that when I make changes to the lowerdir in an overlay mount, strange stuff happens. However, if I remount afterwards, the problems seem to be fixed.
If I ignore the documentation's advice and modify the underlying filesystem online, will
mount -oremount merged
*necessarily* fix any issues caused by doing so?
(Yes, yes, I know the documentation says "changes to the underlying filesystems while part of a mounted overlay filesystem are **not allowed**" (emphasis mine), but I've heard [otherwise](https://unix.stackexchange.com/a/386758/173715).)
RobertR
(127 rep)
Jul 27, 2020, 12:52 AM
0
votes
0
answers
648
views
How to create a union mount (bind two or more directories to one mountpoint) on illumos / solaris?
I have been using union mounts, such as `unionfs` on FreeBSD or `mergerfs` on Linux, and now I would need to do the same on illumos (SmartOS). Reading [illumos](https://illumos.org/man/) or [SmartOS](https://smartos.org/man/) man pages is not helpful. Same with searching them [via external search en...
I have been using union mounts, such as
unionfs
on FreeBSD or mergerfs
on Linux, and now I would need to do the same on illumos (SmartOS).
Reading [illumos](https://illumos.org/man/) or [SmartOS](https://smartos.org/man/) man pages is not helpful. Same with searching them [via external search engine](https://www.google.com/search?hl=en&q=site%3Ahttps%3A%2F%2Fillumos.org%2Fman%2F) .
If possible, how can one create a union mount (bind two or more directories to one mountpoint) on illumos / solaris?
If not possible, is there anything close to same effect?
## Why
In my humble opinion, union-like filesystems are used in relatively complex scenarios. Describing some here would be out of scope for this question. I would like to know if this is possible _a-priori_ in any case, as I would not want an answer solving only a subset of all unionfs
possible use-cases.
As an example: I need to pick and choose _from the subdirectories_ of read-only zfs datasets, mounted DVD and readonly USB drives, overlaid with read-write datasets. The resulting mount point needs to be available as a cifs share. It would need to be done programmatically after boot, depending on various system factors.
For the interested, see referenced articles with some use cases. There are many such sysadmin scenarios.
---
https://whattheserver.com/what-are-unionfs-mounts-and-how-to-use-them/
https://medium.com/@knoldus/unionfs-a-file-system-of-a-container-2136cd11a779
gsl
(298 rep)
Jul 11, 2020, 01:45 PM
• Last activity: Jul 12, 2020, 02:51 PM
7
votes
3
answers
15436
views
Mount directory onto root
I have a folder containing certain files. Is there a way to mount it onto `/`, so that the contents of a given directory appear in the corresponding locations in `/`? In my case, the directories contain the files related to an application -- it does not have directories like `/dev` and `/proc`. I tr...
I have a folder containing certain files. Is there a way to mount it onto
/
, so that the contents of a given directory appear in the corresponding locations in /
?
In my case, the directories contain the files related to an application -- it does not have directories like /dev
and /proc
.
I tried creating a bind mount in the following manner:
mount --bind ~/applications/firefox /
However, this does not do anything at all. Unlike what has been speculated in the comments, it does not have any adverse effect either.
---
The motivation for this is that I have a number of custom applications that I want to install cleanly on mission-critical systems. Understandbly, I want to keep the related management to a minimum. I obtain the filesystem layout of the application install with a [unionfs-fuse + chroot method](https://unix.stackexchange.com/questions/140599/chroot-jail-that-can-access-the-filesystem) , but then I still have to deal with the problem of the applications' files mingling with those of the system. Mounting certain directories onto /
would help me to keep the filesystem clean.
While this method of installing software may seem perverted, there is a distro named "Porteus" which installs software in exactly this manner (and for the same reasons), however, they are known to use a patched kernel along with aufs. However, I cannot use a custom kernel on the systems.
user48923
May 30, 2015, 11:57 AM
• Last activity: Mar 4, 2020, 10:09 AM
17
votes
1
answers
9069
views
Union mount on Linux
A [union mount](https://en.wikipedia.org/wiki/Union_mount) presents a combined view of multiple directories (branches) in a single hierarchy. Ok, but how do I use one in practice, and which one? Many union mount technologies are available on a modern Linux system: [OverlayFS](https://en.wikipedia.or...
A [union mount](https://en.wikipedia.org/wiki/Union_mount) presents a combined view of multiple directories (branches) in a single hierarchy. Ok, but how do I use one in practice, and which one?
Many union mount technologies are available on a modern Linux system: [OverlayFS](https://en.wikipedia.org/wiki/OverlayFS) , [aufs](https://en.wikipedia.org/wiki/Union_mount) , [UnionFS](https://en.wikipedia.org/wiki/UnionFS) , various FUSE-based filesystems, …
Given a use case, how do I decide which one(s) are suitable? In particular:
* Which ones require root access on a typical system? (In other words, can an unprivileged user create a union mount?)
* Which ones can be mounted on
/
(with root access of course)?
* Which ones support writing to the underlying branches? (I.e. if /foo
and /bar
are union-mounted to /union
, can I write to /foo
and /bar
?)
* Which ones support configurable policies for writes? (E.g. can I sent newly created files to branch B even though I'm getting content from branch A when a file exists on both branches?)
* Which ones support a priority order between branches that depends on the files? (E.g. can I always get the newest file among all the branches that have it?)
Usage examples would be appreciated.
Please avoid answers that focus on a specific point. I'm looking for comprehensive answers that review the available software (something similar to https://unix.stackexchange.com/questions/198590/what-is-a-bind-mount) . Good answers will be bountied.
Gilles 'SO- stop being evil'
(862327 rep)
May 10, 2016, 11:59 PM
• Last activity: Mar 4, 2020, 10:04 AM
2
votes
2
answers
405
views
How to use loopback to access the lower files of a unionfs, in FreeBSD?
From `man mount_unionfs`: If a file exists in the upper layer then there is no way to access a file with the same name in the lower layer. If necessary, a combination of loopback and union mounts can be made which will still allow the lower files to be accessed by a different pathname. How do I do t...
From
man mount_unionfs
:
If a file exists in the upper layer then there is no way to access a file
with the same name in the lower layer. If necessary, a combination of
loopback and union mounts can be made which will still allow the lower
files to be accessed by a different pathname.
How do I do this? I can't find a reference for file system loopback other than mounting .ISO and other block images which is clearly not the right meaning, and nullfs which just mentions the term in passing (but no concrete information).
# My guess as to what's involved:
I think it might involve first mounting the "lower" layer (possibly twice, to 2 different mountpoints?), then mounting a unionfs over that mountpoint (or over one of the two mountpoints) to a second mountpoint. The idea being that the same file system is exposed unmodified through the first mountpoint and also exposed as a lower layer of a union via the second mountpoint. This is based off a hint at this web-page .
**Update, clarifying the aim in response to @arrowd:**
The man page says one can access the lower files (implied: the entire set of lower files) via loopback, and that this can makes the lower layer accessible in parallel both (A) as a lower layer of the unionfs, and (B) via a different "loopback" mount-point/pathname as a file system in its own right. I understand the concept of a loopback layer so this makes sense, and the man
page says it's doable, but I can't find the commands that will let me do it.
Being more specific, I want to overlay a file system in the usual way as a unionfs, but I also want a separate mountpoint to expose the lower layer by itself, to allow some tasks to read/write/search the entire "lower" file system *directly* as well, *without* being obscured/masked/overlaid by the union "overlay fs". So it isn't just about a single file - I need the entire "lower" layer also accessible via loopback and a separate mountpoint, not just accessible through the unionfs layer or on a file-by-file basis. It probably means I need to mount it twice in some way or another, first via loopback and then via unionfs, at the point where I initially set up/mount the unionfs layer, but I don't know how to do it.
The aim is that some cron tasks (and occasionally I as well) will need to update the files within the lower layer (without unmounting/disturbing the unionfs overlay), and **not** not just copy and update them within the "upper" layer as would happen with simple use of unionfs. So I need to have two mountpoints in use - one exposing the lower layer overlaid with a unionfs, and the other exposing the lower layer only **without** the unionfs overlay, and be able to use both in parallel in different tasks.
Also see comment I added above - I *think* it might involve mounting the lower file system twice (once directly, once as union), or mounting it once and remounting from that mountpoint a second time (as union). But I'm not sure and also unclear how safe it is.
Hopefully this is more clear as to the aim of the question.
Stilez
(1311 rep)
Mar 17, 2018, 04:02 AM
• Last activity: Jan 16, 2020, 05:29 PM
1
votes
2
answers
1501
views
How safe is it to use unionfs in FreeBSD?
From [`man mount_unionfs`][1]: BUGS: THIS FILE SYSTEM TYPE IS NOT YET FULLY SUPPORTED (READ: IT DOESN'T WORK) AND USING IT MAY, IN FACT, DESTROY DATA ON YOUR SYSTEM. USE AT YOUR OWN RISK. BEWARE OF DOG. SLIPPERY WHEN WET. BATTERIES NOT INCLUDED. This code also needs an owner in order to be less dang...
From
man mount_unionfs
:
BUGS:
THIS FILE SYSTEM TYPE IS NOT YET FULLY SUPPORTED (READ: IT DOESN'T WORK)
AND USING IT MAY, IN FACT, DESTROY DATA ON YOUR SYSTEM. USE AT YOUR OWN
RISK. BEWARE OF DOG. SLIPPERY WHEN WET. BATTERIES NOT INCLUDED.
This code also needs an owner in order to be less dangerous
Bit scarey eh? It goes on to explain some of the issues but it would need specialist knowledge of the file system handling to be sure what the extent of issues and edge cases are.
Nonetheless perhaps it is well known, or clear to someone with more knowledge:
Are the dangers well enough defined that it's only under certain uses, or certain less-likely/easily avoided edge-cases, that a serious issue might arise? Or is closer to being *"if your data matters never, ever, ever, use unionfs mount with it, even with a gun to your head"*
Stilez
(1311 rep)
Mar 17, 2018, 12:56 PM
• Last activity: Oct 19, 2018, 10:46 AM
3
votes
1
answers
5639
views
SquashFS+UnionFS as root filesystem?
What's an easy way to to use a union filesystem (read-only SquashFS + R/W overlay) as `/`? I'm thinking of using a custom boot script as the kernel `init=` argument. The script would mount the SquashFS + overlay, then `chroot` into the mounted filesystem and run the real `/sbin/init`... however I'm...
What's an easy way to to use a union filesystem (read-only SquashFS + R/W overlay) as
/
? I'm thinking of using a custom boot script as the kernel init=
argument. The script would mount the SquashFS + overlay, then chroot
into the mounted filesystem and run the real /sbin/init
... however I'm not sure how well this works with systemd
init, and I'm wondering if there isn't a simpler option.
Anul
(185 rep)
Jun 16, 2015, 04:58 AM
• Last activity: Jul 10, 2018, 11:29 AM
1
votes
1
answers
578
views
FUSE overlay mount with colon in path
Is it possible to do an overlay mount when one of the paths has a colon in it? All of the FUSE overlay mounting solutions I've looked at use a colon to separate the paths in the overlay, and I can't find a way to escape it.
Is it possible to do an overlay mount when one of the paths has a colon in it? All of the FUSE overlay mounting solutions I've looked at use a colon to separate the paths in the overlay, and I can't find a way to escape it.
AndrolGenhald
(151 rep)
Jun 29, 2018, 05:51 PM
2
votes
1
answers
1698
views
How can I create an union merging / and another directory, on / itself?
Say, we initially have `/` with the following contents: /bin/foo /usr/bin/bar /usr/lib/libfoo.so We also have another directory, say `/stuff`, with the contents: usr/lib/mystuff/mystuff.so etc/foo/qux/buzz bin/stuff Is there a way to create a union between `/` and `/stuff`, so that I get: /bin/foo /...
Say, we initially have
/
with the following contents:
/bin/foo
/usr/bin/bar
/usr/lib/libfoo.so
We also have another directory, say /stuff
, with the contents:
usr/lib/mystuff/mystuff.so
etc/foo/qux/buzz
bin/stuff
Is there a way to create a union between /
and /stuff
, so that I get:
/bin/foo
/bin/stuff
/usr/bin/bar
/usr/lib/libfoo.so
/usr/lib/mystuff/mystuff.so
/etc/foo/qux/buzz
(with all of the content from /stuff
there as well, just not shown there.)
This union should be of a **temporary nature** (just like filesystem mounts are), otherwise I could have used cp
, mv
or rsync
as well.
How should I go about doing this?
_One would expect that an answer to this would be easy to find; and indeed, there are many online resources that mention creating unions between two directories and mount them elsewhere, but none really cover this particular case of mounting a directory "over" /
._
user48923
Jul 8, 2016, 02:54 PM
• Last activity: Jun 30, 2017, 01:45 PM
1
votes
1
answers
1617
views
Why mounting overlayfs with root as lowerdir produce an empty /proc in mergedir?
Here's the test case: #!/bin/bash more="$@" saved="$EUID" if [ "$EUID" = "0" ]; then echo "don't run as root" exit fi m="/tmp/mount-point" exec sudo unshare -m /bin/bash <<UNSHARED mkdir -p "$m" mount -t tmpfs tmpfs "$m" cd "$m" mkdir top merge work mount -t overlay overlay -o lowerdir=/,upperdir=to...
Here's the test case:
#!/bin/bash
more="$@"
saved="$EUID"
if [ "$EUID" = "0" ]; then
echo "don't run as root"
exit
fi
m="/tmp/mount-point"
exec sudo unshare -m /bin/bash </proc, as you can probably guess, is mounted and not empty in the _big fs_.
rhs
(343 rep)
Feb 11, 2017, 02:04 PM
• Last activity: May 24, 2017, 02:33 PM
6
votes
1
answers
1278
views
Union mount options in Fedora
I've grown up a Debian/Ubuntu guy and I'm learning Fedora by trying to recreate the services my Ubuntu trusty box currently provides. However, I'm trying to recreate a union mount and don't see any obvious way to do it. Each user on my Ubuntu-based server has a "media" folder, with subfolders for mo...
I've grown up a Debian/Ubuntu guy and I'm learning Fedora by trying to recreate the services my Ubuntu trusty box currently provides. However, I'm trying to recreate a union mount and don't see any obvious way to do it.
Each user on my Ubuntu-based server has a "media" folder, with subfolders for movies, music, etc. Using
aufs-tools
, I create a (read-only) union mount of userA...userZ's "media" folders at /srv/media
. Then using Samba, my Plex box can access that combined media folder over the network.
It appears nothing reasonably resembling aufs-tools
is available via the standard repos (nor via rpmfusion). I've seen some mentions online of UnionFS, but I also saw something about it having fallen out of favor. I don't want to use FUSE, because this union mount is based on several users' media folders. What's the preferred solution for creating union mounts on Fedora/RHEL/CentOS servers these days?
Rob D.
(61 rep)
Feb 27, 2017, 04:33 PM
• Last activity: Feb 27, 2017, 10:18 PM
Showing page 1 of 20 total questions