using dd to image SDHC cards


6 posts
by kevintmckay » Tue Jan 08, 2013 2:09 am
Hi,
I have my pi in a very happy state and thought I could dd the SDHC to an image file as backup and also be able to then dd back to a different card I just purchased that's faster. However this does not work here is what I tried both SDHC cards are 4G

From a pc running ubuntu with the SDHC card in the card slot
card one dd bs=1M if=/dev/sdc of=pi.img
card 2 dd bs=1M if=pi.img of=/dev/sdc

card 1 dd bs=4M if=/dev/sdc of=pi.img
card dd bs=4M if=pi.img of=/dev/sdc

I know the card is fine because I can write and boot the current weezy image

any ideas what I need to do to be able to replicate the disk image from one SDHC to another?
Posts: 8
Joined: Tue Jan 08, 2013 1:52 am
Location: berkeley california
by MaxK1 » Tue Jan 08, 2013 6:49 am
Ubuntu complains or the resulting image doesn't boot? I have done this in the past with no problems
as well as: dd if=/dev/mmcblk0 of=/dev/sdb bs=1M with a 23-in-1 card reader/writer plugged into the Pi.
Posts: 477
Joined: Sun Aug 26, 2012 11:34 pm
by shuckle » Tue Jan 08, 2013 6:56 am
It ia worth to double check that card sizes are exactly the same. Often they differ by some bytes even though they are reported to be the same.
Your method only works if they are exactly the same or you copy from smaller to bigger.
Posts: 432
Joined: Sun Aug 26, 2012 11:49 am
by pluggy » Tue Jan 08, 2013 10:24 am
You can use parted/gparted to shrink the root partition slightly before you start. It will still give an error, but it can be ignored because the partition itself will have written. The bit it coughs on will be in the dead space after the partition.
Don't judge Linux by the Pi.......
User avatar
Posts: 2397
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by kevintmckay » Thu Jan 10, 2013 2:06 am
Looks like a size issue I will resize with parted. I dd from off size disks in Linux all the time and rarely have any issue wonder if blocks are written in a different order with the sdhc cards?

old transcend 4g

Disk /dev/mmcblk0: 4093 MB, 4093640704 bytes
4 heads, 16 sectors/track, 124928 cylinders, total 7995392 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00017b69

new Sandisk ultra

Disk /dev/mmcblk0: 3965 MB, 3965190144 bytes
4 heads, 16 sectors/track, 121008 cylinders, total 7744512 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00017b69

the other strange thing is that the second card I got was advertised as a 33mb a sec card but its barley faster than the old transcend??

old transend
root@raspberrypi:~# hdparm -t /dev/mmcblk0

/dev/mmcblk0:
Timing buffered disk reads: 60 MB in 3.00 seconds = 19.99 MB/sec
root@raspberrypi:~#

new sandisk ultra

root@raspberrypi:~# hdparm -t /dev/mmcblk0

/dev/mmcblk0:
Timing buffered disk reads: 62 MB in 3.10 seconds = 20.03 MB/sec


I must say I am very pleased with the pie, I am running 2 sites as vhosts under apache with php mysql public DNS mail the whole enchilada and it keeps up fine. they only do 30k hits a month but still this little server is awesome!

Thanks
Posts: 8
Joined: Tue Jan 08, 2013 1:52 am
Location: berkeley california
by kevintmckay » Fri Jan 11, 2013 11:43 pm
re sizing with parted resolved the issue

Thanks
Posts: 8
Joined: Tue Jan 08, 2013 1:52 am
Location: berkeley california