User Tools

Site Tools

한국어

comfilepi:read-only_file_system_with_overlay

Read-only File System with Overlay

The following procedure can be used to boot with a read-only file system. All modifications to the file system are done in RAM, and therefore, discarded between boots.

This can be useful to reduce wear on the SD card and also ensure a more reliable system, as file system corruption is less likely when it is read-only

  1. Disable the swap file
    apt-get purge dphys-swapfile
    apt-get autoremove
  2. Download the overlayRoot.sh boot script
    wget ftp://110.10.189.172/ComfilePi/Scripts/overlayRoot.sh
  3. Install the script
    sudo cp overlayRoot.sh /sbin/
    sudo chmod +x /sbin/overlayRoot.sh
  4. Enable the script by appending init=/sbin/overlayRoot.sh to /boot/cmdline.txt
  5. Reboot

When the system reboots the filesystem will be read-only. To revert to a read-write file system, simply insert the SD card in a PC and remove init=/sbin/overlayRoot.sh from /boot/cmdline.txt.

Note that since file system changes are stored in RAM, one must avoid running programs that will write excessively to the file system, as, over time, it will exhaust all available RAM.

Reference: https://www.raspberrypi.org/forums/viewtopic.php?t=173063

comfilepi/read-only_file_system_with_overlay.txt · Last modified: 2018/03/15 08:58 by COMFILE Technology