First of all I cannot take credit for anything posted in this article - I got the details required from here Elinux.org. Here you will find full and detailed procedures for many of today's Operating Systems. All I have done is extract the portion that applies to Ubuntu, Debian and it's many derivatives.
Warning - The use of the "dd" tool can potentially overwrite any partition of your machine or disk. If you specify the wrong device in the instructions below you could delete your primary Linux partition. Please be very careful if in doubt do not attempt to use this installation method.
dd is a very powerful command it takes in this instance it's definition is made up of three different parameters
The first parameter is bs= (Block Sector) various values can be used but the smaller the block the slower the device we suggest 4M eg "bs=4M"
The second parameter is if= (Input File) it is common to change to the directory in which your image is located eg if=name_of_imagefile.img this denotes the image file to use on the device to be programmed. It is often necessary to extract this image from a zipped file after it has been downloaded from the internet eg unzip name_of_imagefile.zip
Thirdly in this case is of= (Output File) this is the difficult bit and depends on how your computer defines the device to be programmed this you can find out with sudo fdisk -l again a very powerful program which if used properly can reveal important information about your computers hardware or / and or devices that might be attached. The Output File is usually defined thus of=/dev/sdd or of=/dev/mmcblk0 if you see either of these when you use sudo fdisk -l usually at he bottom see below it might have an appendage "p1" eg "mmcblk0p1" this refers to the partition it holds as we are not writing to the partition but the device alone we lop off the partition portion.
- Using the tools available on your command line identify the device you will want to burn your downloaded image too. First note the size of the memory card you want to use we suggest a Hi speed SD Card of 4Gb or larger, plug this into an SD card reader, Computer or Laptop with suitable port attachment. Identifying the size of the SD card will help you locate and identify one of the device parameters needed to burn your image to the SD Card.
- Download the zip file containing the image from a mirror or torrent from Raspberry downloads
- You can if you want verify your download using the hash key of the zip file and checking this is the same as shown on the downloads page (optional). Assuming that you put the zip file in your home directory (~/Downloads), in the terminal run:
#> sha1sum ~/Downloads/debian6-19-04-2012.zip
This will print out a long hex number which should match the "SHA-1" line for the SD image you have downloaded
- Extract the image, with,
#> unzip ~/Downloads/debian6-19-04-2012.zip
- You can then run df -h to see what devices are currently mounted
#> df -h (the -h means human readable)
- If you haven't already done so connect the sdcard reader with the sdcard inside it
- Again run df -h to verify the mounting of the device. The device that wasn't there last time is your SD card. The left most 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 RPi 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/mmcblk0p1 or /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/mmcblk0p1" or "/dev/sdd" in the output file of= argument with the right device name (this is very important: you will loose 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)
#> cd Downloads(path of RaspberryPI Image) #> sudo dd bs=4M if=debian6-19-04-2012.img \ of=/dev/mmcblk0
You need to change to the directory your Image is located and the run command above backslashes have been added for ease of use if the command fails delete the backslash and try again.
"dd" is not the friendliest of command applications and by that I mean it visually display's nothing to indicate a process is taking place. When we used "wget" a little earlier it was obvious when the task had finished as a progress bar was displayed which indicated it, with "dd" you get no such visual indication so once executed do not interfere but wait until the computer prompt again appears. Note that if you are not logged in as root you will need to prefix this with sudo
- 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)
sudo sync (This flushes anything that remains cached)
- Remove SD card from card reader, insert it in the Raspberry Pi, and have fun
#> sudo fdisk -l
If your SD Card is indeed 4Gb (4023 MB) in size then looking through the attached devices list will help you on how to address the device to burn an image to it, looking at the above table output "/dev/mmcblk0p1" is identified as the correct device and most importantly the correct size.
sudo umount /dev/mmcblk0