This is an old revision of the document!


OverlayFS Home

I've configured some single use systems (raspberry pis, but also a couple intel boxes) that do one thing and one thing only. I have them set up headless, but sometimes the app they need to run requires X, which doesn't care for read only directories. I've tried setting up the whole system to run with OverlayFS1) but mkinitcpio is less than trivial, and frankly, systemd will do it for my anyway.

Like so:

/etc/systemd/system/overlay.service:

[Unit]
DefaultDependencies=false

[Install]
WantedBy=local-fs-pre.target

[Service]
Type=oneshot
RemainAfterExit=true

# Remount /home and /var as aufs
ExecStart=/bin/mount -t tmpfs tmpfs /var/overlay
ExecStart=/bin/mkdir -p -m0755 /var/overlay/upper /var/overlay/work
ExecStart=/bin/mount -t overlay -o rw,upperdir=/var/overlay/upper,workdir=/var/overlay/work,lowerdir=/home overlay /home

~~LINKBACK~~

1)
replacement for UnionFS and AUFS as of 3.18