RPi SD Card Failure & Booting from USB

USBVSD

 

Card corruption isn’t anything new on the RPi, if your a Raspberry Pi owner it is a fair bet that you shall encounter it eventually.

Over the years ever since owning my first Pi, I had to deal with the occasional segmentation fault. But I’d never encounter a full blown SD card failure until the other day, when quite unexpectedly the PiDP8/i decided to have a system melt down. The first signs indicating something wasn’t quite right, was when I discovered my fail2ban jail log was corrupt, full of complete gobbledygook. After a reboot of the server, I discovered everything was back to normal or so it had seemed. The next indication problems lay ahead was when I noticed files I’d previously deleted had reappeared on the SD card. Now if there’s one thing Linux is good at letting the user do, it’s delete precious files without much chance of recovery. I once deleted an entire partition of my hard drive by mistake and yes, spent what was left of the night reinstalling Xebuntu. Linux is a powerful OS in the right hands but for the experienced it can be a steep learning curve of mistakes and mishaps.

After spending a full day working on my SD card, I discovered sure enough that the internal 8GB card had died a death. I read from the drive, but could neither format or re-partition it.

So what now? Well my next step is going to be getting my hands on a new SD Card, but I’m not so certain I feel comfortable using it as the primary storage on my PiDP8/i server. Everything I’ve read online indicates using SD cards for prolonged periods is not a great idea, mainly due to the limitations of the technology which doesn’t lend it self to constant read / writes. It’s worth remembering that ever since the first compact flash drive, memory cards were originally intended for cameras and PDA devices, neither of which really hammer the SD card unlike Linux. SD cards have a finite number of read / writes, from the time you plug it in, your memory card is degrading. On a short time project this isn’t a problem and there is evidence to suggest capacity does play a part, with larger cards such as 32, 64 and 128gb lasting longer then 8gb ones. Still if I want my server to be online 24/7, I’m better off finding a more reliable and permanent solution.

A hard drive is one I guess, but a little bit overkill for the tiny PiDP8/i. Which is why I’ve spent the past few days looking up ways to boot the Pi2 model b motherboard from a USB flash drive. Research suggests boot time will be faster and reliability significantly better then using SD. So in my next article I’m going to cover the process of setting up a RPi2 model B with the OS installed on USB pen. If your a Pi3 owner you have two choices, you can follow what I’m doing and it should work just fine. But unlike earlier models, the Pi3 can boot directly from USB by altering the OPT within firmware. Once enabled the Pi will search SD and USB until it finds a bootable partition.