the itjerk

my adventures with technology

Tag Archives: raspberry

raspberry pi and sd cards

As much as I'm enjoying my Raspberry Pi, I've come across one big issue: the SD card has failed twice now. Even though I'm using a "verified" card from this list, it keeps getting corrupt to the point where my RPi won't boot. Why is this? Just a bad card? Voltage on the board checks out okay, I use "sudo halt" to shut down cleanly, I don't manhandle the cards… so maybe it's from overclocking? Fortunately cards are cheap, and I'm not adding a whole lot to the standard Wheezy distro.

Here's how to backup and clone a SD card with Ubuntu. First, mount the SD card, then find out its device name in /dev/ by using ls. (You can also use "sudo fdisk -l").

ls -al /dev/sd*
... 
brw-rw---- 1 root disk 8, 32 Jan 15 18:50 /dev/sdc
brw-rw---- 1 root disk 8, 33 Jan 15 18:50 /dev/sdc1
brw-rw---- 1 root disk 8, 34 Jan 15 18:50 /dev/sdc2

That known (and correct), unmount the disk and use the dd "convert and copy" command to clone an image of the card to a bin file. NB: This isn't the fastest operation (we're talking SD cards) and dd doesn't display a progress bar. It will however give you a summary of the transfer when completed.

sudo umount /dev/sdc*
sudo dd if=/dev/sdc of=~/sd-card.bin bs=1M

Finally, put in a new SD card, verify the device name (again), then issue the same dd command, but in reverse. Note your SD cards must be the or larger than your image. Be patient!

sudo dd if=~/sd-card.bin of=/dev/sdc

Another hint I found is to go into /etc/fstab and add "sync" to allow immediate writes.

/dev/mmcblk0p2  /               ext4    defaults,[B]sync[/B],noatime  0       1

Finally, I picked up a "class 10" SDHC card to give a try (much faster writes).

On the web:
Copying an image to the SD card in Linux (command line)

Other option:
dcfldd
dd if=/dev/sdx | gzip > /path/to/image.gz
gzip -dc /path/to/image.gz | dd of=/dev/sdx

raspberry pi

Cheap computing's had a lot of promises for machines under $100. The Raspberry Pi, designed by the British not-for-profit foundation of the same name, is a "single computer on a board" that features an ARM processor and high-quality graphics, all for USD$35.00. It's designed to interest kids in computer programming, science, etc. Engadget has a rather tepid review here.

The unit is the size of a credit card, and has connections for USB, Ethernet, SD card (required for booting), HDMI (audio and video), RCA video and a 3.5mm audio jack. It's ARM, so software needs to be compiled for that processor; both Debian and Fedora have been ported, so yes, it's ostensibly a Linux box. It also has a GPIO connector, which means it can also be programmed to do about anything (robotics, interfacing, etc). The unit is powered by 5v, and most any micro-usb charger will do.

To get the Pi running, you'll need a pre-loaded OS on an SD card, connect (wired or wireless) keyboard and mouse, hook up to video via HDMI or composite, and power it with 5v via micro-usb.

I got into the queue with RS Online (one of two exclusive distributors) to order one on March 1st, and actually placed my order on May 24th. Next update when it's in my hands!

On the web:
Raspberry Pi Official Site
The MagPi Magazine
Wikipedia – Raspberry Pi