How to make a bootable SD card for the Raspberry Pi using Windows

Hi everyone!

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.

Gparted

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!

28 thoughts on “How to make a bootable SD card for the Raspberry Pi using Windows

  1. You could delete the FAT32 partition on the SD Card using the Disk Management MMC snapin too. Saves all that work at the command prompt.

    • The Disk management MMC snap in does not allow you to do this, annoyingly. But stand by, we have found an even easier way to do this that does not require the delete partition step.

  2. Some of this worked for me. Some of it didn’t. Here are the workarounds I had to do:

    1) ALWAYS run any cmd prompts as Administrator. By this I mean right click and choose Run as Administrator. It’s NOT sufficient to run “cmd”, “dd” or “makeboot” just normally by double clicking from an Admin account (on Vista at least). If you get Access Denied from makeboot or errors from dd this is a good first thing to check.

    2) In Diskpart, DELETE PARTITION did not work for me (I am on Vista) saying you cannot delete partitions on removable media. Use CLEAN instead (make sure you have selected the correct partition first !!)

    3) GParted Live USB did not boot from USB for me. I got a Boot Error and nothing else when trying to boot it. If this happens forget the USB version and download the GParted .ISO file and burn this to a CD. I managed to boot from the CD version fine.

    Hope this helps others avoid the same frustrations!

    • Hi Ian, thanks for your contribution. Just to reply to your points;

      1) I think you have failed to follow my instructions here. The blog post does say to run the command prompt as administrator, and if you look at both command prompt screen shots, they have been run as Administrator. See the window title.

      2) I have not tested it on Vista so thanks for this point.

      3) I think you have probably just failed to correctly follow the instructions for creating the bootable USB. Windows method B does work. You just unzip the file to the root of the drive, start the Administrator command prompt, navigate to the X:\utils\win32 folder and run the makeboot batch file. I did not include instructions in my guide on how to do this because there are clear instructions on the gparted site.

    • Also Ian, you might want to have a look at some of my other blog posts. There is a much easier way to write the image files without needing to delete the FAT32 partition first.

  3. Hi – Sorry, I wasn’t trying to be critical – it’s a great article.

    The subtle difference between running a program as admin and running a program logged in as admin is easy to miss IMHO. Part of the joys of Vista ;-)

    I followed the instructions carefully. Perhaps it’s a subtly of the BIOS on my machine or something but the USB did not work after a number of careful attempts. Just thought I’d mention the ISO technique in case anyone else had the same issue.

    Keep up the good work on the blog, it’s appreciated.

  4. Thanks for the help! I’m only 15 and just bought a Raspberry Pi, I understand the instructions up until I have to use GParted. I have all the files on my 8GB SD card (eg: start.elf etc) I don’t have a Linux computer and I don’t know how to Gpart my USB…if that makes sense. Do I need to Gpart my USB or leave it (I use Windows 7)? Sorry for not really understanding what is happening. Any help would be appreciated, thanks.

    • Hi there! Glad to see some young people getting stuck in! With gparted you don’t have to have a Linux pc to create the bootable USB. You can do it with a windows PC, they have instructions on their site for how to do this. Look under the heading USB setup with Windows. You don’t have to follow method B like I have, there are other ways you can create it too. I just found method B the quickest. Since a few people have asked about this I have done an update to the guide to clarify this area. I hope it helps.

  5. Very good tutorial, I am stuck at the part where I need to install G-Part. I don’t have a Linux computer, so I can’t download this program. I’m not sure what to do. My SD card (after partitioning it) is only 74MB big, is this right? This question will hopefully help beginners who come here.

    • Hi Lous, yes the first partition is only 75 MB. Take another look at the guide which says to use the Disk Management MMC snap-in to look at what partitions have been created. With gparted you do not need to have a Linux machine to create the bootable USB. You can do it with windows, follow the instructions on their site. A lot of people are asking about this so I am going to do an update to the main guide to clarify.

  6. Hi,
    I was about to ask on the ‘official’ Raspberry Pi website if anyone had posted a ‘step by step’ guide to preparing a start up SD card, when I came across your post containing a link to your blog, and found exactly what I was looking for.
    I am just downloading the Debian image at the moment, and will be trying it out later.
    What I have done though is to prepare a pdf file documenting the whole process, which I will print out, and so have a ‘hard copy’ to refer to, as I follow the laid down procedure.
    Thank you for taking the time, and trouble, to produce the article.

  7. Thanks. this has rely explained it for me. I’m not getting my pi until the middle of August despite ordering just a week after the launch. I think before they put it on “general realise” to schools they should make some sort of utility maybe a wizard to do it all for you as the cmd basted set-up may put many young children off.

    • Hi Jack. Not sure what image you are trying to write but it does sound like something has gone wrong there. Go back and make sure you have followed everything correctly and that the image you’re using is not broken. The acid test is always to put it in the Pi and try to boot. You can also try and use Win32DiskImager for a more UI friendly approach.

  8. Pingback: Raspberry Pi – Starters Guide | GlynRob

  9. Tried to use the tutorial. The delete SD card worked perfectly, but when I tried to use dd, it said that od was not an option, only output option was of. Used the dd version you listed above.
    I used “dd of=F: if=C:\debian6-17-02-2012.img” and got the message
    This program is covered by the GPL. See copying.txt for details
    read from 95 disk
    Exception EAccessViolation in module dd.exe at 00003101.
    Access violation at address 00403101 in module ‘dd.exe’. Read of address E58B000
    0.
    Guide me Jedi Master.

  10. Hi! Thanks for your great article. I am running on Windows 7. I used it to begin to burn an OS to my 2Gig SD card. I followed your directions with the exception of using the image file, 2013-02-09-wheezy-raspbian.img. All worked like a charm. The windd program worked great … the SD was burned and shows only the following: (not the files you show, but I am using a different IMG)
    17,764 bootcode.bin
    142 cmdline.txt
    1,180 config.txt
    5,898 fixup.dat
    2,260 fixup_cd.dat
    8,687 fixup_x.dat
    2,802,568 kernel.img
    9,609,792 kernel_emergency.img
    2,694,676 start.elf
    569,240 start_cd.elf
    3,631,684 start_x.elf
    137 issue.txt

    So, my dilemma … in continuing with the instructions to make the SD bootable for me to test in on my PC … The Windows 7 set up is not as you show it … i.e., no makeboot file and no utils directory. Do you have any helpful advice with how to proceed from this point.

    I sure appreciate it.

    Frank McLeod

    • Oh, BTW re:above … I am using the 64bit WIndows 7 … and I meant to say that the setup on the SD card does not show the utils dir … just the files I have listed above. Thanks

      • Hi Frank, if you’re using the latest Raspbian then you don’t need to follow the steps to make a bootable USB drive. That step is only needed if you have to manually resize the Linux partitions and you don’t have a Linux pc to do it on. With the latest Raspbian image you will get a config screen on first boot with an option saying ‘expand root fs to fill SD card’. That will do it all for you and saves you a lot of time.

      • Thanks for the help. Will give it a shot today. Fairly proficient in the Windows world, but all of this seemed rather daunting. Looking forward to new frontiers. I appreciate your time and work.

  11. Hey guys!

    I’m running Windows 7 ultimate, the WinDD didn’t work for me. I typed following:

    dd bs=1M od=D: if=C:\rpi_19_04_2014.img

    Where D: is my phlash card (I used it instead of MS) and C:\rpi_19_04_2014.img is a location of the image. It just does nothing. What have I messed up?

Ask a Question or Leave Some Feedback

We will not display your email address. Fields marked with a * must be filled in.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>