Vineet Kumar wrote:

* Kent West ([EMAIL PROTECTED]) [030927 08:27]:


I've got two 128MB flash cards. One of them is a SanDisk brand, and from what I've found on the web are prone to "dying". Mine has died. However, before giving up on it completely, I thought I'd see if I could clone an image from the second (PNY brand) to the dead SD unit. I'm figuring the "dd" command is probably my friend here, but I really don't know for sure.

Can anyone give me a command with correct syntax for making a bit-for-bit copy of one flash card to an image on the hard drive, and then to copy that image from the hard drive to the second flash card?



We're talking about compact flash, right?



No; sorry; I wasn't clear. They're SD cards rather than CF cards.


IME, they've just got a vfat
filesystem on them.  You can just mount them directly and use tar.  It's
not exactly what you asked for (an image), but it should work just fine.

Except that the problem is the partitions won't "take". I can try creating partiions of different size, type, number; all I get back is an error message from cfdisk everytime that I run it that the partition table is wrong and do I want to start with an empty partition table. fdisk appears to go through the motions, but after writing out the changes and then going back into cfdisk or fdisk, nothing actually changed, and the partitions are still "wrong" (cfdisk won't even recognize partitions; fdisk "sees" four ext2 partitions that are overlapping and otherwise mangled). That's why I need a bit-for-bit copy instead of a filesystem-to-filesystem copy. I'm hopng that whatever may be "hidden" "under" the partition scheme might thus get repaired.

Otherwise, to create an image, you could just cat them around. Insert
(but don't mount) the source, cat /dev/sda1 > cf.img . Then put in the
other one, and cat cf.img > /dev/sda1 . That should work. The only
reason I suggest that instead of giving a proper dd command line is that
I don't know precisely what block size to give to dd.


Okay, that sounds like a good idea. I'll give that a try.

Unless you have some very special requirement, though, I'd say the best
way to move the data around is to mount it and deal with the files, not
trying to mess around with images.


See above.

As a test, if you do cat /dev/sda1 to a file, you could see if you can
mount it the image file via -o loop, before catting it out onto the
target card.

good times,
Vineet


Thanks; I'll look into this later today or tomorrow.

--
Kent



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Reply via email to