Quantcast
Channel: Desert Home
Viewing all articles
Browse latest Browse all 218

Adding a USB Stick to the Raspberry Pi

$
0
0
If you beat the heck out of your SD card on a Raspberry Pi by having code that constantly updates a database, you're eventually going to start having problems with the card.  These little SD cards are tough little critters and (some of them) work really well, but they have a finite life.

I started noticing increased problems with database locks, Occasional corrupted data, the kind of thing that goes along with the SD card starting to fail.  It wasn't a really bad problem, but I don't want to have to deal with a bad problem, so I got one of these:


I picked this particular one after reading about a thousand reviews of various USB sticks and took the plunge for this particular device.  The idea is that I wanted one that wouldn't die in a couple of days, would serve other purposes if I decided to do something else on the Pi, and had enough capacity to be relevant for a long time.  16GB should last me a while on the Pi, and if it became photo storage later, it would handle a lot of them.

I let it set on the shelf for quite a while before I finally decided to use it as the main storage on my Pi.  It's Saturday, I really don't want to dig on the drainage trench I've been working on for two weeks, and the neighbors blocked my driveway with a backhoe, so it's time to do this.

When I went looking on the web for instructions to do this, there were literally thousands of them out there.  Most would work, but I don't want to do most of it on the PC and then stick the device on the Pi and hope.  I was amazed at how many Mac instructions there are; I thought Mac users were all artists that couldn't understand real computers (heh).  But I found a set of simple instructions created by pauly that fit the bill nicely <link>.

Since I'm a coward, I backed up the SD card first, then rebooted the Pi and started down the instructions.  Every single step worked exactly as pauly described, and in about an hour I rebooted using the SD card for the boot partition and the USB card for the main file system.  I didn't do anything about expanding swap space yet, nor did I mess with removing the old file system on the SD card.  Those may become useful at some point, but I don't need to mess with it now.

The Pi booted faster, but that's not very important since I don't boot it very often.  I noticed a slight decrease in load average, and time will tell if I see a decrease in the number of problems I've been having.  It's only been up for a couple of hours so I can't speak from experience yet.

I do need to look at the mount point I used for the usb stick though.  I used the default /dev/sda for it, and if I plug in another USB stick, I may have a problem with the default name.  There's the by-id device to look at and I should use it so the name is constant.  But, for now, I'll just get some experience with the setup and see if it holds together.  That's mostly why I have a backup and also kept the file system on the SD card.

This particular Pi has two XBees on it.  As I mentioned in previous posts, I had to do this because the default Digi network and Lowe's Iris devices don't play well together.  This was the third device I added to the USB buss; so I have a powered hub in place to take care of the fact that my USB buss probably uses more power than the computer that runs it.  I'm currently using one of these:
It has seven ports; I hope I don't need all of them, and came with a power supply that can handle that many devices.  I've been bitten by devices like this that just can't cut it when I plugged in a few power hungry peripherals.  It's really annoying to have to hunt down a power supply when you want to try something.  This little guy has worked well.

So, here's a possibility for you folk that are nearing the failure point of the SD card.  Most people that play with the Pi's don't run them 24x7 for months on end with a database and web server beating on things, so they'll never get to this point.

But, some of us do.

Viewing all articles
Browse latest Browse all 218

Trending Articles