You are not logged in.

#1 2011-03-22 21:22:10

test1000
Member
Registered: 2005-04-03
Posts: 834

Extracting certain files from faulty HD

Hi, i'm trying to recover /home/kris/.zsnes/Legend of Zelda, The - A Link to the Past (U) [!].srm and (i guess, if i need it) /home/kris/.zsnes/Legend of Zelda, The - A Link to the Past (U) [!].zst first and foremost. They are zsnes and snes9x save files. I'm trying to recover them from a faulty HD which is an ext3 and is LVM2 formatted.

I can't mount the disk, nor does testdisk or photorec work(they both hang). SO since this is such a messed up drive i figured i would try to read the disk in hex and only extract the pieces i need to. I know "where" they are on the disk, as mentioned above, but i don't know where to go from here. I suppose to exert the disk as little as possible(to avoid more mucking up) i need to:

1. find out where the files are physically stored(hopefully they are in the same block/sector <- i don't really understand what this means _exactly_..)
2. read as little as possible/take as little a risk as possible and only extract exactly the bits needed and store them on the new HD as files.

But... HOW would i go about doing this, which programs would i use(the best would be if i could script it i suppose, as then i would only access exactly the portions i needed?) AND is there a better way? I'm thinking i could try ddrescue, but then i'd need to find out where these files are on disk first..


KISS = "It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience." - Albert Einstein

Offline

#2 2011-03-24 01:09:01

hbekel
Member
Registered: 2008-10-04
Posts: 311

Re: Extracting certain files from faulty HD

The first thing I'd do would be to try and get an image of the disk and/or partitions in question to work on. If you can still read the raw disk contents, you could at least be sure that the drive itself is ok and it's "just" the filesystem that is messed up.

Have you tried extundelete? I'm not sure at all whether it is the right tool, since it's primary purpose is to undelete files, but if the journal is still intact there might be a chance to get at those files. In any case, the page above contains some links with general info about ext filesystems that might be of interest to you. Afaik if the files are smaller than the block size you supplied when creating the fs (default is 4096 bytes) then each will reside in single block, e.g. a consequitive area on the raw disk. Not sure if lvm complicates things in this regard, though...

I have no idea if this is the right direction at all, but this is where i'd start looking.

Offline

#3 2011-03-25 18:32:37

redden0t8
Member
Registered: 2011-01-27
Posts: 42

Re: Extracting certain files from faulty HD

If you can't find any utilities that work, try this:

1. Create a few new .srm files, open them in a hex editor, and figure out what the header looks like (binary files usually start with something fairly identifiable so that e.g. zsnes knows it's looking at a proper .srm file).  If you're even luckier, the file might even contain the ROM name or say, the name you gave your character, as plain text.

2. Open the raw disk in a hex editor, and search for the header you figured out in step 1.

3. Copy out the data starting at the point you figured out in step 2, for the length an srm file is for a Legend of Zelda save (look at the files you made in step 1).

4. If you're lucky, the first one will work.  If not, rinse and repeat.  Depending on how much you figured out in step 1, you may end up having to copy over every .srm file to find the right one.  If you're unlucky, the file you're looking for could be corrupted, or if it's bigger than the block size of the drive (like hbekel said I think 4kB is a pretty typical value), it may be stored on non-consecutive blocks, in which case you're out of luck short of finding a tool that works.

I don't have any experience with hex editors in linux, although at first glance "hexedit" seems up to the task and is in the arch repos.

EDIT: I second hbekel's advice to image the drive ASAP in case it's a hardware failure.

Last edited by redden0t8 (2011-03-25 18:37:44)

Offline

#4 2011-03-28 15:09:42

perbh
Member
From: Republic of Texas
Registered: 2005-03-04
Posts: 765

Re: Extracting certain files from faulty HD

Just my 2c-worth on recovering ...
The worst (generally) you can do is to mount the device. If the filesystem is borked, it will try to recover and get itself in a hopeless mess.
As a couple of posters have indicated allready - get another hd (or a usb-drive) and make a raw copy of the device to a file on the receiving hd/usb and then work on that.

Oh and btw - that is the very reason I dont use ldm!

Last edited by perbh (2011-03-28 15:10:39)

Offline

Board footer

Powered by FluxBB