I cannot format a corrupted Sandisk SDHC ULTRA 32Gb micro card.
So I used gparted in an Ubuntu system. I deleted the partition (/dev/sdf1), recreated it and formatted it in fat32. It still keeps its original label and 24% used space.
sudo parted /dev/sdf1 unit s print
Model: Unknown (unknown)
Disk /dev/sdf1: 62325760s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
sudo fdisk -l -u /dev/sdf
Disk /dev/sdf: 31.9 GB, 31914983424 bytes 255 heads, 63 sectors/track, 3880 cylinders, total 62333952 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sdf1 * 8192 62333951 31162880 c W95 FAT32 (LBA)
sudo dd if=/dev/zero of=/dev/sdf bs=512 count=1
1+0 records in
1+0 records out 512 bytes (512 B) copied, 0.0122556 s,
41.8 kB/s
sudo shred -vzn 0 /dev/sdf
Then I tried to format again (gparted) to get the log info:
sudo fsck -a /dev/sdf1
fsck from util-linux 2.20.1
dosfsck 3.0.12, 29 Oct 2011, FAT32, LFN
There are differences between boot sector and its backup.
Differences: (offset:original/backup) 71:33/4e, 72:32/4f, 73:47/20, 74:42/4e, 75:5f/41, 76:47/4d, 77:4f/45 , 78:50/20, 79:4c/20, 80:55/20, 81:53/20
Not automatically fixing this.
Orphaned long file name part"173GOPRO"
Auto-deleting.……..
Free cluster summary wrong (813022 vs. really 744969)
Auto-correcting.
Performing changes.
/dev/sdf1: 417 files, 228615/973584 clusters
sudo mkfs.vfat -I /dev/sdf
mkfs.vfat 3.0.12 (29 Oct 2011)
After that, refresh gparted devices takes a long time to display them. Nothing has changed.
So I set two actions: delete the partition and re-created it.
This is the result:
Here's where appears the 'overlapping' info
As suggested in an answer by burlian.vlastimil I tried
http://gparted.org/h2-fix-msdos-pt.php#overlapping-partitions
$ sudo parted /dev/sda unit s print
Error: Can't have overlapping partitions.
but as you can see above I did not get this error msg for my sdf unit
So, I'm stucked at this point.
Edit 1: in my Mac the card is recognized and it displays the tree of directories and files, correct file sizes and dates. Before trying anything I described before I could recover some jpgs I needed so I don't care to lose everything
Edit 2: Added some screenshots from testdisk /log
Best Answer
Can't have overlapping partitions
The root cause is that the partition table contains at least one occurrence where the end of one partition overlaps the start of another partition.
Source: How-to Fix Invalid MSDOS Partition Tables
There is also a guide on how to fix it: How-to Fix Overlapping Partitions