One 1 TB external Sata drive (USB 3.0 connected, 4 primary partitions, lots of data in #4). Accidentally reformated from a NAS live system that I was reviewing (saw no clear warning that it'll format the whole drive). I could only stop the write process ASAP: morron system had already written its new partition table and a few files in its /boot. I then let the HDD "as is" till launching TestDisk.
Partition layout before (let's call it "Good"):
Code: Select all
1 P* Linux ext4 # don't care
2 P Linux swap
3 P Linux ext4 # don't care
4 P Linux XFS # has valuable data
Code: Select all
1 P Linux 0 32 33 121081 220 35 1945178112
2 E extended 121081 253 3 121601 57 56 8341506
5 L Linux Swap 121081 253 5 121601 57 56 8341504
1. To find the Good partiition layout back I did:
- Quick search; shows the Wrong layout.
- Advanced search shows the Good layout:
Code: Select all
TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org
Disk /dev/sdd - 1000 GB / 931 GiB - CHS 121601 255 63
Partition Start End Size in sectors
D Linux 0 32 33 121081 220 35 1945178112
D Linux 0 130 1 13 65 63 204813 [momboot] «- sdb1
>D Linux Swap 13 65 53 510 111 49 7987200 «- sdb2
D Linux 510 111 50 1275 84 25 12288000 [momos] «- sdb3
D Linux 1275 84 26 121601 57 56 1933035520 [momedias] «- sdb4
D Linux Swap 121081 253 5 121601 57 56 8341504
2. To restore the Good partition layout
TestDisk <p> show "fs error" (or alike) on wanted partition 4 (files from partition 3 only).
Changed partition type to reflect original partition layout:
Code: Select all
Disk /dev/sdd - 1000 GB / 931 GiB - CHS 121601 255 63
Partition Start End Size in sectors
D Linux 0 32 33 121081 220 35 1945178112
P Linux 0 130 1 13 65 63 204813 [momboot]
P Linux Swap 13 65 53 510 111 49 7987200
P Linux 510 111 50 1275 84 25 12288000 [momos]
>P Linux 1275 84 26 121601 57 56 1933035520 [momedias]
D Linux Swap 121081 253 5 121601 57 56 8341504
Code: Select all
Invalid partition structure.
Upon searching doc, forum and blogs
- It looks like Recovery_of_reformatted_partition differs from this case where a new partition table was written.
- Would Recovery Process after partition reformated apply in this case?
There cgrenier says to use advanced commands to add a new partition with specific Starting and Ending Cylinder values from our logs, and a partition type.
- MASTER NINJA blog has closest case I found atm ("UPDATE" part). Basically he suceeded to recover his Good partition layout by setting partition type correctly (*/P/L/D) and voilà! Ha, but that doesn't work for my Momentus (XFS) partition!