Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 206
  • Last Modified:

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
0
djc2
Asked:
djc2
1 Solution
 
mcriderCommented:
Look in the /tmp directory... If it's not there, it's gone... Sorry!
0
 
RobWMartinCommented:
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
0
 
djc2Author Commented:
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
 
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
mcriderCommented:
Unix systems don't write directly to the disk... They write to an image and that image is only written to the disk when a SYNC is executed.

Sorry, but you have lost your information.  If you dont already have SYNC running as a crontab entry, I suggest you do it.


Cheers!
0
 
ReinierCommented:
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.
0
 
djc2Author Commented:
mcrider, what do you suggest for a crontab entry to run SYNC?
Thanks
0
 
mcriderCommented:
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!
0
 
djc2Author Commented:
mcrider, what do you suggest for a crontab entry to run SYNC?
Thanks
0
 
djc2Author Commented:
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
0
 
mcriderCommented:
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!
0
 
djc2Author Commented:
OK, I'll try it out. Thanks
0
 
mcriderCommented:
Thanks for the points! Glad I could help!


Cheers!
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now