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.
1 Answer
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 throw an error, but will silently ignore directories that don't exist:
$ ls union
b
unionfs-fuse
Same problem as mergerfs
, no way to escape a colon. At least it'll fail with an error though if a directory doesn't exist:
$ unionfs-fuse 'foo\:bar':'bar\:baz' union
Failed to open /foo\/: No such file or directory. Aborting!
overlayfs
overlayfs
does allow escaping colons in paths, but it's not a FUSE filesystem.
$ mount -t overlay overlay -o lowerdir='foo\:bar':'bar\:baz' union
$ ls union
c d
Workaround
A simple workaround that works with both mergerfs
and unionfs-fuse
is to use a symlink:
$ ln -s foo:bar foo_bar
$ ln -s bar:baz bar_baz
$ unionfs-fuse foo_bar:bar_baz union
$ ls union
c d