Formatted hard drive, forgot to back up a text file. How do I get it back?

I have already had the same problem before. On that occasion, I found a program that could scan my entire hard drive for string pieces so I could recover it. Unfortunately I don't remember the name of the program. It had to access the hard drive data directly, normal searches won't get any data from the hard drive before formatting.


Obviously I don’t know what program you used (was it File Scavenger?), but aside from countless data-recovery programs (for example, Recuva), I can suggest using a hex-editor like HxD or a disk-editor like DiskExpl to search the drive. You can open the drive (try opening the logical volume first and resort to physical only if needed; also select read-only) then use Ctrl+F to search for your string(s). Once you’ve found your file, export or copy the sectors to a file and trim/concatenate as needed.

Photorec has an option to search only unused clusters, however it does not have an option to search for specific strings (and it has no feasible way of searching for plain text since there is no unique signature for them).