How To Create Raspberry Pi SD card via Linux Command Line

This tutorial will walk you through how to create Raspberry Pi SD card via Linux command line (Ubuntu 12.04 LTS)

Instructions for creating the SD card on Windows or Mac are found here

Download desired image via torrent or direct download and place in your Downloads directory:

Check the hash:

sha1sum ~/Downloads/ | grep 63d16fd28369b6e05bf97f2d1758d56df6ed0ba9

If the hash checks out, unzip:

unzip ~/Downloads/

Insert your SD into your card reader and run:
(if unsure of your computer’s naming convention, run prior to inserting SD then again after to identify mounted card)

df -h

Unmount your card: (sdb1 was mine, yours may be named differently. If your card shows up more than once – ie. multiple partitions – be sure to unmount all of them!)

umount /dev/sdb1

Write the image to the card. Note that I have left off the trailing 1 (/dev/sda) as I want to write to the entire card:

dd bs=1M if=~/Downloads/2012-08-16-wheezy-raspbian.img of=/dev/sdb

To ensure write cache is empty and it is safe to unmount run:

sudo sync


Stay tuned for a follow up video outlining what to do now that you have your SD ready to go!



16 thoughts on “How To Create Raspberry Pi SD card via Linux Command Line”

  1. Hello,

    Unfortunately that’s not enough 🙁
    I’ve purchased a raspberry pi and intended to access it via my router. But now I’ve found out that on the initial boot, you have to go through the raspi-config menus. This is bad for me as I have no screen at all – I thought I’d do it all through the router connection! Is there any way I can make the OS on my SD card configured? I’ve found no downloadable preconfigured raspbian images… Any ideas?

      1. Thanks admin!
        I ended up connecting the pi to a monitor. I passed the config screen, disconnected it from the monitor, and never had to use a monitor again 🙂 The next time I connected it to the router it worked like a charm.
        It’s just that most guides ignore that step – that upon the first boot you must compelte the raspi-config process. Otherwise it won’t start the networking services, including getting an IP from the router.

  2. Hey guyrap,

    The first few times i went through the set up I did the same thing…just lugged it to a monitor and completed the rasp-config setup, however it is completely possible to set it up blind as ssh is pre-configed on the Pi and the set up steps can be done via ssh from another computer, which I assume is what you were trying in the first place.

    glad your up and running tho!

  3. There’s no need to store the unzipped drive image file on your Ubuntu hard drive. Change to directories to whereever you saved the zipfile. Then unzip the image into standard output and redirect it to the device. On Ubuntu,
    cd ~/Downloads # or where ever
    unzip -p \
    2013-05-25-wheezy-raspbian.img > /dev/sdd

    Be double sure /dev/sdd is where the SD card you want to burn is.
    fdisk -l /dev/sdd
    A new SD card will have one partition with a Vfat file system.
    You’ll get faster writing if you chunk the writes together with the dd command.
    unzip -p \
    2013-05-25-wheezy-raspbian.img | dd of=/dev/sdd bs=1M

  4. “Write the image to the card. Note that I have left off the trailing 1 (/dev/sda) as I want to write to the entire card….”

    And your hard drive… don’t do /dev/sda – do /dev/sdb

    1. Not sure what you mean…

      The command is correct for my particular machine exactly how i wrote it…

  5. If you are impatient like me, and using a cheap and slow SD Card like me. The DD imaging can take forever. If you want to see the progress of the write and you happen to be a mac user like I am.

    open the activity monitor utility, switch to disk and look at the write progress of the DD process, at least then you’ll know it’s writing and how long it is likely to take.

  6. @n00badmin

    My main drive for my linux box is always /dev/sda
    I’ve never seen it any other way (I’ve installed linux on a lot of machines)
    Every other drive is alphabetized based on whichever drive is plugged in.

    1. /dev/sdb is the memory card in the video and in the instructions because we are using a raspberry pi, remember rpi has no built in disk..the disk is a SD card mounted to the device, thus the sdb…results may vary but the idea is the same on various machines…

Leave a Reply

Your email address will not be published. Required fields are marked *