Linux data-recovery tools


Caine

Hardcore Member
Joined
Jun 5, 2008
Messages
4,136
Location
Netherlands
My main bootable harddrive of my desktop just went fubar. There are were some source code folders, savegames and documents on there which I would REALLY like to have back.


Does anyone have experience with data recovery on Linux? In particular, what tools can you recommend?


Not entirely sure what went wrong, but it seems the filesystem has gotten corrupted.
 
Hmm, here's some general info from our good friends at linux.com: https://www.linux.com/news/enterprise/storage/8257-how-to-recover-lost-files-after-you-accidentally-wipe-your-hard-drive. Though you haven't wiped the drive, the data recovery tools should be the same.


Have you had a chance to poke around at it from a LiveCD yet? Obviously things like your MBR being lost shouldn't affect anything else, and I've rarely heard of an ext partition going bad, but if it's simply a failing hard drive, you may be out of luck.
 
Hmm, here's some general info from our good friends at linux.com: https://www.linux.co...your-hard-drive. Though you haven't wiped the drive, the data recovery tools should be the same.


Have you had a chance to poke around at it from a LiveCD yet? Obviously things like your MBR being lost shouldn't affect anything else, and I've rarely heard of an ext partition going bad, but if it's simply a failing hard drive, you may be out of luck.
I've booted to a livecd and most directories have become unaccessible. I copied most data of the readable directories manually, but it's the unreadable ones which contain the more important data, unfortunately. I probably need to run some low level file-detection tool at it hoping to recover some of that content.


I'm already looking at that PhotoRec tool, but it seems to attempt to copy over my entire drive (which I have no space for at the moment). The only content I care about is in the home directories of two user accounts. I can normally navigate to those, but not to most of their subdirectories.
 
Ah, alright. Sounds like a corrupted filesystem (like you originally assumed) then. :(


Just make sure not to write anything to your bad filesystem; since most file recovery things read the blocks directly and try to identify files from those, writing data now may overwrite some of that data since it's not being officially pointed to by a file anymore. If that sentence made any sense, ha.


Have you tried a fsck?
 
Ah, alright. Sounds like a corrupted filesystem (like you originally assumed) then. :(


Just make sure not to write anything to your bad filesystem; since most file recovery things read the blocks directly and try to identify files from those, writing data now may overwrite some of that data since it's not being officially pointed to by a file anymore. If that sentence made any sense, ha.


Have you tried a fsck?
That sentence makes perfect sense. I did a fsck and it fixed some errors, though now I kinda feel like it might have been better if I didn't run it. It seems that PhotoRec can find files. So I'm going to recover 1TB of data now .... That will take a while.


Not looking forward to sorting through 1TB of unstructured files :(
 
Running any tools that write to the filesystem generally is a VERY bad idea on a broken harddisk!


Always make an image of the full harddisk and work with that...


Pretty hard to recover something now I fear :/
 
Running any tools that write to the filesystem generally is a VERY bad idea on a broken harddisk!


Always make an image of the full harddisk and work with that...


Pretty hard to recover something now I fear :/
Yeah, I'm assuming I lost everything. Anything I can get back is nice. The loss of my source-code and notes is bothering me the most.


I'm not even sure the disk is broken. At first I thought that just the partition table or something like that was screwed up. However, it turns out to be more serious than that. PhotoRec recovered about 40GB of files before it seemed to get stuck in a loop, so now I'm making an image with ddrescue.


That should indeed have been my first course of action, but I underestimated the severity. Still not sure what exactly happened and why.


Oh well, we will see... :unsure: :(
 
Hmm, more odd. I think ext4 was a bit new/unstable in 9.10, but they had it straitened out by 10.04.


Might just have to chalk it up to bad luck. :unsure:
Yes, I intentionally skipped using ext4 at version 9.10, but it seemed ok around 10.04. ddrescue has copied about 80GB and so far reported no errors whatsoever. So it seems the disk itself is fine, which puzzles me even more.


I will probably end up with a good disk (which is rather hard to trust now) and no data :p


Oh man, this is so ******-up.
 
ext4magic is a GREAT app to use. I was able to recover a lot of stuff, but you have a limited window before the filesystem overwrites the inodes.
 
Have you used smartctl -a /dev/sdX (from smartmontools)? It should report if the drive itself is broken.
 
Have you used smartctl -a /dev/sdX (from smartmontools)? It should report if the drive itself is broken.
I haven't tried that yet. I have created an image of the disks content using gnu ddrescue which succeeded without any read errors. Right now I'm running PhotoRec hoping to find back some of my more important files. It is spitting out files like crazy, but I haven't seen what I'm looking for yet.


Given the fact that we are talking about a partition of roughly 1 TB, it's like looking for a needle in a haystack. Glad to have the shell and tools like grep :)


[edit]Bingo! Starting to find some of the stuff I'm looking for. :) [/edit]
 
Last edited by a moderator:
O_0


I just ran fsck again since I now have an image of the content and let it fix some more stuff which frightened me before.


It looks like it actually managed to restore most of the filesystem! :D


Backing up everything now that should have been backed up months ago. Thanks for all the good advice guys, this might just end a whole lot better than I hoped.
 
Back
Top