Sean Finney on Mon, 8 Jul 2002 02:20:10 +0200


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

Re: [PLUG] corrupted partition table on CF card


On Sun, Jul 07, 2002 at 05:34:59PM -0600, W. Chris Shank wrote:
> oh shit, it worked this time! i swear i tried this yesterday and it didn't
> work. look like dd successfully pulled all data from card. at least i think
> it did. the card is 64M total, but it wasn't nearly full. would that matter?
> should the dd snapshot be 64M? Now that I have this data down, how can i
> recover the image files?
> 
> dd if=/dev/sdb of=cflash_out
> 125184+0 records in
> 125184+0 records out

well, iirc by default dd does reads in blocks of 512 bytes, so 
512 * 125184 is somewhere in the ballpark of 64MB, so looks like you have
the whole card.  as for retrieving the data, what i'd do first is make
a couple copies of this image file so you can feel a little more comfortable
mucking around with it.  

the first thing i'd try is taking a copy and putting it somewhere safe :)  next
i'd try setting it up on your loopback device (your kernel needs to
support loopback), and see if you can just give it a new partition table.
or, even better, do you have a working CF card?  if so, try just copying
the partition table from one to the other.  the partion table is the
first 512 bytes of the device (someone please correct me if i'm wrong!:),
so you could do something like:

- put in a working cf card of the same size
# dd if=/dev/sdb of=ptable.img bs=512 count=1
# losetup /dev/loop0 cflash_out
# dd if=ptable.img of=/dev/loop0 bs=512 ocunt=1
- knock on wood
# mount /dev/loop0 /mnt

if that doesn't work, try using losetup on the image like above and then just
running fdisk on it, and set the partition table to how you think it should
have been.

on a related note, a while back i accidentally deleted some important stuff on
a fat32 partition that i'd really really like to get back.  as soon as it happened
i unmounted the partition, and mirrored it somewhere safe with dd--anyone know of
some good (ideally free) software i could use to drag the deleted data up from the
murky depths of this hard disk image?  thanks :)

--sean

______________________________________________________________________
Philadelphia Linux Users Group       -      http://www.phillylinux.org
Announcements-http://lists.phillylinux.org/mail/listinfo/plug-announce
General Discussion  -  http://lists.phillylinux.org/mail/listinfo/plug