Linux rm -rf 之rm: cannot remove `linux': Device or resource busy
2017年1月19日,清理linux
服務器上一目錄時出現靈異事件,居然有rm -rf不能刪除的東西,排除用戶進程占用,但是最后我還是把它給刪掉了。
處理過程如下:
[oracle@se31 ~]$ uname -a
Linux se31 3.8.13-44.1.1.el6uek.x86_64 #2 SMP Wed Sep 10 06:10:25 PDT 2014 x86_64 x86_64 x86_64 GNU/Linux
[oracle@se31 ~]$
[root@se31 /]# ls -l
total 148
dr-xr-xr-x. 2 root root 4096 Jul 1 2016 bin
dr-xr-xr-x. 5 root root 4096 Dec 31 2015 boot
drwxr-xr-x. 2 root root 4096 Oct 15 2014 cgroup
drwxr-xr-x 17 root root 3940 Nov 5 13:29 dev
drwxr-xr-x. 121 root root 12288 Jan 19 09:18 etc
drwxr-xr-x. 9 root root 4096 Dec 12 09:14 home
drwxr-xr-x. 13 root root 4096 Jul 1 2016 lib
dr-xr-xr-x. 9 root root 12288 Jul 1 2016 lib64
drwx------. 2 root root 16384 Dec 31 2015 lost+found
drwxr-xr-x. 2 root root 4096 Nov 1 2011 media
drwxr-xr-x 2 root root 0 Nov 5 13:13 misc
drwxr-xr-x. 2 root root 4096 Nov 1 2011 mnt
drwxr-xr-x 2 root root 0 Nov 5 13:13 net
drwxr-xr-x. 7 root root 4096 Nov 18 17:32 opt
drwxrwxr-x 3 ora12c oinstall 4096 Dec 12 09:33 ora12c
drwxr-xr-x. 7 oracle dba 4096 Jan 20 2016 oradata1
dr-xr-xr-x 514 root root 0 Nov 5 13:13 proc
drwxr-xr-x 2 oracle oinstall 20480 Jan 18 21:03 rman_back
dr-xr-x---. 21 root root 4096 Jan 19 09:10 root
dr-xr-xr-x. 2 root root 12288 Jul 1 2016 sbin
drwxr-xr-x. 2 root root 4096 Dec 31 2015 selinux
drwxr-xr-x. 2 root root 4096 Nov 1 2011 srv
dr-xr-xr-x 13 root root 0 Nov 5 13:13 sys
drwxrwxrwt. 10 root root 4096 Jan 19 04:08 tmp
drwxrwxr-x. 3 grid oinstall 4096 Dec 31 2015 u01
drwxrwxr-x 3 oracle10g oinstall 4096 Jan 4 2016 u02
drwxr-xr-x. 13 root root 4096 Dec 31 2015 usr
drwxr-xr-x. 20 root root 4096 Dec 31 2015 var
drwxr-xr-x 3 oracle oinstall 4096 Jan 19 09:18 win
[root@se31 /]#
[root@se31 /]# rm -rf win
rm: cannot remove `win/linux': Device or resource busy
[root@se31 /]#
[root@se31 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sdb3 974G 295G 630G 32% /
tmpfs 48G 21G 27G 43% /dev/shm
/dev/sdb1 772M 62M 654M 9% /boot
/dev/sda1 5.0T 4.5T 265G 95% /oradata1
//10.117.196.52/orabak
239G 206G 34G 87% /win/linux
[root@se31 /]#
看來網絡共享掛載的存儲目錄無法使用rm -rf 清空,如果Linux確實需要刪除本地掛載點,可以先卸載,然后刪除本地的掛載點:
[root@se31 /]# umount /win/linux
[root@se31 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sdb3 974G 295G 630G 32% /
tmpfs 48G 21G 27G 43% /dev/shm
/dev/sdb1 772M 62M 654M 9% /boot
/dev/sda1 5.0T 4.5T 265G 95% /oradata1
[root@se31 /]# rm -rf win
[root@se31 /]# ls -l
total 144
dr-xr-xr-x. 2 root root 4096 Jul 1 2016 bin
dr-xr-xr-x. 5 root root 4096 Dec 31 2015 boot
drwxr-xr-x. 2 root root 4096 Oct 15 2014 cgroup
drwxr-xr-x 17 root root 3940 Nov 5 13:29 dev
drwxr-xr-x. 121 root root 12288 Jan 19 09:30 etc
drwxr-xr-x. 9 root root 4096 Dec 12 09:14 home
drwxr-xr-x. 13 root root 4096 Jul 1 2016 lib
dr-xr-xr-x. 9 root root 12288 Jul 1 2016 lib64
drwx------. 2 root root 16384 Dec 31 2015 lost+found
drwxr-xr-x. 2 root root 4096 Nov 1 2011 media
drwxr-xr-x 2 root root 0 Nov 5 13:13 misc
drwxr-xr-x. 2 root root 4096 Nov 1 2011 mnt
drwxr-xr-x 2 root root 0 Nov 5 13:13 net
drwxr-xr-x. 7 root root 4096 Nov 18 17:32 opt
drwxrwxr-x 3 ora12c oinstall 4096 Dec 12 09:33 ora12c
drwxr-xr-x. 7 oracle dba 4096 Jan 20 2016 oradata1
dr-xr-xr-x 553 root root 0 Nov 5 13:13 proc
drwxr-xr-x 2 oracle oinstall 20480 Jan 18 21:03 rman_back
dr-xr-x---. 21 root root 4096 Jan 19 09:10 root
dr-xr-xr-x. 2 root root 12288 Jul 1 2016 sbin
drwxr-xr-x. 2 root root 4096 Dec 31 2015 selinux
drwxr-xr-x. 2 root root 4096 Nov 1 2011 srv
dr-xr-xr-x 13 root root 0 Nov 5 13:13 sys
drwxrwxrwt. 10 root root 4096 Jan 19 04:08 tmp
drwxrwxr-x. 3 grid oinstall 4096 Dec 31 2015 u01
drwxrwxr-x 3 oracle10g oinstall 4096 Jan 4 2016 u02
drwxr-xr-x. 13 root root 4096 Dec 31 2015 usr
drwxr-xr-x. 20 root root 4096 Dec 31 2015 var
[root@se31 /]#