Stretch Read Only

From Technologic Systems Manuals
Revision as of 16:03, 13 April 2018 by Mark (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Debian supports running as a read only filesystem. This is useful for systems that may lose power and shut down at any time. This is the simplest way to prevent filesystem corruption.

An example /etc/fstab would include:

/dev/root            /                    auto       defaults              1  1
proc                 /proc                proc       defaults              0  0
devpts               /dev/pts             devpts     mode=0620,gid=5       0  0
usbdevfs             /proc/bus/usb        usbdevfs   noauto                0  0
tmpfs                /run                 tmpfs      mode=0755,nodev,nosuid,strictatime 0  0
tmpfs                /var/run                 tmpfs      mode=0755,nodev,nosuid,strictatime 0  0
tmpfs                /var/volatile        tmpfs      defaults              0  0
tmpfs                /tmp                 tmpfs      defaults              0  0
tmpfs                /var/tmp             tmpfs      defaults              0  0

/dev/root is an abstraction to the real root filesystem device. This actually refers to the device u-boot specifes in the kernel cmdline as 'root='. Check "cat /proc/cmdline" to see what device this is on your system, but /dev/root can be left for these purposes.

To make Linux mount this as read only, change the mount options on /dev/root/ from "defaults" to "ro".

/dev/root            /                    auto       ro              1  1

After this, reboot. Some applications may fail to start because they are failing to write.