Saturday, December 28, 2013

Raspberry Pi File System Corruption Issues - Upgrade to an External USB hardrive

I hit the first hardware road block of using such a cheap computer like the Pi. Its SD card is great for some things and a very cheap source of memory, however it doesn't do so well if you are constantly writing it, like I was every hour with the MySQL database.

The problem was I would come in to check on the Pi, because I noticed it had stopped tweeting, and the Pi had crashed. When I tried to reboot it I ran into tons of file system corruption things when the Pi was trying to boot back up. I went through all the system checks and even tried wiping the SD card clean a few times and reinstalling everything, AND tried using a new SD card. After a week or two, every time, the Pi would crash. My problem was probably exacerbated by the poor wiring in my apartment and big users of power such as my dishwasher, combined with the AC or microwave can cause the lights to dim. These power fluctuations could have also contributed to the crashing and improper shutdown linux. 

A quick search on the google showed that the file system corruption I was experiencing is a not so rare problem people have with using a MySQL database on the SD card of the Pi. The solution is to move the whole file system over to an external USB drive. The Pi need to keep the booting program on the SD card but everything else can be moved to the USB drive and you can rewrite the boot program to tell it to boot form the USB drive and not the SD card. I also used this as an opportunity to get a lot more space and bought a 160gb USB drive. 

Since I installed this, the Pi has run uninterrupted for almost 60 days and counting. I unfortunately have lost the exact recipe I followed to transfer the file system from the SD card to the USB drive but a quick google search will give you plenty of options. I used a few different pieces from several websites. There is lots of information out there about this issue and how to utilize an external USB drive. 

Here is the Pi sitting on my table connected to the USB drive and its breadboard with all the current sensors. The drive and the Pi are powered from a powered USB hub. 


No comments:

Post a Comment