Link to home
Start Free TrialLog in
Avatar of djc2
djc2

asked on

recovering/finding data lost in a crash?

I'm running Linux 2.2.10 with RT-Linux.
During a data acquisition task, my computer locked up and I had to do a hard reboot. When the computer came back
up, my data file that was open and being written to during the crash, another closed datafile, and the directory containing both datafiles were missing. i.e., directory newdata, which contains the files file1.dat and file2.dat was totally missing. (My application was in the middle of writing to file2.dat when the computer crashed). If it was just file2.dat that was missing, I wouldn't be totally surprised, but the fact that the main directory itself is missing really surprises me. Is it totally gone or is there a way that I can find it?
Thanks in advance! -Dave
Avatar of mcrider
mcrider

Look in the /tmp directory... If it's not there, it's gone... Sorry!
If there is any hope, this article may help:

http://www.linuxcare.com/viewpoints/tales/09-01-99.epl

If the system has been up and running for a while, it may be gone fer good.

Feel for ya.

Rob
Avatar of djc2

ASKER

OK, no luck so far. I followed RobWMartin's suggested link. From there
I found the ext2fs undeletion mini howto (specifically, the most relevant page:  www.linuxdoc.org/HOWTO/mini/Ext2fs-Undeletion-8.html)
I followed the instructions in there about detecting recently deleted inodes.
Unfortunately, no inodes show up as deleted on my hard disk device today. But, I guess that's not really a surprise, given that I didn't actually delete a file.

A bit of new info: there was also one other file that I edited today on the same partition prior to the crash. Turns out that now that file appears as it was prior to the edits and it is timestamped Feb 3, the last time I edited it. So,
it seems that the hard disk appears exactly as it was before I did _anything_ to it today. Is it possible that it wasn't sync'ed, or that some sort of table wasn't updated (I'm totally ignorant of this stuff, so I don't know how to even describe it.) Is it possible that the changes were made to the hard disk but some sort of master record wasn't updated to indicate that?
Maybe the results of the following are relevant (/dev/hdd1 is the partition with the missing files):

[root]# e2fsck -c -f -n /dev/hdd1
e2fsck 1.12, 9-Jul-98 for EXT2 FS 0.5b, 95/08/09
Checking for bad blocks (read-only test): done
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information

/dev/hdd1: ***** FILE SYSTEM WAS MODIFIED *****
/dev/hdd1: 12423/5003712 files (2.8% non-contiguous), 1575784/5000050 blocks
 
ASKER CERTIFIED SOLUTION
Avatar of mcrider
mcrider

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I once lost two directories containing 100Mb in something like 100 files due to a power failure in the building. This data had accumulated in approx. 36 hours. Only one or two of these files where still open at the moment supreme.

How can you lose such an amount of data because of unflushed buffers? The machine is an alpha running kernel 2.0.36 with 512 MB RAM so it has the space to hold 100 MB in buffer. Still, I always thought buffers where flushed every 30 secs for data and every 5 secs for metadata.
Avatar of djc2

ASKER

mcrider, what do you suggest for a crontab entry to run SYNC?
Thanks
Well, at a minimum, I would sync the system every 5 minutes... Something like:

0,5,10,15,20,25,30,35,40,45,50,55 * * * * /bin/sync



Make sure sync is in your /bin directory... If it's not, put the correct path to the command.



Cheers!
Avatar of djc2

ASKER

mcrider, what do you suggest for a crontab entry to run SYNC?
Thanks
Avatar of djc2

ASKER

Sorry that I'm beating this into the ground, but given the vulnerability to
losing data in this way, why isn't syncing the disk run automatically on Linux systems every 5 minutes or so? Are there some negatives to doing it? Does anybody know of anywhere I can find more details on this?

Thanks,
Dave
Have you read the man page on "sync" ?  There are no negative aspect to it...

Linux doesn't come with this task running by default, but it should! I put this on every linux system I build...


Cheers!
Avatar of djc2

ASKER

OK, I'll try it out. Thanks
Thanks for the points! Glad I could help!


Cheers!