Power loss protection

I’d been running a customised version of Raspyfi up until about two weeks ago when someone looking for a means to charge their phone pulled the cable and corrupted the root partition. This was most frustrating, as not only did I have to pull a laptop out and hook that up to my dac in the mean time to play music, I also hadn’t taken a backup of my customisations (stupid me!).

Since then, I’ve been pottering with a couple different solutions to this, but haven’t come up with anything perfect, they’ve both got their own issues:

The first solution was boot from nfs - this has the benefit of the filesystem being managed by a “real” computer that’s unlikely to be unexpectedly unplugged and has a real shutdown procedure. This, however worked as well as you would expect. The OS ran fine and I’m sure this would be fine for other applications, but because of the Pi’s inherently dodgy USB bus there was noticeable distortion and the occasional pause in music. Clearly this was not the answer!

The second solution (which I’m currently testing) is a read only root partition - I’ve repartitioned my SD card with a “/var” and I added a “/home” as well (not sure if the latter is required, but I had plenty of space on the card!). I’ve mounted / and /boot as ro, /var and /home as rw and mounted /dev and /tmp as tmpfs. This gives “safe” root and /boot partitons, but still leaves /var (where mpd “lives”) open to corruption in case of a power loss (which is better than the whole root partition, as it gives an easier repair).

This option sounds much better than the boot from nfs option, but it doesn’t quite work as well: the “shutdown” command doesn’t work (although “reboot” does - I’m fairly sure I know why) and I get messages in the client telling me that mpd reported problems opening the audio device… even though music is playing! These are minor issues that I could fix with a little more pottering.

Ideally, I’d like the option of a completely read only SD card, but mpd doesn’t support external databases. I’ve considered moving /var to an nfs share, but that will probably bring the same problems as option 1.

I’m curious (no pun intended) as to what other people were doing (if anything) to work around this issue and if anything like this is planned for the official release?

Although I understand what you try to do perhaps using a powerbank would be an easier solution? see for instance raspberrypi-spy.co.uk/2013/0 … bank-test/

Also possible: use a USB memory stick to run from (less wearing and also faster). And keep a copy of your volumio-image on the SD-card as backup. The only thing you need to do is to make a regular backup via “dd”. See this link for more information: c-mobberley.com/wordpress/index. … o-usb-hdd/