7

I just found that my HD2 broke its memory card's partition table at once.

When I insert the card in my SD reader I get only a whole RAW (unformatted) partition in Windows. Linux doesn't even see it as /dev/sdXX

How can I try to restore the old 3 partitions (FAT32, sd-ext and swap)?

4
  • Do you think there's then a chance that only your partition table was blown away, and the data blocks were left untouched? Nov 15, 2012 at 22:22
  • I think so, doc Nov 15, 2012 at 22:39
  • [Add] Thanks Whatsapp! The phone broke after a couple of hours of installation Nov 15, 2012 at 22:41
  • The first thing I'd do is make a complete copy of the contents of the card. On linux or osx, you'd call dd like: dd if=/dev/{YOUR SD CARD} of=/SDCardDump.dd.raw - then I'd try to recover the partition & file system on the copy. Any number of recovery utilities should be of some help. I like this approach as then you're at least not making it worse with your only copy. Nov 15, 2012 at 22:42

3 Answers 3

6

You can try TestDisk (free, cross-platform, and open source) - it works on almost all drives on a system, regardless of whether or not the drive is internal or external. You can use TestDisk to discover and rewrite any partition tables found on the drive - it can even find corrupted or missing partitions and then repair the partition table.

Alternatively, you can also use TestDisk to simply recover the files without repairing the partition table (if you just want to format and start from scratch). I've had success using it to copy files off of corrupted partitons/drives, even with bad sectors.

8
  • I thought it only worked for Linux. I'll give it a try Nov 15, 2012 at 22:55
  • 1
    @djechelon you can also download a bootable image, and run it from a USB key or a CD (for example, TestDisk is included with the Ultimate Boot CD). Nov 16, 2012 at 0:21
  • After a few attempts with photorec (which comes with testdisk AFAIK) I successfully recovered the few most important files in my SD. But I was completely unable to restore the lost partition from the card, it had to run through the sectors. Fortunately I didn't encrypt the card!!! Nov 25, 2012 at 21:27
  • @djechelon glad you got some of the important files back. You might also want to scan the SD card for bad sectors; depending on how old it is, this might indicate it's time to replace it. Nov 26, 2012 at 13:26
  • 1
    @djechelon have a look here, since it might be difficult to conclusively prove if there's a problem with the card (and testing it will further wear it out). Given the relative cost of a new SD card though, and depending on how old it is, I'd strongly consider just purchasing a new one. However, if it's fairly new (and considering the risks of data corruption), if any similar events happen in the future (or you files become corrupted by themselves), it's time for a new one. Nov 26, 2012 at 16:59
2

Thats one works for me:

Enter adb shell, insert the SD card into the slot and type: # dmesg

This returns kernel messages. Look at the end, it will tell you what device was inserted with additional information:

<7>[22821.137721] sdhci: card inserted.
<7>[22821.336235] Universal : Card status 1
<6>[22822.591613] mmc2: new high speed SDHC card at address b368
<6>[22822.598715] mmcblk1: mmc2:b368 46608 15.4 GiB
<6>[22822.601085] mmcblk1: unknown partition table

Take note of the device, in this case it's "mmcblk1"

Now use fdisk to create a new partition table like this:

# fdisk /dev/block/mmcblk1

Create a new empty DOS partition table:
Command (m for help): o

Create a new primary partition:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-505824, default 1): enter
Last cylinder or +size or +sizeM or +sizeK (1-505824, default 505824): enter

Print the partition table and review the changes:
Command (m for help): p

Disk /dev/block/mmcblk1: 16.5 GB, 16574840832 bytes
4 heads, 16 sectors/track, 505824 cylinders
Units = cylinders of 64 * 512 = 32768 bytes

Device Boot Start End Blocks Id System
/dev/block/mmcblk1p1 1 505824 16186360 83 Linux

Note that mmcblk1p1 is partition 1 on mmcblk1.

Write the partition table to disk and exit:
Command (m for help): w

Power cycle your phone so it properly re-reads the partition table and go into Settings, Storage and format/mount your card.

1

djechelon, Try this. Download EaseUS Partition Recovery. This should be able to detect your SD card and from there you can reformat it to restore functionality. EaseUS products are 100% safe.

1
  • I tried the pro version but all the files restored were unreadable someway. Tar.gz files looked empty, .properties files were not textual... I'm trying more options... Nov 15, 2012 at 22:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .