文件当前正在被进程使用
使用 lsof1
2
3
4
5
6
7
8
9
10
11
12
13
14[root@instance-2 ~]# rm -rf test.txt
[root@instance-2 ~]# lsof |grep test.txt
tail 31397 root 3r REG 8,2 5 50674099 /root/test.txt (deleted)
[root@instance-2 ~]# cd /proc/31397/fd
[root@instance-2 fd]# ls -l
total 0
lrwx------ 1 root root 64 Feb 21 15:42 0 -> /dev/pts/0
lrwx------ 1 root root 64 Feb 21 15:42 1 -> /dev/pts/0
lrwx------ 1 root root 64 Feb 21 15:42 2 -> /dev/pts/0
lr-x------ 1 root root 64 Feb 21 15:42 3 -> /root/test.txt (deleted)
lr-x------ 1 root root 64 Feb 21 15:42 4 -> anon_inode:inotify
[root@instance-2 fd]# cp 3 ~/test.txt.bak
[root@instance-2 fd]# cat ~/test.txt.bak
test
文件未被进程使用
extundelete