I know it’s been a while since our last post so I thought it’s about time we did another one. If you didn’t know already the foundation has released a Debian based root file system image for the Raspberry Pi. The idea is that you provide your own SD card, but download and then write this image file onto it. You then put the SD card into the Raspberry Pi, turn it on and it boots up into Debian and off you go. Simple. Well, actually, we thought some people might need some help getting this done so here is a little guide we have put together.
Whenever you buy flash memory, either in SD card or USB format, you should always run a test program on it to make sure you have not been sold a fake. Fake flash memory is a big problem on eBay at the moment. My advice is to buy your cards from a local digital photography shop. A good test program that I always use is H2testw 1.4. This can accurately detect counterfeit drives by doing a low level byte read/write across the full capacity of the media. If it says no errors found you are in the clear.
Notice for new users. This procedure is now out of date, please check this article for the most up to date way to do this.
Okay so you’ve got your SD card and the tests check out. Now what? Firstly we need to delete the FAT32 partition that most SD cards come with. This partition is usually there by default to allow you to hit the ground running with a digital camera. You can use whatever program you prefer to do this. Diskpart is a command line tool that comes with windows which will do the job.
Here is how to do it. Firstly start the command prompt as Administrator, this is found in Start > Programs > Accessories. Right click it and select Run as Administrator. Then enter the commands below that are shown in yellow. Note that the disk number may be different on your system.
Now that we have a completely empty SD card we can write the image. The Raspberry Pi downloads page suggests to use a program called windd for this. There are other programs you could use but we’re going to stick with windd. Make sure you have downloaded the image file either via a http mirror link or via the torrent. Download the Windows binary of windd (I used version 0.6beta3) and extract the zip file it comes in to a folder on your system. Start the administrator command prompt again (right click – run as administrator) and change directory to the windd folder. The command you should use is as follows;
dd bs=*block size* od=*drive letter for SD card* if=*path to image file*
Explanation: bs means block size, 1 megabyte is fine for this. od is output drive, so the drive letter of your SD card and if means input file, so this would be the img file we want to burn to the SD card.
Example: dd bs=1M od=G: if=C:\debian6-17-02-2012.img
When you run this command you will see a progress indicator, showing how much data in megabytes has been written, slowly increasing. The process may take several minutes. Here is a screen shot, the command is shown in yellow.
Once the windd command has completed you should be able to explore the first partition of the SD card and see the boot loader files. Screen shot below.
Windows will not let you explore what is on the other partitions since they are for Linux only. You can however use the Disk Management MMC snap in to check that they are all there. This is found in Start > Control Panel > System and Security > Administrative Tools > Computer Management > Disk Management. This is what the SD card should now look like;
The first 75 MB FAT32 partition is used for the boot up sequence and I would presume the 1.55 GB one is the main root file system with a small 191 MB swap partition. We used a 4 GB SD card for this so there is some unallocated space at the end of the card. To make use of this space the 1.55 GB partition will need to be extended. Unfortunately the Windows disk management MMC snap in does not allow you to do this.
You may find it easier to perform this last step on a Linux machine using something like gparted to extend the partition. If you don’t have access to a Linux machine, then you can use the gparted bootable live CD / USB. You essentially boot from a CD or USB (your main hard drive is left untouched) and this will give you a very cut down Linux shell within which you can use gparted to modify the SD card partitions. I used a 512 MB USB memory stick, followed the GParted Live on USB installation instructions and Windows Method B: Manual. For this you just download their zip file and extract it onto your blank USB drive (drive letter I on my machine, this will likely be different for you).
This is what your USB drive should then look like.
To make the drive bootable you then start the administrator command prompt again (right click – run as administrator) and enter the commands below that are shown in yellow (as per the instructions on the gparted site).
Once the makeboot process has finished you just leave the USB drive in your machine (leave your Raspberry Pi SD card in too), reboot and it should then boot from the USB and not your hard drive (your hard drive is left untouched). On some computers you have to activate a boot menu to allow you to select the USB to boot from. If you find that your computer just goes back into Windows you may need to change the boot order in your BIOS set up. Sometimes people have their hard drive first, which means it will ignore the USB and boot straight from the hard drive. If this happens you need to edit your BIOS settings to tell it to check removable media like USBs or CDs/DVDs first. To get into your BIOS set up screen you often have to Press F2 or Del (look for a message along the lines of “Press F2 to enter setup” just before Windows starts to load).
So here is how to use gparted. Apologies for the poor quality of these images, there was no easy way to export screen shots from the live USB file system. So when you boot the live CD or USB you will get three prompts. Just accept the defaults for all of them. These are Don’t touch key map, Language 33 (English), and 0 to Start X and use gparted automatically.
When the gparted window displays choose the SD card from the list in the top right corner. See below.
Now right click on the linux-swap partition and select Resize/Move from the context menu.
Drag the box representing the partition all the way to the right hand side, this will move it to the very end of the free space on the SD card. Then click Resize/Move.
A warning will display about boot partitions. Since this is a linux-swap partition you can safely ignore the warning and click OK. Now right-click the ext4 partition and select Resize/Move from the context menu.
Select the right hand size of the box representing the partition and drag it all the way to the right. Then click Resize/Move.
Now click the Apply all button.
Confirm that you want to proceed and you can then watch while the operations are applied to the SD card, this can take a few minutes to complete.
Now you’re finished and this is what your SD card should look like. We used a 4 GB SD card here, so it will look slightly different depending on the size of your card.
That is it. You should now be able to take the card out, put it into a Raspberry Pi and boot. Good luck!