Remote disk recovery on a VPS -- here we go!
First, try:
lsof | grep /etc/apache2
. If you see something like:
apache 1224 www-data 22r REG 8,5 1282410 1294349 /etc/apache2/sites-available/foo
you're in luck! From extundelete's website:
If you think the file may be still open by some program (for example, if it is a movie file currently being played by a movie player), and you know the filename, then first follow this procedure:
lsof | grep "/path/to/file"
progname 5559 user 22r REG 8,5 1282410 1294349 /path/to/file
Notice the number in the second column is 5559 and the number in the fourth column is 22. The command to restore that file is:
cp /proc/5559/fd/22 restored.file
If this doesn't work, well. Lots of people believe you are screwed. But I think there is hope!
Note that I rate this as a <50% chance of working, just to set expectations.
- Shut off your system ASAP.
- Make a full bit-for-bit backup of your disk image over the network.
- On a second Linux machine, do
apt-get install extundelete
. - Run extundelete on that disk image and see what you can get back.
If you can't back up your disk over the network (not enough space, no access to another Linux box) you can try booting into Linode recovery mode and attempting extundelete on the disk directly. This risks data corruption, so don't do it if you really value the disk -- or, again, back it up first.
Of course -- nagging time -- the best solution is to have backups turned on in the first place.