User Tools

Site Tools



Read-only File System with Overlay

Update October 2019

The Raspberry Pi Foundation has recently added this feature to the base Raspian OS image.

First, upgrade your packages:

sudo apt update
sudo apt full-upgrade
sudo reboot

You can then configure a read-only file system by going to Preferences–>Raspberry Pi Configuration–>Performance–>Overlay File SystemConfigure…


Old Procedure

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
    sudo apt-get purge dphys-swapfile
    sudo apt-get autoremove
  2. Download the boot script
  3. Install the script
    sudo cp /sbin/
    sudo chmod +x /sbin/
  4. Enable the script by appending init=/sbin/ 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/ 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.


comfilepi/read-only_file_system_with_overlay.txt · Last modified: 2019/10/30 10:21 by COMFILE Technology