Very odd case of TestDisk use and filesystem structure
Posted: 03 Oct 2017, 00:50
I have a bit of an unusual case that I don't think TestDisk covers currently but may be able to cover in the future possibly.
As I was trying to install a new distribution I accidentally gdisk'd /dev/sda instead of /dev/sdc and deleted all of the partitions off of my data drive. I also wrote to the device a new GPT partition table label with a 2G EFI partition and a Linux Filesystem partition that filled the rest of the disk. I later then deleted the two partitions and made an ext4 partition that filled the rest of the device. At this point forward I have done a complete dd backup of the 1.8TiB drive and am working on the backed up identical drive (also 1.8TiB). I never mkfs'ed the device so the data should all be there.
Using TestDisk, I am shown scrambled partitions like MS Dos or Mac as the Filesystem when I select Intel/PC or EFI GPT. However, when I select "None" TestDisk happily reveals to me my ext4 filesystem but 'p' shows no files due to corruption and I am also unable to write to disk due to the previous "None" option. At first I was confused but later I realized I must have formatted the Data drive with Gnome's Disk Utility and with no partitioning and just an ext4 filesystem. Successful mountings of the device itself on the superblock backups 65536, 131072, etc (but not 32768) confirm to me that this is in fact the case.
However, after mounting, while the first directory of folders exists, when I entered those directories I was given a "Structure needs cleaning" error for the majority of the files and folders. Running e2fsck with the superblock backups failed to fix the problem but left me with 29GiB of the original 1TiB of data (the folders & files without "Structure needs cleaning" errors) of the 1.8TiB drive. Lost+Found did not contain any of the remaining data either.
A friend on IRC tried reproducing my steps on his own setup and also came to the same error of "Structure needs cleaning". So far this is as far as we have got. Does anyone have any ideas on how I could salvage the rest of the data? I'll be posting our further attempts below for anyone that happens to chance upon this post in the future!
Many Thanks!
As I was trying to install a new distribution I accidentally gdisk'd /dev/sda instead of /dev/sdc and deleted all of the partitions off of my data drive. I also wrote to the device a new GPT partition table label with a 2G EFI partition and a Linux Filesystem partition that filled the rest of the disk. I later then deleted the two partitions and made an ext4 partition that filled the rest of the device. At this point forward I have done a complete dd backup of the 1.8TiB drive and am working on the backed up identical drive (also 1.8TiB). I never mkfs'ed the device so the data should all be there.
Using TestDisk, I am shown scrambled partitions like MS Dos or Mac as the Filesystem when I select Intel/PC or EFI GPT. However, when I select "None" TestDisk happily reveals to me my ext4 filesystem but 'p' shows no files due to corruption and I am also unable to write to disk due to the previous "None" option. At first I was confused but later I realized I must have formatted the Data drive with Gnome's Disk Utility and with no partitioning and just an ext4 filesystem. Successful mountings of the device itself on the superblock backups 65536, 131072, etc (but not 32768) confirm to me that this is in fact the case.
However, after mounting, while the first directory of folders exists, when I entered those directories I was given a "Structure needs cleaning" error for the majority of the files and folders. Running e2fsck with the superblock backups failed to fix the problem but left me with 29GiB of the original 1TiB of data (the folders & files without "Structure needs cleaning" errors) of the 1.8TiB drive. Lost+Found did not contain any of the remaining data either.
A friend on IRC tried reproducing my steps on his own setup and also came to the same error of "Structure needs cleaning". So far this is as far as we have got. Does anyone have any ideas on how I could salvage the rest of the data? I'll be posting our further attempts below for anyone that happens to chance upon this post in the future!
Many Thanks!