TestDisk - getting Structure: Bad when trying to restore partition table

How to use TestDisk to recover lost partition
Forum rules
When asking for technical support:
- Search for posts on the same topic before posting a new question.
- Give clear, specific information in the title of your post.
- Include as many details as you can, MOST POSTS WILL GET ONLY ONE OR TWO ANSWERS.
- Post a follow up with a "Thank you" or "This worked!"
- When you learn something, use that knowledge to HELP ANOTHER USER LATER.
Before posting, please read https://www.cgsecurity.org/testdisk.pdf
Locked
Message
Author
bluetiger9
Posts: 1
Joined: 14 May 2016, 14:12

TestDisk - getting Structure: Bad when trying to restore partition table

#1 Post by bluetiger9 »

Unfortunately the Disk Management tool from Windows 7 corrupted my partition table on one of my disk, when I tried to set the active (boot) flag on a partition.

The original structure of the partitions was something like:

Code: Select all

    /dev/sdc1      100M     System Reserved (Windows 7)
    /dev/sdc2      69,9G    Windows 7
    /dev/sdc3      146,5G   NTFS data partition
    /dev/sdc4      (extended)
      /dev/sdc5    711G     ext4 data partition
      /dev/sdc6    4G       swap partition
Apparently the ext4 data partition is missing. All the other partitions are mountable/readable.

fdisk's output:

Code: Select all

    ~$ sudo fdisk -l
    ...
    Disk /dev/sdc: 931,5 GiB, 1000204886016 bytes, 1953525168 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
    Disklabel type: dos
    Disk identifier: 0x000e0e89
    
    Device     Boot      Start        End    Sectors   Size Id Type
    /dev/sdc1             2048     206847     204800   100M  7 HPFS/NTFS/exFAT
    /dev/sdc2  *        206848  146800639  146593792  69,9G  7 HPFS/NTFS/exFAT
    /dev/sdc3        146801970  454002687  307200718 146,5G  7 HPFS/NTFS/exFAT
    /dev/sdc4        454002688 1953523711 1499521024   715G  5 Extended
    /dev/sdc5       1945137152 1953523711    8386560     4G 82 Linux swap / Solaris
Currently I'm trying the restore the partition table with TestDisk, running from Ubuntu installed on an other disk.

Apparently the TestDisk founds the missing partitions, but when I'm trying to fix the missing partitions, the program shows Structure: Bad.

TestDisk after running Analyze:

Code: Select all

    TestDisk 7.0, Data Recovery Utility, April 2015
    Christophe GRENIER <grenier@cgsecurity.org>
    http://www.cgsecurity.org
    
    Disk /dev/sdc - 1000 GB / 931 GiB - CHS 121601 255 63
    Current partition structure:
         Partition                  Start        End    Size in sectors
    
     1 P HPFS - NTFS              0  32 33    12 223 19     204800
    
    Bad relative sector.
     2 * HPFS - NTFS             12 223 20  9137 233 56  146593792
    
    Bad relative sector.
     3 P HPFS - NTFS           9138   0  1 28260  91 55  307200718
     4 E extended             28260  91 56 121601  57 56 1499521024
     5 L Linux Swap           121079  47 57 121601  57 56    8386560
        
    
    >[Quick Search]  [ Backup ]
                                Try to locate partition
after running a Quick Search the missing partitions are found:

Code: Select all

    TestDisk 7.0, Data Recovery Utility, April 2015
    Christophe GRENIER <grenier@cgsecurity.org>
    http://www.cgsecurity.org
    
    Disk /dev/sdc - 1000 GB / 931 GiB - CHS 121601 255 63
         Partition               Start        End    Size in sectors
    >* HPFS - NTFS              0  32 33    12 223 19     204800
     P HPFS - NTFS             12 223 20  9137 233 56  146593792
     D HPFS - NTFS           9138   0  1 28260 254 63  307210995
     D Linux                28260 124 25 121079  47 56 1491132416 [Data]
     P Linux Swap           121079  47 57 121601  57 56    8386560 

    
    Structure: Ok.  Use Up/Down Arrow keys to select partition.
    Use Left/Right Arrow keys to CHANGE partition characteristics:
    *=Primary bootable  P=Primary  L=Logical  E=Extended  D=Deleted
    Keys A: add partition, L: load backup, T: change type, P: list files,
         Enter: to continue
    NTFS, blocksize=4096, 104 MB / 100 MiB
P: list files works as expected on all partitions. The NTFS data partition is shown as D (deleted) for some reason.

The problem is that when I change the partition characteristics to match the original structure, it complains that the structure is bad

Code: Select all

    TestDisk 7.0, Data Recovery Utility, April 2015
    Christophe GRENIER <grenier@cgsecurity.org>
    http://www.cgsecurity.org
    
    Disk /dev/sdc - 1000 GB / 931 GiB - CHS 121601 255 63
         Partition               Start        End    Size in sectors
     * HPFS - NTFS              0  32 33    12 223 19     204800
     P HPFS - NTFS             12 223 20  9137 233 56  146593792
     P HPFS - NTFS           9138   0  1 28260 254 63  307210995
     L Linux                28260 124 25 121079  47 56 1491132416 [Data]
    >L Linux Swap           121079  47 57 121601  57 56    8386560
        
    
    Structure: Bad. Use Up/Down Arrow keys to select partition.
    Use Left/Right Arrow keys to CHANGE partition characteristics:
    *=Primary bootable  P=Primary  L=Logical  E=Extended  D=Deleted
    Keys A: add partition, L: load backup, T: change type,
         Enter: to continue
    SWAP2 version 1, pagesize=4096, 4293 MB / 4095 MiB
and I cant figure out what exactly the problem is.

An idea what I'm doing wrong?

User avatar
cgrenier
Site Admin
Posts: 5432
Joined: 18 Feb 2012, 15:08
Location: Le Perreux Sur Marne, France
Contact:

Re: TestDisk - getting Structure: Bad when trying to restore partition table

#2 Post by cgrenier »

In Options, set align partition to no and try again. The partitions will not overlap and you should be able to recover them.

Locked