Clone SD Cards

Hi,

Eventually I will have set up a SD card with a good root filesystem
and uboot partitions. Is there anything special that I need to do to
clone this SD card to multiple other SD cards? I ask because I know
you have to untar the rootfs directly onto the SD card to not mess up
the symlinks... so I was wondering if directly copying a whole SD card
onto my laptop and then onto another SD card would cause any problems.

Thanks.

Dan

If you want to clone the SDCard, you can use something like Acronis Disk
Director and simply copy each partition to a new SDCard. You will need two
SDCard readers.

If you use TAR, make sure you use the p option, which copies the file
permissions.

When creating the tar file from the SDCard
cd /media/disk1
tar cvjpf ~/sdcard.bz2 .

When extracting the tar file to the SDCard.
tar xvjpf ~/sdcard.bz2 /media/disk1

I hope this helps.

Regards,

John (USP) wrote:

If you want to clone the SDCard, you can use something like Acronis Disk
Director and simply copy each partition to a new SDCard. You will need two
SDCard readers.

If you use TAR, make sure you use the p option, which copies the file
permissions.

When creating the tar file from the SDCard
cd /media/disk1
tar cvjpf ~/sdcard.bz2 .

When extracting the tar file to the SDCard.
tar xvjpf ~/sdcard.bz2 /media/disk1

I hope this helps.

Regards,
  
Makes sense, I'll be sure to try it when I get to that point.

Thanks!

Dan

You can also utilize 'dd' for making sector-by-sector clones.

Hi Jason,

when using 'dd' will this allow to handle bad sectors or differences in
overall block count of SD-Cards?

I remember some problems with CF-Cards where we ran into troubles due to
CF Cards not having same block count, although they were specified for
same amount of memory...
Finally we decided to first create the partitions and then copy data to
them, because sometimes the cloned cards were not accepted by linux...

regards,
  A.d.T

Jason Kridner schrieb:

Hi Jason,

when using 'dd' will this allow to handle bad sectors or
differences in
overall block count of SD-Cards?

Not generally, no. I often produce 'dd' images off-line and smaller
than a typical SD card so that the block count doesn't exceed the
cards I'll try to copy it to.

I remember some problems with CF-Cards where we ran into troubles
due to
CF Cards not having same block count, although they were specified for
same amount of memory...
Finally we decided to first create the partitions and then copy data
to
them, because sometimes the cloned cards were not accepted by linux...

You are right, creating the partitions is better to copy SD card
contents. But, 'dd' does preserve information that copying the files
does not and that is sometimes useful.

Jason,

thanks for your enlightment. I have to few experience with linux to
figure / check out these details myself in reasonable time.

regards,
   A.d.T

Jason Kridner schrieb:

If you plan to use dd either start with a smaller card or don't fill
it up completely (have a filesystem that does not fully span the card
but leave a few MB unused at the end).

FM

One more point. Make sure you umount the disk before using the dd command to
prevent disk corruption.

Here is an article describing the use of the dd command that may be useful:

Regards,

From: beagleboard@googlegroups.com
[mailto:beagleboard@googlegroups.com] On Behalf Of Frans Meulenbroeks
Sent: Monday, January 19, 2009 1:34 AM
To: Beagle Board
Subject: [beagleboard] Re: Clone SD Cards

If you plan to use dd either start with a smaller card or don't fill
it up completely (have a filesystem that does not fully span the card
but leave a few MB unused at the end).

FM

> Hi Jason,
>
> when using 'dd' will this allow to handle bad sectors or differences in
> overall block count of SD-Cards?
>
> I remember some problems with CF-Cards where we ran into troubles due to
> CF Cards not having same block count, although they were specified for
> same amount of memory...
> Finally we decided to first create the partitions and then copy data to
> them, because sometimes the cloned cards were not accepted by linux...
>
> regards,
> A.d.T
>
> Jason Kridner schrieb:
>
>
> >> John (USP) wrote:
>
> >>> If you want to clone the SDCard, you can use something like Acronis
> >>> Disk
> >>> Director and simply copy each partition to a new SDCard. You will
> >>> need two
> >>> SDCard readers.
>
> >>> If you use TAR, make sure you use the p option, which copies the

file

And even after unmounting you might want to do a sync or wait a second
or 2.

The other day I bumped into the problem that the data written to my SD
card was not ok.
an md5sum of the file on the beagle gave a different sum than on my
linux host.
Probable cause is that I removed the SD card immediately after umount
returned.
Later I noticed it actually had not fully finished writing at that
time (card reader light was still blinking).

FM.