RPi Easy SD Card Setup

=SD Card setup= To boot the Raspberry Pi, you need an SD card installed with a bootloader and a suitable Operating System. Some Raspberry Pi kits will come with a ready-to-go card, but if you didn't receive one you will need to prepare your own:

Official images are available from http://www.raspberrypi.org/downloads and there is an overview of available distributions here.

Warning! When you write the Raspberry Pi image to your SD card you will lose all data that was on the card.

=Safest/Laziest way= Buy a preloaded card from RS Components or element14.

=Easiest way=


 * Download and run the PiCard tool. It will guide you through the progress. See the google code repo and the forum discussion.The PiCard project has now been disbanded


 * Use an installer program. The Fedora ARM Installer will download and install Raspberry Pi Fedora Remix images, but it will also install other images if they are already downloaded and in uncompressed or .gz format.


 * (Mac) The RasPiWrite utility is a python script which will walk you through the process of installing to SD card, it is works with any Raspberry Pi compatible disk image, and can download one of the currently available distros if you don't have one.

=Easy way=

To write your SD card you start by downloading the SD image (the data you will write to the card). The best way to do this is using BitTorrent. This generally results in a faster download as it is a highly distributed system (you will be downloading the data from users who have previously downloaded it).

This guide assumes you have downloaded the Debian "squeeze" image, with name debian6-13-04-2012. Obviously, if you are downloading a different or newer version, use the name of the version you have downloaded.

Copying the image to an SD Card on Windows
''In Windows the SD card will appear only to have a fairly small size - about 75 Mbytes. This is because most of the card has a partition that is formatted for the Linux operating system that the RPi uses and is not visible in Windows. ''
 * 1) Download the  image from a mirror or torrent
 * 2) * http://www.raspberrypi.org/downloads
 * 3) Extract the image file debian6-19-04-2012.img from the debian6-19-04-2012directory in the debian6-19-04-2012.zip
 * 4) Insert the SD card into your SD card reader and check what drive letter it was assigned. You can easily see the drive letter (for example G:) by looking in the left column of Windows Explorer.
 * 5) Download the Win32DiskImager utility.  The download links are on the right hand side of the page, you want the binary zip.
 * 6) Extract the zip file and run the Win32DiskImager utility.
 * 7) Select the debian6-19-04-2012.img image file you extracted earlier
 * 8) Select the drive letter of the SD card in the device box.  Be careful to select the correct drive; if you get the wrong one you can destroy your computer's hard disk!
 * 9) Click Write and wait for the write to complete.
 * 10) Exit the imager and eject the SD card.
 * 11) Insert the card in the Raspberry Pi, power it on, and it should boot up.  Have fun!

Copying the image to an SD Card on Windows if first option isn't successful
I wasn't able to choose device in Win32DiskImager on my notebook so I found a different way to achieve the same thing on windows machine..

C:/flashnul/flashnul.exe -p
 * 1) Download the image from a mirror or torrent
 * 2) * http://www.raspberrypi.org/downloads
 * 3) Extract the image file debian6-19-04-2012.img from the debian6-19-04-2012 directory in the debian6-19-04-2012.zip
 * 4) Insert the SD card into your SD card reader and check what drive letter it was assigned. You can easily see the drive letter (for example H:) by looking in the left column of Windows Explorer.
 * 5) Download flashnul software from http://shounen.ru/soft/flashnul/ here is Translated version
 * 6) * Download the latest version at the time of writing it was flashnul-1rc1.
 * 7) * Download and Extract the application from archive.
 * 8) * Click Start button > All Programs > Accessories > Command Prompt, right click on it and Run as Administrator.
 * 9) * Run the flashnul with argument:
 * 1) * Flashnul will tell you something like:

Avaible physical drives: 0      size = 250059350016 (232 Gb) 1      size = 1990197248 (1898 Mb) Avaible logical disks: C:\ D:\ F:\ G:\ H:\ Press ENTER to exit. '''SDCARD number is on left! In my case it is number 1''' C:/flashnul/flashnul.exe 1 -L C:/debian6/debian6-19-04-2012.img where flashnul.exe   -L   C:/flashnul/flashnul.exe H: -L C:/debian6/debian6-19-04-2012.img
 * 1) * Now we will use Load argument:
 * 1) * Flashnul will give you a device summary and proceed caution, have a quick scan through the information to make sure you have selected the correct device, then type yes and press enter.
 * 2) * If you get a access denied error, try re-plugging the SD card. Also make sure to close all explorer windows or folders open for the device.
 * 3) * If you still get a access denied error, try substitute the device number with the drive letter followed by a colon. Eg:
 * If the device summary does not match Your card (the size is smaller, e.g. 75MB), but you are sure, that the letter is correct - please continue and then try again with the device number.

--Kerbik 23:55, 24 April 2012 (UTC) I hope that this will help someone :) (I didn't test this created SDcard on Pi, yet because I still doesn't have it in my hands :

--Radek 21:03, 18 May 2012 (UTC) Yes it works :)

Copying an image to the SD Card in Mac OS X

 * 1) Download the  image from a mirror or torrent
 * 2) * http://www.raspberrypi.org/downloads
 * 3) Verify if the the hash key is the same (optional), in the terminal run:
 * 4) * shasum ~/Downloads/debian6-19-04-2012.zip
 * 5) Extract the image:
 * 6) * unzip ~/Downloads/debian6-19-04-2012.zip
 * 7) * (or: just double click the zip, it will extract automatically)
 * 8) From the terminal run df -h
 * 9) Connect the sdcard reader with the sdcard inside
 * 10) Run df -h again and look for the new device that wasn't listed last time.  Record the device name of the filesystem's partition, e.g. /dev/disk1s1
 * 11) Unmount the partition so that you will be allowed to overwrite the disk:
 * 12) * diskutil unmount /dev/disk1s1
 * 13) * (or: open Disk Utility and unmount the partition of the sdcard (do not eject it, or you have to reconnect it))
 * 14) Using the device name of the partition work out the raw device name for the entire disk, by missing out the final "s1" and replacing "disk" with "rdisk":
 * 15) * e.g. /dev/disk1s1 => /dev/rdisk1
 * 16) In the terminal write the image to the card with this command, using the raw disk device name from above:
 * 17) * sudo dd bs=1m if=~/Downloads/debian6-19-04-2012/debian6-19-04-2012.img of=/dev/rdisk1
 * 18) * (note that dd will not feedback any information until it is finished, information will show and disk will re-mount when complete)
 * 19) After the dd command finishes, eject the card:
 * 20) * diskutil eject /dev/rdisk1
 * 21) * (or: open Disk Utility and eject the sdcard)
 * 22) Insert it in the raspberry pi, and have fun

Copying an image to the SD Card in 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
 * 2) * http://www.raspberrypi.org/downloads
 * 3) 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:
 * 4) * sha1sum ~/debian6-19-04-2012.zip
 * 5) * This will print out a long hex number which should match the "SHA-1" line for the SD image you have downloaded
 * 6) Extract the image, with
 * 7) * unzip ~/debian6-19-04-2012.zip
 * 8) Run df -h to see what devices are currently mounted
 * 9) Connect the sdcard reader with the sdcard inside
 * 10) 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 RPi SD images have more than one partition.
 * 11) 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)
 * 12) * umount /dev/sdd1
 * 13) * 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.
 * 14) 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 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)
 * 15) * dd bs=1M if=~/debian6-19-04-2012/debian6-19-04-2012.img of=/dev/sdd
 * 16) * Note that if you are not logged in as root you will need to prefix this with sudo 
 * 17) * The dd command does not give any information of its progress and so may appear to have froze.
 * 18) 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)
 * 19) Remove SD card from card reader, insert it in the Raspberry Pi, and have fun

Copying an image to the SD Card in Linux (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) * http://www.raspberrypi.org/downloads
 * 3) Right click the zip file and select "Extract here"
 * 4) Insert the SD card into your computer or connect the SD card reader with the SD card inside
 * 5) Install the ImageWriter tool from the Ubuntu Software Center
 * 6) Launch the ImageWriter tool (it needs your administrative password)
 * 7) Select the image file (example debian6-19-04-2012.img) to be written to the SD card
 * 8) Select the target device to write the image to (your device will be something like "/dev/mmcblk0" or "/dev/sdc")
 * 9) Click the "Write to device" button
 * 10) Wait for the process to finish and then insert the SD card in the Raspberry Pi

=Manually resizing the SD card partitions (Optional)= The SD card image is sized for a 2GB card. The Fedora Remix will automatically resize the partitions on the card during the first boot. The Debian version won't, so you'll have to do it manually. It's much easier if you do this on another machine, as the SD card can't be mounted when you do this.

Manually resizing the SD card on Linux
Tutorial video here: http://www.youtube.com/watch?v=R4VovMDnsIE

Following on from the instructions above, keep the newly-written SD card in the card reader, but unmounted. We'll use the  (partition editor) tool to resize the partitions. $ sudo parted /dev/sdd (parted) unit chs (parted) print Disk /dev/sdd: 121535,3,31 Sector size (logical/physical): 512B/512B BIOS cylinder,head,sector geometry: 121536,4,32. Each cylinder is 65.5kB. Partition Table: msdos Number Start      End         Type     File system     Flags 1     16,0,0     1215,3,31   primary  fat32           lba 2     1232,0,0   26671,3,31  primary  ext4 3     26688,0,0  29743,3,31  primary  linux-swap(v1)
 * Use parted to examine the card
 * This shows how my SD card was formatted after writing the image. Notice that nothing uses the card from end of 'cylinder' 29743 to the card's maximum at 121535.
 * Partition 1 is the boot partition: we'll leave that alone. Partition 2 is the root partition, which we'll grow to fill most of the card. Partition 3 is the swap space, which needs to be moved to the end of the card. Note that on some other versions of linux (and some other versions of hardware) use /sde not /sdd.

(parted) move 3 118479,0,0 (parted) rm 2 (parted) mkpart primary 1232,0,0 118478,3,31 (parted) quit
 * Move the swap partition (you'll have to adjust the numbers so that the end of partition 3 is at the end cylinder/head/sector of the card)
 * to calculate the number to use in the following command do:-   so in this example
 * Now grow the root partition. This involves removing the partition, re-creating it, then using  to grow the filesystem to fill the partition. It won't destroy any data.
 * Note that the starting address of the new partition is identical to its original value, and the ending address is immediately before the start of the swap partition.

$ sudo e2fsck -f /dev/sdd2
 * Now clean and resize the root partition. As before, some users may need to use /sde2 instead.
 * (allow it to add lost-and-found)

$ sudo resize2fs /dev/sdd2 pi@raspberrypi:~$ df -h Filesystem           Size  Used Avail Use% Mounted on tmpfs                  94M  4.0K   94M   1% /lib/init/rw udev                  10M  168K  9.9M   2% /dev tmpfs                 94M     0   94M   0% /dev/shm rootfs               7.1G  1.3G  5.4G  20% / /dev/mmcblk0p1        75M   28M   48M  37% /boot
 * Then put the card in the RPi and boot. You end up with a 7Gb partition to use.

Manually resizing the SD card on Raspberry Pi
You can also resize the partitions of the SD card that your Pi is running on.

First you need to change the partition table with fdisk. You need to remove the existing partition entries and then create a single new partition than takes the whole free space of the disk. This will only change the partition table, not the partitions data on disk. The start of the new partition needs to be aligned with the old partition!

Start fdisk:

sudo fdisk -cu /dev/mmcblk0

Then delete partitions with d and create a new with n. You can view the existing table with p.


 * p to see the current start of the main partition
 * d, 3 to delete the swap partition
 * d, 2 to delete the main partition
 * n p 2 to create a new primary partition, next you need to enter the start of the old main partition and then the size (enter for complete SD card). The main partition on the Debian image from 2012-04-19 starts at 157696, but the start of your partition might be different. Check the p output!
 * w write the new partition table

Now you need to reboot:

sudo shutdown -r now

After the reboot you need to resize the actual partition. The  will resize your main partition to the new size from the changed partition table.

sudo resize2fs /dev/mmcblk0p2

This will take a few minutes, depending on the size and speed of your SD card.

When it is done, you can check the new size with:

df -h