

So You Just Deleted Your Production Database - What Now - Garbage
http://ostatic.com/blog/so-you-just-deleted-your-production-database-what-now

======
wccrawford
Like the comments, I have my doubts about it working.

But if all the files really ARE still open, I have a question about lsof.

Couldn't you use lsof to create a hard link to the file again and save it that
way, instead of copying to a new file? It was my understand that the file is
only gone once all hard links are gone.

~~~
derobert
There unfortunately isn't a command to hardlink the file. ln will fail,
because /proc is a different filesystem:

    
    
        anthony@Zia:/proc/28590/fd$ ln 4 /tmp/bar
        ln: creating hard link `/tmp/bar' => `4': Invalid cross-device link
    

Linux's link(2) call takes path names, not file descriptors, so even a ptrace
inject into the still-running app won't help.

I don't believe its (currently) possible to re-link the file, without direct
filesystem editing.

~~~
wccrawford
Ah, thanks. Sounds like a good weekend project to see if it can be done. :)

I think I'll add it to my list in case nobody else does it.

------
petervandijck
restore from backup?

