Can I recover lost data from an .mdf or .ldf file?

How do I recover the data from a text file showing up as empty in Windows?

  • I just lost a month's worth of journal entries in a locally saved plaintext file. Is there any way to get them back? Went out last night, and left my computer on as usual, with Firefox, Gaim, and a http://jsimlo.sk/notepad/ window open with a file containing what I'd written in my journal for October. This morning, I find Firefox has gone black and frozen (the Reminder extension has been acting funny lately), and Gaim's System Tray icon is looking weird. I close Firefox, and everything else seems to be fine. So I write a little more in the TED Notepad file about last night and press Ctrl-S to save it. I get an error dialog that says "Cannot save to 200510.txt!" which is, obviously, unexpected and unusual. So I try it again, and get the same error. Not wanting to lose what I just wrote, I opened another Notepad window, copied and pasted the new entry, and saved that without any problem. Then I tried closing the original window, got the usual Save/Don't Save/Cancel dialog, and picked Save again. Same error as before. So I tried closing the window and not saving, which worked. But then when I went into Recent Documents to re-open that file, I got an empty file! The details for the file now say it contains "0 bytes". The file with the new entry is fine. I have an idea of what may have happened, but that idea doesn't make me feel optimistic about the prospects for recovering this data. Is the data still in my D: drive somewhere? Is there any way to get it back? Even just being able to read it would be constructive; if all else fails, I could write it all down on paper and then retype it. I just don't want to lose a month of personal reflection because of this. This computer runs Windows ME. The data in question, along with most of my data, is on a physically separate internal hard drive from the system disk (both FAT32, IIRC), so I'm pretty sure web browsing won't overwrite the data formerly known as 200510.txt. Unfortunately, I don't think an undelete utility would work, because the problem isn't that the filesystem has marked the file as deleted -- it's that it has marked the file as empty. Any ideas would be most appreciated. On preview: I have no money to spend on software. Seriously, it's going to be hard paying utilities next month. So please keep that in mind. Oh, and I do have another computer with Knoppix installed, if there's a solution that involves Linux; but I don't know jack about Linux, so that solution would have to be laid out in painstaking newbie detail. Thanks.

  • Answer:

    The only thing I can think of is using a low-level disk utility that examines the contents of the harddrive regardless of what the filesystem says is there. I vaguely remember of having heard of such a program, but I must admit I'm really not sure such a thing exists. Undelete seems out of the question for the reasons OP stated (i.e. the original file didn't really get deleted).

skoosh at Ask.Metafilter.Com Visit the source

Was this solution helpful to you?

Other answers

You need an old style undelete utility that can directly read and modify the FAT table. IF you've not used the disk, the data may be in sectors marked deleted but not yet overwritten. Google for file undelete utilities, there will be a bunch of free ones, of varying quality.

orthogonality

Have you restarted the computer yet? The text might still be in the clipboard.

sbutler

If you haven't rebooted the computer (I assume you haven't, since you say you can still write it all down on paper) the easiest thing to do would be to just paste the entries into an email addressed to yourself.

Ryvar

One other thing - make sure you've either got Outlook/Thunderbird setup so they leave a copy of the email on your mail server, or mail it to a Yahoo/Gmail/whatever account.

Ryvar

http://www.theabsolute.net/sware/dskinv.html is what I was thinking about: Disk Investigator helps you to discover all that is hidden on your computer hard disk. It can also help you to recover lost data. Display the true drive contents by bypassing the operating system and directly reading the raw drive sectors. View and search raw directories, files, clusters, and system sectors. Verify the effectiveness of file and disk wiping programs. Undelete previously deleted files.

CKZ

I've restarted three times now, once after dragging the file into the Recycle Bin and then restoring it back, then again in safe mode to run ScanDisk (there was a boot sector that I repaired). Plus, I only copied and pasted the new entry, not all the old entries. I'm not sure if orthogonality and CKZ aren't recommending the same thing, but I'll look for one of these old-school disk utilities anyway. Is there any way to tell which ones do or don't directly read the allocation table in advance? Any names of disk utilities that fit the bill?

skoosh

So just to clarify, you did manage to save the second copy of the file in notepad? Which one has zero bytes, 200510.txt, or the second copy? As far as I know, if it has been replaced with a zero byte file, an undelete utility will not help, as there isnt anything to unerase. In DOS (and I assume it's the same in WinME, as it uses the same filesystem), when a file is deleted, the file information is still in the directory listing, but the first letter is overwritten with a non-ascii symbol to indicate that it is deleted. This can be used to find the sectors on the disk which correspond to the file. If the file still exists, but has no content, this doesnt apply, and can't be undeleted by the usual undelete utilities. If it is a text file, and it hasnt been overwritten, I think the only way to get it back is to use a raw disk editor, and search the hard disk for text that is unique to the file that you want to recover. I've done this before successfully with Norton Disk Editor. You will probably find parts of the file, and possibly junk as well, but as it is only text, it should be editable back into something resembling the original. Searching around for 'Disk Editor', I found a few free/free trial equivalents, listed below. Note I havent tried these, and can't vouch for these. Could wipe your hard disk, etc etc... (On preview, you could try GetDataBack from runtime.org first. There's a free trial, you might have to pay to restore it, but will a least allow you to preview (and possibly cut/paste) any files that can be undeleted.) http://www.runtime.org/diskexpl.htm http://sourceforge.net/projects/diskeditor

Boobus Tuber

Also, it might go without saying, but don't write anything to the drive that the file is on..

Boobus Tuber

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.