[ Raspberry Pi ] SD Card Setup – Easy Mode

Original Post : http://elinux.org/RPi_Easy_SD_Card_Setup

Using Linux (including on a Pi!)

Using the Linux command line

Please note that the use of the “dd” tool can overwrite any partition of your machine. If you specify the wrong device in the instructions below you could delete your primary Linux partition. Please be careful.

    1. Download the zip file containing the image from a mirror or torrent
      wget -c http://downloads.raspberrypi.org/images/raspbian/2013-02-09-wheezy-raspbian/2013-02-09-wheezy-raspbian.zip
    2. Verify if the the hash key of the zip file is the same as shown on the downloads page (optional). Assuming that you put the zip file in your home directory (~/), in the terminal run:
      • sha1sum ~/2012-12-16-wheezy-raspbian.zip
      • This will print out a long hex number which should match the “SHA-1” line for the SD image you have downloaded
    3. Extract the image, with
      unzip ~/2012-12-16-wheezy-raspbian.zip
  • Run df -h to see what devices are currently mounted
  • If your computer has a slot for SD cards, insert the card. If not, insert the card into an SD card reader, then connect the reader to your computer.
  • Run df -h again. The device that wasn’t there last time is your SD card. The left column gives the device name of your SD card. It will be listed as something like “/dev/mmcblk0p1” or “/dev/sdd1”. The last part (“p1” or “1” respectively) is the partition number, but you want to write to the whole SD card, not just one partition, so you need to remove that part from the name (getting for example “/dev/mmcblk0” or “/dev/sdd”) as the device for the whole SD card. Note that the SD card can show up more than once in the output of df: in fact it will if you have previously written a Raspberry Pi image to this SD card, because the Raspberry Pi SD images have more than one partition.
  • Now that you’ve noted what the device name is, you need to unmount it so that files can’t be read or written to the SD card while you are copying over the SD image. So run the command below, replacing “/dev/sdd1” with whatever your SD card’s device name is (including the partition number)
    umount /dev/sdd1
    • If your SD card shows up more than once in the output of df due to having multiple partitions on the SD card, you should unmount all of these partitions.
  • In the terminal write the image to the card with this command, making sure you replace the input file if= argument with the path to your .img file, and the “/dev/sdd” in the output file of= argument with the right device name (this is very important: you will lose all data on the hard drive on your computer if you get the wrong device name). Make sure the device name is the name of the whole SD card as described above, not just a partition of it (for example, sdd, not sdds1 or sddp1, or mmcblk0 not mmcblk0p1)
    dd bs=4M if=~/2012-12-16-wheezy-raspbian.img of=/dev/sdd
      • Please note that block size set to 4M will work most of the time, if not, please try 1M, although 1M will take considerably longer.
  • Note that if you are not logged in as root you will need to prefix this with sudo
  • The dd command does not give any information of its progress and so may appear to have frozen. It could take more than five minutes to finish writing to the card. If your card reader has an LED it may blink during the write process. To forcibly stop the copy operation you can run pkill -USR1 -n -x dd in another terminal (prefixed with sudo if you are not logged in as root).
  • Instead of dd you can use dcfldd; it will give a progress report about how much has been written.
  • You can check what’s written to the SD card by dd-ing from the card back to your harddisk to another image, and then running diff (or md5sum) on those two images. There should be no difference.
  • As root run the command sync or if a normal user run sudo sync (this will ensure the write cache is flushed and that it is safe to unmount your SD card)
  • Remove SD card from card reader, insert it in the Raspberry Pi, and have fun

Using ImageWriter (graphical interface)

If you are using Ubuntu and hesitate to use the terminal, you can use the ImageWriter tool (nice graphical user interface) to write the .img file to the SD card.

  1. Download the zip file containing the image from a mirror or torrent
  2. Right click the zip file and select “Extract here”
    • ATTENTION: As of this writing (15 June 2012), there is a bug in the ImageWriter program that causes it to fail if the filename of the image file or its path (i.e. all the names of any parent folders that you extract the image file into) contain any space characters. Before going any further, ensure that neither the file name of the image you’re using or the path contain any spaces (or other odd characters, for that matter). A bug has been opened for this issue: https://bugs.launchpad.net/usb-imagewriter/+bug/1013834 Once the issue is fixed, edit this page to advise people to use an updated/patched version of ImageWriter.
  3. Insert the SD card into your computer or connect the SD card reader with the SD card inside
  4. Install the ImageWriter tool from the Ubuntu Software Center
  5. Launch the ImageWriter tool (it needs your administrative password)
  6. Select the image file (example 2012-10-28-wheezy-raspbian.img) to be written to the SD card (note: because you started ImageWriter as administrator the starting point when selecting the image file is the administrator’s home folder so you need to change to your own home folder to select the image file)
  7. Select the target device to write the image to (your device will be something like “/dev/mmcblk0” or “/dev/sdc”)
  8. Click the “Write to device” button
  9. Wait for the process to finish and then insert the SD card in the Raspberry Pi

Author: Shingu

Search in pursuit. Help me if you can.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s