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
apt-get purge dphys-swapfile apt-get autoremove
sudo cp overlayRoot.sh /sbin/ sudo chmod +x /sbin/overlayRoot.sh
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
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.