These steps will provide a read-only OctoPi installation while still having a read/write home directory. In other words, as long as you don't have to update system files, this installation will be fully functional.
- Install OctoPi on a 8GB (or more) SD card and boot it at least once.
- Mount it with a Linux machine (e.g. Ubuntu).
- Use
sudo gparted
and configure the remaining space as EXT4. - There are now three partitions. Mount the last two.
- Move
/home/pi
to the new and empty partition. - Edit
/etc/fstab
:- Add
ro
to the options of/dev/mmcblk0p2
- Append
/dev/mmcblk0p3 /home ext4 defaults,noatime 0 2
- Add
- Unmount the SD card and boot OctoPi.
- Temporary mount the filesystem read-write using
sudo mount -o rw,remount /
. - Replace
syslog
with an in-memory alternative:- Run
sudo apt-get install busybox-syslogd
- Run
sudo dpkg --purge rsyslog
- You can read the syslog using
logread
- Run
- Edit
/etc/default/tmpfs
:- Uncomment and change
RAMTMP
toyes
- Uncomment
TMPFS_SIZE
- Uncomment and change
- Run
sudo systemctl enable tmp.mount
. - Symlink
/etc/resolv.conf
to a read-write location, so your DNS servers get updated byresolvconf
service:- Run
sudo rm /etc/resolv.conf
- Run
sudo ln -s /var/run/resolv.conf /etc/resolv.conf
- Edit
/etc/resolvconf.conf
and changeresolv_conf
to/var/run/resolv.conf
- Run
- Edit
/etc/default/webcamd
:- Change
LOG
to/tmp/webcamd.log
- Change
- Reboot!
To mount the filesystem for read/write, simply use sudo mount -o rw,remount /
. This will be reverted on next boot.
Note that the /home/pi
folder is still read/write. If the power fails, any files (logs, plugins, timelapses) written to that partiton may be lost, but the system is still capable of booting (and recovering).
Not being too hot on Linux, could a similar approach be to move /home/pi to an external drive or share?
I have a Linux based NAS, and I like the idea of putting the various logs, time lapse and upload folders on the NAS, so the RasPi is effectively just the processor. Then while I could/would run separate RasPis for multiple printers, I would be able to access the logs and upload files on both and on my PC without ruining SD cards. (Lower writes/corruption)