I want to make a new SD card with Raspbian and OpenCV installed. Instead of making it from scratch, I have already done this from another SD card that I use with raspberry.

After cloning the SD card, I can't connect to the cloned SD card with Raspberry, and the filesystem is so different from the SD card that I cloned.

I have used the dd command in Ubuntu:

sudo dd bs=4M if=/dev/mmcblk0 of=raspbian.img

In the new SD card

df -h
umount /dev/mmcblk0p1
sudo dd bs=4M if=raspbian.img of=/dev/mmcblk0

I get the following error when connecting the pi 2 with a HDMI cable to a laptop : end kernel panic - not syncing : VFS : Unable to mount root fs on unknown-block (179.2) Is there any method to clone SD cards with possibility to use and connect both after the cloning operation?

Note : the two sd cards have the same size : 32 GB . But they are from different types (manufacturers), the cloned one is a samsung class 10 32 gb --> cloned to kingston 32 gb class 4

Links :

  • Which utility did you use for cloning ? Commented Jul 22, 2015 at 8:42
  • What you're doing looks good. It should work. Commented Jul 22, 2015 at 9:11
  • 1
    Alternatively, you can make use of GUI utilities such as win32 disk imager on windows platform or image-writer on ubuntu. Hope it helps. Commented Jul 22, 2015 at 9:13
  • yes , i have tested win32 fro writing to cards it's super easy to do i think i will try it and let you know ;)
    – The Beast
    Commented Jul 22, 2015 at 9:34
  • I have had the same experience and it was the result of a corrupted copy of the image. Some cards seem to work better than others. In my case, a nice Samsung class 10 card wouldn't work reliably, but an old Sandisk class 4 card worked perfectly.
    – bobstro
    Commented Jul 23, 2015 at 14:36

2 Answers 2


Did you check the exact sizes of both of the cards (eg. using fdisk)?
If the target card is a little bit smaller than the the original card, duplicating using dd can (or even will?) fail.

I roughly documented a way that finally worked for me here.

  • yes the two sd card are the same size : 32 GB , but they are from different types , the cloned one is a samsung class 10 32 gb cloned to kingston 32 gb class 4
    – The Beast
    Commented Sep 11, 2015 at 14:37
  • 1
    I don't think the brands or classes are important and make a difference, but size does. Use sudo fdisk -l in Terminal to figure out the exact sizes on Byte level and not Gigabyte level! The Gigabyte value is just a rough estimate.
    – Js.
    Commented Sep 13, 2015 at 19:07
  • the kingston card 32 gb : 31197233152 bytes ... and the samsung class 10 32gb : 31 922 344 428 bytes. so they are a little bit different in size ... is This can be the cause of the problem ??
    – The Beast
    Commented Jan 16, 2016 at 16:32
  • @Frankenstein Yes! This is exactly what I'm talking about. The target card seems to be slightly smaller compared to the source card.
    – Js.
    Commented Jan 17, 2016 at 16:57
  • so i can do nothing now ... the card is corrupted !!! is there any alternatives ?
    – The Beast
    Commented Jan 17, 2016 at 17:15

Perhaps you had a block error in an inconsequential part of your SD card. This would cause dd to quit writing the current block and resume immediately with the next block, so your file system would be off.

Including "sync" in both your dd commands may fix it by zeroing the remaining bytes in the bad block, but you would possibly also need to reduce your block size so that the zeroed portion doesn't take bytes out of other important blocks.

  • thanks ... can you tell me how to do it ?
    – The Beast
    Commented Jan 16, 2016 at 15:53
  • sudo dd bs=4M sync if=/dev/mmcblk0 of=raspbian.img It's honestly just as easy as adding the word sync. Like I said, maybe consider dropping block size from 4M to maybe 4096 (no letter, I mean 4096 bytes). This will be slower, but will be more reliable. You could also pipe it, which makes it read and right simultaneously, instead of read block, write block, repeat: sudo dd bs=4M sync if=/dev/mmcblk0 | dd bs=4M sync of=raspbian.img.
    – Tim G
    Commented Jan 18, 2016 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.