Corrupt SD cards

Those of you with Raspberry Pi systems or similar (other small sized computers are available!) will feel my pain…

A few days ago my little web and all-sort-of-other-stuff server fell over. I had no idea why but it seemed to reboot ok. I suspected we’d had a very short power outage but checking the other Pi systems (there are 4 here) all had long uptimes. Anyway, it all came back ok, or so it seemed.

It runs a process every minute to grab data off the weather station and displays this on my private website, which it also serves. The website simply tails a log file and was now showing a Linux error message which looked ominous. Checking the Pi it has gained a nice little file system error and the temp file the weather station grabber creates was corrupt. Rebooting cured this (it runs fsck on boot). That cured the weather station data but the problem persists.

So far there are no other obvious issues except it writes ext4-fs warnings to syslog every time something does anything. No biggie, these are only log files.

So, thought I, I’ll fsck the SD card. Ok, can’t do that running so it needs to be mounted on another system. Where do I have an SD reader? My little Samsung Netbook has a version of Ubuntu on it so I can use that.

This is where things went south. The Netbook takes a while to boot but takes an age for the GUI to settle. And I mean 30+ minutes and still it sits there! Come on, I can do a Windows update faster… Ah, found a USB SD card reader, I can use my desktop instead (the Netbook is destined for eBay I suspect). So, let’s plan this logically. I shut the Pi down (a caveat here is it’s also the NFS server and serves a disk to another Pi that does all the CCTV recording… probably better that one had its own disk!!), pull the SD card, stuff it on the desktop Linux box and fsck the filesystem. There’s a danger it will fsck to death and become useless but everything is backed up or can be reinstalled, all I need is a clean SD card. Um…

Ok… scratch that and order some SD cards first! Ugh.