Last active
November 20, 2017 15:47
-
-
Save N-Coder/d5ec5356a12d8ee7a9069188e15f75ce to your computer and use it in GitHub Desktop.
Overlay writable overlayFS on top of read-only Stud.IP FUSE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Allow root access to FUSE devices mounted with -o allow_root option | |
# see https://blog.oxplot.com/allow-root-access-fuse-mount/ | |
echo "user_allow_other" >> /etc/fuse.conf | |
cd ~user/studip | |
# Start studip-fuse in background and mount at ~user/studip/lower | |
studip-fuse --user user12 --format "{semester-lexical}/{course}/{type}/{short-path}/{name}" --mount ./lower --allowroot & | |
# Create sibling directories for overlayFS | |
mkdir upper work merged | |
# Mount overlayFS kernel driver, | |
# - using "lower" directory from studip-fuse as read-only lower layer, | |
# - writing changes to regular "upper" directory, | |
# - storing config in regular "work" directory, | |
# - and providing access to the merged directory tree (i.e. mounted) under "merged". | |
# see https://wiki.archlinux.org/index.php/Overlay_filesystem | |
mount -vt overlay overlay -o lowerdir=lower,upperdir=upper,workdir=work,redirect_dir=on merged |
To unmount:
fusermount -u lower
sudo umount merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In order to get updates from Stud.IP, restart the fuse driver and run something like the following script to find files that were overwritten in the overlayFS while also being updated online :
One could use a further script to process the output of a dry-run of the rsync, renaming the files in
upper
which would otherwise be renamed for backup inmerged
.The copy and create operations can be ignored, as the original file path now is no longer present in
upper
, and thus the updated file fromlower
'shines' through again.This approach doesn't handle overlayFS whiteouts (deletions) and renames correctly, though.