12
On each of the specific points:
Root access: If it uses FUSE, it doesn't need root, if it doesn't use FUSE, it needs root unless you do special setup with either capabilities (potentially dangerous) or namespaces.
Mounting on /: I assume you mean as the root filesystem on startup, in which case any of them that run in kernel mode should in theory work, ...
answered Aug 17 '17 at 17:39
Austin Hemmelgarn
6,81011 gold badge1212 silver badges2121 bronze badges
3
Fedora tries to not deviate very far from the "mainline" upstream kernel from kernel.org. AuFS isn't in that kernel, so it isn't in Fedora.
We do, however, have an option: OverlayFS. Upstream documentation is available on kernel.org, and here's some quick examples on Fedora.
And, as pretty much always, the Arch Linux documentation is excellent and (as ...
2
Don't try to mount over /, make yourself a "new" (fake,read-only) one:
I have done something similar. At the time I used AUFS, but this should also work with overlayfs and/or unionfs-fuse:
make a folder (e.g.) ~/apps/_App1_FakeRoot
Unionfs mount / (root) read-only under ~/apps/_App1 read-write on mountpoint ~/apps/_App1_FakeRoot.
chroot into the FakeRoot, ...
2
What you're asking to do is done at least once on just about every commonly configured Linux system out there. Most use the tool made available by busybox called switch_root:
What switch_root does is delete all the files out of rootfs (to free up the memory) and then chroot into a new filesystem and exec a new init process out of the new filesystem.
This ...
2
In an aufs union-mount, a branch and the mountpoint cannot be the same. Use this:
mount -t aufs -o dirs=/mnt/home/lucyvanpelt=rw:/home/schroeder=ro none /path/to/mountpoint
Normally if you want to merge 2 directories, you have to specify what should happen if something is written on it. As you can see, you can specify each branch with rw (readwrite) or ro (...
2
An attempt at an online solution, but its not quite there.
The setup (in e.g. /tmp directory, as root):
LOWER=$HOME
mkdir u1 w1 o1 O
mount -t overlay overlay -o lowerdir=$LOWER,upperdir=u1,workdir=w1 o1
mount --bind o1 O
Then you can work in O directory, which is an overlay over $LOWER. When you want to do the snapshot:
mkdir u2 w2 o2
mount -t overlay ...
2
Another offline solution I've come up with is using rdiffdir to create a patch with the overlay mounted, then unmount and apply it. This solution requires the intermediate step of storing the patch somewhere in the meantime (either on disk or in a ramdisk/tmpfs).
1
Directory Structure
Let's say we're trying to overlay foo:bar, and bar:baz. The mount point will be union
foo
└── a
bar
└── b
foo:bar
└── c
bar:baz
└── d
union
mergerfs
No matter what escaping you try to do, you can see from the source that it won't work. Annoyingly if you try to guess a way to escape it:
$ mergerfs 'foo\:bar':'bar\:baz' union
it won't ...
1
unionfs on FreeBSD really is that bad.
If there are files with the same name in both the lower and the upper layer, the kernel will return both, and the duplicates will have to be filtered out in userland.
Quoting from the source of opendir(3) in FreeBSD:
/*
* The strategy here is to read all the directory
* entries into a buffer, sort the buffer, and
*...
1
I can suggest anything-sync-daemon. It pretty good job.
https://wiki.archlinux.org/index.php/anything-sync-daemon
From the documentation,
anything-sync-daemon (asd) is a tiny pseudo-daemon designed to manage user specified directories referred to as sync targets from here on out, in tmpfs and to periodically sync them back to the physical disc (HDD/SSD)....
1
I have found the overlayfs-tools project which implements a useful set of tools (diff, merge and vacuum). It requires the overlay to be unmounted so is an offline-only solution.
It is a good proof-of-concept but I wouldn't rely on it in its current state as it has only a single maintainer and no activity for several years.
1
Transform the input into the required syntax and splice it into the command line with a command substitution.
dirs_with_photos="$(<~/dirs_with_photos.txt tr '\n' :)"
if [ -n "$dirs_with_photos" ]; then
unionfs-fuse "${dirs_with_photos%:}" /photos
fi
With mount_unionfs you need to issue one mount command per directory. You can use a loop around the ...
answered Sep 24 '16 at 20:41
Gilles 'SO- stop being evil'
593k143143 gold badges12161216 silver badges17301730 bronze badges
1
Look at live distributions with persistence for an example of this.
Not all union mount methods work with the root directory. Amongst those that do are unionfs, aufs and overlayfs. Overlayfs is the way to go on modern Linux systems.
In overlayfs, you get the union of the lower filesystem and the upper filesystem, with the upper filesystem taking precedence ...
answered Jul 9 '16 at 0:15
Gilles 'SO- stop being evil'
593k143143 gold badges12161216 silver badges17301730 bronze badges
1
That configuration is related to a major application category called Live Linux systems. Common implementations include Ubuntu Live CD (with casper) and its derivative, Debian Live (with live-boot). They are using layered filesystems aufs for /, namely tmpfs on squashfs.
user@debian:~$ df -h
Filesystem Size Used Avail Use% Mounted on
aufs ...
Only top voted, non community-wiki answers of a minimum length are eligible
Related Tags
union-mount × 19overlayfs × 10
mount × 6
linux × 5
aufs × 4
filesystems × 3
unionfs × 3
freebsd × 2
root-filesystem × 2
fedora × 1
boot × 1
logs × 1
live-usb × 1
init × 1
fuse × 1
tmpfs × 1
snapshot × 1
bugs × 1
bind-mount × 1
sandbox × 1