With overlayroot you can overlay your root filesystem with a temporary tmpfs filesystem to mount it read-only afterwards. Any changes are written to the tmpfs filesystem (which resides in memory), so that these changes are discarded on reboot or a loss of power does not threaten the integrity of the system's root filesystem. Additionally you can configure further filesystems that you want either overlayed by a tmpfs filesystem, too or mounted read-only because write access is not needed and you want to protect it against changes.
- change your current working directory to the directory containing the files of the repository
- run
makepkg
- build or download package
- run
pacman -U /<path>/<to>/overlayroot-<version>-any.pkg.tar.zst
- add
overlay
to MODULES array in mkinitcpio.conf (in case support for OverlayFS is not statically compiled into your kernel) - add
overlayroot
to the end of HOOKS array in mkinitcpio.conf - update initramfs with
mkinitcpio -P
- add
overlayroot
to your kernel command line - optional:
- add
opts=<option>,...
tooverlayroot=...
- available options:
noswap
: deactivate swap space
- available options:
- add
tmpfs=/<path>/<to>/<mountpoint>,...
tooverlayroot=...
to overlay filesystems with a tmpfs filesystem - add
ro=/<path>/<to>/<mountpoint>,...
tooverlayroot=...
to mount filesystems read-only - specify
all
instead of dedicated mountpoints fortmpfs
orro
- separate options with a
:
- examples: overlayroot=tmpfs=/usr:ro=/boot,/boot/efi overlayroot=tmpfs=all:opts=noswap overlayroot=ro=all
- add
- path
/etc/overlayroot.conf
OVLROOT_FS_ROONLY=<fs>,...
filesystems that can't be used as lower layer- examples:
msdos, (v)fat, ntfs-3g
- examples:
OVLROOT_FS_RAMONLY=<fs>,...
filesystems that are always ignored by overlayroot- examples:
tmpfs, proc, sysfs
- examples:
OVLROOT_FSTAB=/<path>/<to>/<fstab>
modified fstab created by overlayroot during initramfs phase to replace system-wide fstab- default:
/tmp/overlayroot.fstab
- default:
OVLROOT_MAINDIR=/<path>/<to>/<mountpoint>
mountpoint for tmpfs filesystem- default:
/.overlay
- default:
OVLROOT_LOWDERDIR_NAME=<dirname>
subdirectory of all lower filesystem mounts- default:
ro
- default:
OVLROOT_UPPERDIR_NAME=<dirname>
subdirectory for all changes made to the filesystems- default:
rw
- default:
OVLROOT_WORKDIR_NAME=<dirname>
subdirectory needed by OverlayFS- default:
work
- default:
FSTAB_SYSTEM=/<path>/<to>/<fstab>
system-wide fstab- default:
/etc/fstab
- default:
ROOTMNT=/<path>/<to>/<mountpoint>
mountpoint of root filesystem in initramfs phase- default:
/new_root
- default: