Restoring microSD partition table
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.
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.