You are not logged in.

#1 2017-02-15 15:47:42

hlechner
Member
Registered: 2017-02-15
Posts: 8

How to repair a partition table after wrongly saved by testdisk?

Hello all,

I do have a 3TB HDD on my Arch linux for some years now (maybe 2 or 3 years) which is divided in three partitions:
- PTR 1 (EXT4)
- PTR 2 (EXT4)
- PTR 3 (NTFS)

The system itself run outside of this HDD, the partition 1 (PTR 1) was corrupted somehow and I tried to recover the partition, it seems to be badblock at first but I couldn't repair it, so I've tested the TestDisk to re-find the partition.

However in the process I've made a big mistake of not take all attention on the process, by using too many tabs on terminal and accidentally found and saved the partitions however it was not exactly was it suppose to be, then it make the "PTR 2" and "PTR 3" unavailable.

But due to the fact that I had the partitions already mounted I still have access to it normally, but if do reboot or umount it, i'll gonna lose the access to the filesystem.

Here the output of df (of these partitions):

/dev/sdc2       1.2T  937G  165G  86% /run/media/hlechner/PTR2
/dev/sdc3       684G   76G  609G  12% /run/media/hlechner/PTR3

Result of gparted for example:
https://cloud.githubusercontent.com/ass … 558192.png
Hitting Ignore:
https://cloud.githubusercontent.com/ass … 6eb5b4.png
Hitting ignore again:
https://cloud.githubusercontent.com/ass … f8b5cd.png

As you can see the partitions are different sizes now, and do have two "unallocated" which doesn't have before.

What TestDisk found:

TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Disk /dev/sdc - 3000 GB / 2794 GiB - CHS 364801 255 63
     Partition               Start        End    Size in sectors
>* Linux                    0   1  1 121575 254 63 1953118377 [PTR1]
 P Linux                121602 225 32 275563 200 29 2473381888 [PTR2]
 P HPFS - NTFS          275563 200 30 364801  66  1 1433600000

The result of saving it is what gparted shows in the images above.

So, the important to me now is to repair the two partitions that I had working before (PTR 2 and 3) that I probably gonna lose if I reboot the system.

What do you guys recommend me to do to repair it?

Thanks

Last edited by jasonwryan (2017-02-15 17:10:44)

Offline

#2 2017-02-15 17:11:15

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: How to repair a partition table after wrongly saved by testdisk?

Read the Code of Conduct and only post thumbnails http://wiki.archlinux.org/index.php/Cod … s_and_code


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2017-02-15 18:55:07

shulamy
Member
From: israel
Registered: 2010-09-11
Posts: 452

Re: How to repair a partition table after wrongly saved by testdisk?

what testdisk find if you run it again with deeper search ?

ezik

Offline

#4 2017-02-15 22:55:49

hlechner
Member
Registered: 2017-02-15
Posts: 8

Re: How to repair a partition table after wrongly saved by testdisk?

shulamy wrote:

what testdisk find if you run it again with deeper search ?

ezik

It take a very long time due to HDD speed and the size of it, but unfortunately it find a worst scenario than the quick search with more partitions.


Edit:

Adding some information that maybe is useful:

fdisk:

# fdisk -l /dev/sdc
Disk /dev/sdc: 2.7 TiB, 3000592982016 bytes, 5860533168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot      Start        End    Sectors   Size Id Type
/dev/sdc1  *            63 1953118439 1953118377 931.3G 83 Linux
/dev/sdc2       1953550336 4426932223 2473381888   1.2T 83 Linux
/dev/sdc3       4294967295 5728567294 1433600000 683.6G  7 HPFS/NTFS/exFAT

Partition 1 does not start on physical sector boundary.
Partition 3 does not start on physical sector boundary.

cfdisk:

                                                                                                                Disk: /dev/sdc
                                                                                            Size: 2.7 TiB, 3000592982016 bytes, 5860533168 sectors
                                                                                                      Label: dos, identifier: 0x00000000

    Device                        Boot                                            Start                           End                       Sectors                      Size                    Id Type
>>  /dev/sdc1                     *                                                  63                    1953118439                    1953118377                    931.3G                    83 Linux                                     
    Free space                                                               1953120256                    1953550335                        430080                      210M
    /dev/sdc2                                                                1953550336                    4426932223                    2473381888                      1.2T                    83 Linux
    /dev/sdc3                                                                4294967295                    5728567294                    1433600000                    683.6G                     7 HPFS/NTFS/exFAT
    Free space                                                               5728567296                    5860533167                     131965872                     62.9G
The size of this disk is 2.7 TiB (3000592982016 bytes). DOS partition table format can not be used on drives for volumes larger than 2199023255040 bytes for 512-byte sectors. Use GUID partition table format (GPT).

Last edited by hlechner (2017-02-16 14:32:26)

Offline

Board footer

Powered by FluxBB