I had a similar use. I'm using the Pi for narrowcasting web-pages in a building entrance. Powering the Pi via the USB-port on the TV.
Mount / read-only.
To make it powerloss proof I mounted / read-only by changing a line in
/dev/mmcblk0p2 / ext4 defaults,noatime,ro 0 1
Pretty simple. But some processes on a functional machine need to write.
Mount /tmp in memory.
Many things write to
/tmp so I mounted that in memory by adding a line to
tmpfs /tmp tmpfs defaults,size=30M 0 0
I had a 512MB Pi available so I made /tmp 30M big.
Disable services I don't need that write.
rsyslog to stop it from logging and
dphys-swapfile as it has no real place to write. Running without swap will give problems if you do heavy lifting that is memory intensive. In my case running a single midori process for a day, isn't.
cat /etc/rc2.d/README on your Pi on how to do that. (raspbian starts in runlevel 2 by default, raspbmc may differ)
Let services I do need faux-write.
You can provide write access to a filesystem in memory the way a live-cd does it; with a union mount. But I didn't like the prospect of cross-compiling my own kernel for unionfs or the later aufs. Luckily
unionfs-fuse is prebuilt available. It can't union mount
/, but do I really need that?
Running midori I need X to work. X wants to write in
/home/pi as I autologin as pi and to a couple of places in
/var I decided to mount those to places using unionfs.
# move original /var and /home aside
mv /var /ro
mv /home /ro
# create mount points
mkdir /var /home
and appended 2 lines to
unionfs-fuse#/tmp=rw:/ro/var=ro /var fuse cow,allow_other,nonempty
unionfs-fuse#/tmp=rw:/ro/home=ro /home fuse cow,allow_other
This is pretty nasty, as writes to /var, /home and /tmp all endup in /tmp. But I only need my machine to run for 8 to 10 hours, and then the power gets cutoff. So this will do.
Remounting read-write when tweaking stuff
When I changed networks, the
/etc/resolv.conf that dhclient wrote didn't work anymore.
$ sudo mount / -o remount,rw
$ ifdown eth0; ifup eth0
$ sudo reboot
Don't forget to shutdown cleanly, or remounting ro after remounting rw.
If you can read German, there is a cleaner way (from archive.org). Deutsche Gründlichkeit...