un-corrupt a microsd card?

Vikas Saurabh vikas.saurabh at gmail.com
Sat Oct 18 11:40:59 CEST 2008


Essentially, the partition table is stored in the first sector of the disk.
For me I have stored first 2 sectors (just to be sure) as backup in my home
(which still sits in internal flash)
dd if=/dev/mmcblk0 of=/home/root/2secSd.save bs=512 count=2

Moreover, as I am not too sure of how many sectors actually get overwritten,
so I have configured the first partition as 128Mb of swap.

Once I notice that the sdcard is gone bad, I simply get the parition table
back by:
(1) dd of=/dev/mmcblk0 if=/home/root/2secSd.save bs=512 count=2 ...(get the
table back)
(2) mount ....(list currently mounted partitions and ensure that none from
/dev/mmcblk0 are mounted...unmount those which get mounted)
(3) fdisk /dev/mmcblk0
     (a) p .....(check that the partition table is intact)
     (b) 2 .....(flush this table to disk, which was already there....but
fdisk would tell kernel about the change and thats what we want)
(4) mount -a ....(mount all that is listed in /etc/fstab)

You should have the data back

If you have some data parition as the first partition use 'count=1' in the
dd commands. I use them that way, just to be sure. They are not needed to
get the partition back.

HTH

--Vikas

On Sat, Oct 18, 2008 at 2:42 PM, Joachim Breitner <nomeata at debian.org>wrote:

> Hi,
>
> Am Samstag, den 18.10.2008, 13:30 +1300 schrieb Robin Paulson:
> > for the third time in the past two weeks, my freerunner has corrupted
> > my microsd card.
> >
> > is there anyway of recovering it?
> >
> > i gather from other posts it's a problem with the partition table,
> > rather than the actual data
> >
> > i don't really want to reinstall debian, all the software, and copy
> > across 5GB of music; they're not the quickest of tasks
> >
> > what software is recommended? and is it best to do on the freerunner,
> > or elsewhere, in a card reader?
>
> If it's just the partition table, and you have used the debian installer
> script to partition, you can run the partition stage again.
> (./installer.sh partition). This will leave your data intact and makes
> it accessible again.
>
> Greetings,
> Joachim
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openmoko.org/pipermail/support/attachments/20081018/fe3d60db/attachment-0001.htm 


More information about the support mailing list