I need to clone micro SD card, using Windows or Linux OS. SD card should be cloned as a whole volume, and not as partition. It may contains several partitions, some of them cannot be recognized by Windows/Linux. Basically, I want to make SD card image file, and then to insert another SD card media and copy this file to it, overriding everything that this media contains. How can I do this?
4 Answers
On Linux you can use dd
to do that.
dd if=/dev/sdcard1 of=/dev/sdcard2
where if
is the origin and of
the destination SDs.
or if you want to take the image first and copy it to 2nd SD after:
dd if=/dev/sdcard1 of=~/sdimage
dd if=~/sdimage of=/dev/sdcard2
-
Thanks. This is exactly what I am trying to do, but from some reason the second stage (image file to SD card) hangs after some time.– Alex FDec 11, 2012 at 15:11
-
Are the SDs the same size? if not, the 2nd needs to be larger than 1st one. If not and SD1 not 100% used, you can try resizing the filesystems and partitions there but that is another topic :)– laurentDec 11, 2012 at 15:46
-
1Finally I managed to do this with dd, but it is necessary to unmount all SD card partitions before running dd.– Alex FDec 13, 2012 at 6:04
You could use Clonezilla, which is a small Linux live distro which allows you to create drive images or to exactly copy one drive to another.
Just use dd for Windows (http://www.chrysocome.net/dd).
Run CDM as Administrator:
dd --list
Check which device is your SD card. In my case it was: \\?\Device\Harddisk1\Partition0
. Partition0
refers to the whole disk, Partition1
to the first partition, etc.
Copy whole SD card to an image file:
dd if=\\?\Device\Harddisk1\Partition0 of=my.img bs=1M --progress
Then insert the new card and write back image file to it:
dd if=my.img of=\\?\Device\Harddisk1\Partition0 bs=1M --progress
If you get an access denied error after writing couple of blocks, clean the partition table of the SD card before writing to it:
diskpart
DISKPART> list volume
DISKPART> select volume #
DISKPART> clean
DISKPART> exit
I have used WinImage to do this in the past in Windows.
-
Thanks. Can this program clone the whole media, and not only partition? Is this program free?– Alex FDec 11, 2012 at 15:12
-
How have you used it? What are the steps to copy write an image to an SD card? Aug 6, 2017 at 23:55
-
Winimage cannot create images of SD with multiple partitions, as it see each partition as its own drive.– rataplanJul 22, 2023 at 20:54