[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to Image a Flash card?



* Kent West (westk@acu.edu) [030927 13:51]:
> Vineet Kumar wrote:
> 
> >* Kent West (westk@acu.edu) [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.

I've never tried any sort of partitioning tool (fdisk/cfdisk) on a card.
The ones I've used I just pulled out of my camera and stuck them in the
card reader and mounted them.  My camera does have an option to "format"
the CF card.  Are you using these on any other sort of device, or just
to transfer between computers?  If you have a camera or something that
uses these cards, maybe you can "format" it there.

> >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.

If a drive isn't partitioned, 'sda1' doesn't really mean anything, so
this might not work.  You could try to cat 'sda' instead, which should
get the whole drive image, partition table and all.  I've never tried
this with usb mass storage devices like CF or SD cards.

It could be that there is no partition table at all, and that something
like mkfs.vfat /dev/sda might do the trick.  I don't really know about
the details of these cards, just what little I know from using them with
my digicam.  If all else fails, it's worth a try.

good times,
Vineet
-- 
http://www.doorstop.net/
-- 
http://www.eff.org/		Defending freedom in the digital world

Attachment: pgphIRaY_TBbX.pgp
Description: PGP signature


Reply to: