cloning SD card

I have a working Beagle board with an 8 GB SD card with a Debian
install on it. I want to just clone this card
for another system. I have a Linux computer with just ONE SD/MMC
slot. So, I used fdisk to set up the partition table as close to the
same as the working card, and then copied over the contents of the two
partitions.

The first partition is W95 FAT32 (LBA), and about 70 mb. The working
one DOESN'T have a file called MLO, but
does have initrd, initrd.pad, u-boot.bin, uImage and uImage.bin
So, I copied these files to the same partition of the new SD card
using tar.

The second partition is formatted with a Linux partition, and I copied
everything there using tar.

When I try to boot from this SD card, I get to :
** Unable to read "boot.scr" from mmc 0:1 **
reading uImage.bin

and then nothing happens.

One thing I have noticed is that fdisk reports very different numbers
of heads, sectors/track and cylinders
between the two cards, is this significant? If so, how do you
reformat the card to change that?

Is it absolutely necessary to format the card on a Windows system?
That is really difficult here, for a variety of reasons I don't have
anything M$ newer than Win 2K.

Thanks in advance for any pointers.

Jon

Hi Jon

I have a working Beagle board with an 8 GB SD card with a Debian
install on it. I want to just clone this card
for another system. I have a Linux computer with just ONE SD/MMC
slot. So, I used fdisk to set up the partition table as close to the
same as the working card, and then copied over the contents of the two
partitions.

The first partition is W95 FAT32 (LBA), and about 70 mb. The working
one DOESN'T have a file called MLO, but
does have initrd, initrd.pad, u-boot.bin, uImage and uImage.bin
So, I copied these files to the same partition of the new SD card
using tar.

The second partition is formatted with a Linux partition, and I copied
everything there using tar.

It should work, i do "sudo tar cvp ../backup.tar ./*"...

When I try to boot from this SD card, I get to :
** Unable to read "boot.scr" from mmc 0:1 **
reading uImage.bin

This could just be a bad write to the sd card.. what does this print
from u-boot?

mmcinit (or mmc init)
fatls mmc 0:1

you'll either get noise, or the correct files...

and then nothing happens.

One thing I have noticed is that fdisk reports very different numbers
of heads, sectors/track and cylinders
between the two cards, is this significant? If so, how do you
reformat the card to change that?

This shouldn't effect anything. As long as partition 1 is fat16/32
and partition 2 is ext2/3 for the system..

Regards,

OK, weird, the working card doesn't have the first partition bootable,
but the second partition is. I made the first partition also bootable
on the copied card, and it now gets
further. But..... then I got a kernel panic couldn't mount file
system. The install was set up to require ext3, and I'd let mkfs
create an ext2. So, i re-did it with ext3, and now it
boots! Yes!

Thanks,

Jon

If the destination card is the same size, then an easy (but slower) way is to
use dd. Read from the device, not the partition, so you get partition table
for free. Try something like the following. I don't think I used any other
arguments, and it worked fine.

Insert the original card. Don't mount it. I'm assuming it /dev/sdc:

dd if=/dev/sdc of=$HOME/card_image

Pull the original, and insert the destination card:
WARNING: This will overwrite /dev/sdc, so make sure this is *not* your
important USB drive with data you can't lose without tragedy.

dd if=$HOME/card_image of=/dev/sdc

HTH

Cameron.