Creating replica of my Linux SD card

Hello everybody,
I would like to create a physical replica of the SD card with Linux
which I have been using now into another SD card. Is that possible?
Could anyone give me any suggestions?
Thanks,
Frederico Lima

From Linux:

with this you get an image of old SD:

dd if=/dev/sdX of=/root/image_old

and with this you put the image in the new SD:

dd if=/hoor/image_old of=/dev/sdX

EDIT:

From Linux:

with this you get an image of old SD:

dd if=/dev/sdX of=/root/image_old

and with this you put the image in the new SD:

dd if=/root/image_old of=/dev/sdX

That will do it... It's even gets better if you install dcfldd.

(on ubuntu:) sudo apt-get dcfldd

afterwards try:

read:
  dcfldd if=/dev/sdX of=~/current_image sizeprobe=if

write:
  dcfldd if=~/current_image of=/dev/sdX sizeprobe=if

dcfldd will give you a progress-indicator so you know how long your
coffe-break will take.

For everyone who clones SD-cards: Use dcfldd instead of plain-old dd. It
is much better.
  Nils

Hello Nils,
I have tried your solution:

read:

  dcfldd if=/dev/sdX of=~/current_image sizeprobe=if

but it did not work. This was output:

[44% of 1835Mb] 26112 blocks (816Mb) written, 00:02:24
remaining.dcfldd:/dev/mmcblk0p2: Input/output error

26155+1 records in
26155+1 records out

Any idea want the problem could be.
Thanks!

I have also tried to save the "current_image" in a different folder:

/root/current_image

However, all of them stop the same 44%, 26112, 816Mb. I have checked
the memory available in my hard disk and it is about 3GB. So, that
should not be the problem neither. It seems that there is some type of
"protection or permission" not allowing to copy certain files from the
root of my SD-card.

Thanks for your suggestion Luca26,
I have also tried your solution:

with this you get an image of old SD:

dd if=/dev/sdX of=/root/image_old

But just like with the dcfldd, it does not copy the whole content. The
output was:

dd: reading `/dev/mmcblk0p2': Input/output error
1673944+0 records in
1673944+0 records out
857059328 bytes (857MB) copied, 119.01 s, 7.8 MB/s

freddyglima wrote:

Thanks for your suggestion Luca26,
I have also tried your solution:

with this you get an image of old SD:

dd if=/dev/sdX of=/root/image_old

But just like with the dcfldd, it does not copy the whole content. The
output was:

dd: reading `/dev/mmcblk0p2': Input/output error
1673944+0 records in
1673944+0 records out
857059328 bytes (857MB) copied, 119.01 s, 7.8 MB/s

maybe your card is plain broken

Hi,
are you doing this operation in your PC or in the BB ?

You MUST do that in your linux pc without mounting the sdX .

I do not think that is the case because I work with this SD card
everyday and it seems alright.

Is it possible to create an image of actually existing data, not the whole SD card. If I use dd then only the whole SD card space extracting works, but this operation consumes too much time. If I use 4GB card then only ~1.2G is used. The rest of is empty space. So, my image is 4GB, but only 1.2G of that is useful.

Is it possible to create an image only from the existing data?

2011/5/6 freddyglima <freddyglima@googlemail.com>

Hello Luca,

are you doing this operation in your PC or in the BB ?

I have tried in my PC which has Linux.

You MUST do that in your linux pc without mounting the sdX .

The card was not mounted when I tried your solution

If you di this:
dd if=/dev/sdX of=/root/image_old

why does it relply you with this:
dd: reading `/dev/mmcblk0p2': Input/output error

It should write this (or something similar):
dd: reading `/dev/sdX': Input/output error

You are right, I have used:
dd if=/dev/smmcblk0p2 of=/root/image_old

So, the output was:
dd: reading `/dev/mmcblk0p2': Input/output error

You mean this ??
cp /dev/sda1 mydata.img

~Johnson

I'm not sure but I think /dev/mmcblk0p2 is a partition of your SD not
all the SD.

The size of that partition is probably 857MB .

You should not be running this command on the BeagleBoard (target).
It should run on some other host, e.g. your desktop. The device
name you have used implies you are trying this on the BB.

Also, to copy the entire SD device, you need to use the device
descriptor, not a partition descriptor.

On my [Fedora] desktop using a USB SD card reader, I would use this:
   # dd if=/dev/sdb of=/tmp/SD_FULL