2

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: gparted info gparted log

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: Format 1 Format 2 gparted log

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

enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here

  • Can you post the output of fdisk /dev/sdf? – eyoung100 Aug 18 '15 at 20:14
  • I recreated the question – dstonek Aug 19 '15 at 16:55
  • Please post the output of fdisk -l -u /dev/sdf and follow @burian.vlastimil's answer. GParted clearly states in your last log overlapping partitions – eyoung100 Aug 19 '15 at 19:15
  • It is already in my question, the second command. I already described what happens when started to follow removing overlapping partitions instructions – dstonek Aug 19 '15 at 20:25
  • What does Testdisk show? – eyoung100 Aug 19 '15 at 20:32
3

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

  • I will edit my question to add first step result trying to fix that from gparted.org/h2-fix-msdos-pt.php It does not display "Error: can't have overlapping partitions" – dstonek Aug 19 '15 at 0:37
  • There's only one partition, what is overlapping? – dstonek Aug 19 '15 at 20:35
  • @dstonek It basically means, that one partition comes partialy over another partition – LinuxSecurityFreak Aug 20 '15 at 7:05
  • Anyway I don't understand why is that. It is a Gopro card occasionally formated in the camera, no partitions handling, just one partition Fat32 – dstonek Aug 20 '15 at 14:01
0

Got similar issue on multiple SD who were working in a camera and phones, but won't mount at all on Ubuntu/Mint.

While trying to format, got:

Can't have overlapping partitions

Wasn't able to format using either Disks or gparted.

To resolve and mount, step by step:

First make sure you have the necessary packages:

sudo apt-get install exfat-fuse exfat-utils

Run the Disks gui, to be find in applications.

Note the SD device disk label: (example /dev/sde)

Run this command to get the current allocated size:

sudo fdisk -l -u /dev/sde 

Substract the END and START, example:

Device Boot Start End Sectors Size Id Type
/dev/sde1 * 8192 15572991 15564800 7.4G b W95 FAT32

So, in this case:

15572991 - 8192 = 15564799

To edit, write the output on a file:

sudo sfdisk -d /dev/sde > sde-bckup.txt 

Open sde-bckup.txt on the home folder with any text editor.

Sample input:

label: dos
label-id: 0x00000000
device: /dev/sde
unit: sectors

/dev/sde1 : start=        8192, size=    15564800, type=b, bootable

When done, write back the partition table to the device:

sudo sfdisk /dev/sde < sde-bckup.txt

If successful:

The partition table has been altered.

On my case, got the SD card instantly mounted and available on the files explorer.

After that, use the Disks utility, remove all partitions and format with full erasing. This action is mandatory for later usage. Strangely, when writing datas to the SD with other devices, the issue was coming back again.

Possible causes?

https://www.bunniestudios.com/blog/?page_id=1022

https://www.youtube.com/watch?v=nuruzFqMgIw

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.