Linux file deleted recovery

前端 未结 3 1467
时光说笑
时光说笑 2021-02-09 02:17

Is there a way to create a file in Linux that link to a specific iNode? Take this scenario: There is a file that is in course of writing (a log maybe) and the specific file is d

3条回答
  •  醉话见心
    2021-02-09 03:06

    You can use lsof to recover deleted files (sometimes)...

    > lsof | grep testing.txt
    less    4607    juliet  4r  REG 254,4   21  
           8880214 /home/juliet/testing.txt (deleted)
    

    Be sure to read the original article for full details before attempting this, unless you're a Maveric like me.

    > ls -l /proc/4607/fd/4
    lr-x------ 1 juliet juliet 64 Apr  7 03:19 
             /proc/4607/fd/4 -> /home/juliet/testing.txt (deleted)
    > cp /proc/4607/fd/4 testing.txt.bk
    

    http://www.linuxplanet.com/linuxplanet/tips/6767/1

    Enjoy

提交回复
热议问题