Skip to content

Latest commit

 

History

History
50 lines (27 loc) · 2.14 KB

README.md

File metadata and controls

50 lines (27 loc) · 2.14 KB

ImmutableFS for Raspberry Pi


This script installs (if necessary) and then enables/disables an union filesystem based on the overlayroot OverlayFS implementation. That's a mouthful for: It makes the current root filesystem read-only and redirects all writes to the memory.

The idea is taken from raspi-config. If you have a Raspberry Pi, sudo raspi-config offers the same and more, via a GUI.


Usage:

/path/to/immutablefs.sh [ enable | disable | info]

It requires sudo (as in: sudo must be available and the user calling the script must have permissions to use sudo).


Motivation:

The motivation for this was simple: I wanted to freeze an installation, experiment on/with it, and unfreeze it. A poor man's time machine of sorts.

To do so is simple: Redirect writes to the filesystem to the machine's memory instead. Done. This basically makes the filesystem read-only. To reset the machine to the original state, just reboot, since that looses all contents of the memory.

This has turned out to be useful in different places, e.g. with my (smol) fleet of Raspberry Pi's. There I freeze machines, once they have the desired state. A poor man's immutable operating system. To update the machine, I'll unfreeze it (which requires a reboot), update it, and freeze it again (which requirest yet another reboot). Simple, really.


Implementation:

This uses the (debian) overlayroot package, which is part of the (debian) cloud-initramfs-tools that have been upstreamed to debian from the Canonical overlayroot package, part of the bigger (Canonical) cloud-initramfs-tools package.


Sources:

OverlayFS on The Linux Kernel

OverlayFS on the ArchLinux man page

OverlayFS on Wikpedia

Protecting the Root Filesystem on Ubuntu