Fast undelete for every linux filesystem

written by Admin

Posted on 2015-07-10


Panic! ...I have deleted a very important file on a filesystem that I cannot unmount or put in readonly mode (or formatted with a strange filesystem, without an undelete utility).


If a process opened the deleted file, you can use this procedure to immediately recover every byte of the deleted file.

First, check if some process has a file-descriptor pointing to the deleted file:
# lsof | grep "/directory/file"
processname 33322 user 9r REG 8,5 1293520 1299346 /directory/file

Good! can start the recovery process (it is very fast because you copy the file from memory):
# cp /proc/33322/fd/9 /directory/recovered-file-name

P.S. you use the informations returned from the first command to generate the second.

Please tell me if it can recover files also on Mac.



Leave a Comment:



We need collaboration and a real boost from our community: write us an email for every trick you find!

This website is a sysadmin swiss-knife for every-day Windows, Linux and Mac administration and troubleshooting

Our database grows if YOU send us your tips and trick as soon as you find them every day!