Posted January 02, 2020
Gekko_Dekko: out of curiosity - why did you use bind-mount instead of symlinks? And is it anyhow better?
Asking coz I've never encountered these before
A bind mount, like any other mount, covers an existing directory, thereby making the underlying contents invisible/inaccessible to processes accessing that information. In this case, it means I don't have to delete or rename the save directory -- I just copy it to another location and then bind mount that new location over the existing directory, creating a temporary replacement. Asking coz I've never encountered these before
When I remove the mount, if I don't want to keep the changes that have been made, there's nothing left to do -- it's already effectively reverted to its previous state. If I do want to keep them, I just rsync the changes back to their original location.
You most commonly see bind mounts and recursive bind mounts used for setting up chroot environments (/proc, /sys, and /dev).
Combining bind mounts and union filesystems (like aufs or overlayfs) allows for artificial write access to an intended read-only environment -- like a mounted squashfs image, but it can really be anything you don't want to unintentionally modify. When you throw in ramdisks you're basically giving yourself a high-speed scratch disk for test work. If you decide to keep some of the changes, you can always copy them back to the original source, or an overlaid source, at a later point.
Anyway, if you're interested in playing around with it, you can do it the traditional way (mount -o bind /src /dst -or- mount --bind /src /dst) which requires sudo/root access or you can use something like bindfs which works via FUSE in user-space.
Post edited January 02, 2020 by xixas