Q: What is the best way to manage read-only root filesystems on embedded Linux?
Answer
Read-only rootfs is essential for embedded systems reliability and security. Implement overlayfs on top of a read-only squashfs root: mount overlayfs with upperdir on tmpfs/ramfs lowerdir as squashfs. All writes go to tmpfs (RAM) and are lost on reboot – use UBIFS on NAND or ext4 on eMMC for persistent data in /var or /data. Move /etc /home /var to a separate writable partition. Use systemd OverlayRoot= or create it manually in fstab. Another option: use Device-Mapper snapshots (dm-snapshot) with a copy-on-write mechanism. Always mount /tmp as tmpfs to avoid writes to flash. Test extensively – many applications assume writable /etc and will fail silently.
Filed under: FAQ
