Making an image file from an SD card on Windows
I spent time figuring this out due to needing SD cards for my Raspberry Pi, but the instructions apply to pretty much anything on SD.
DD on Windows
Before using DD it’s important to figure out which disk number is allocated to the SD card. This can be seen in Computer Management tool (click on the Start button then Right Click on Computer and select Manage). Go to Storage -> Disk Management:
Here the SD card is Disk 1.
Making the image
First start a Windows command line as Administrator (hit the start button, type cmd then right click on the cmd.exe that appears and select Run as Administrator). Next change directory to wherever you unzipped the DD tool.
To copy the SD card to an image file (in this case c:\temp\myimage.img) use the following command line:
dd if=\\?\Device\Harddisk1\Partition0 of=c:\temp\myimage.img bs=1M
In this case we’re using DD with 3 simple arguments:
- Input file (if) is the SD card device
- Output file (of) is the image file we’re creating
- Block size (bs) is 1 megabyte
Writing the image back to a clean SD card
The first step is to ensure that the SD is complete clean. Most cards come preformatted for use with Windows machines, cameras etc. The diskpart tool can be used to remove that. Go back to your cmd running as administrator (and be very careful if you have multiple disks that you use the right number):
select disk 1
select partition 1
You’re now ready to copy the image back to the SD (simply by swapping the earlier input file and output file arguments):
dd of=\\?\Device\Harddisk1\Partition0 if=c:\temp\myimage.img bs=1M
Filed under: howto, Raspberry Pi | 9 Comments
Tags: DD, howto, image, Raspberry Pi, Raspi, RPi, SD