Rm of Linux rm-rf: cannot remove `linux': Device or resource busy
On January 19, 2017, a psychic event occurred while cleaning up a directory on the linux server, and there was something that rm-rf could not delete, excluding the occupation of user processes, but in the end I deleted it.
The process is as follows:
[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 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 /] #
It seems that the storage directory mounted by the network share cannot be emptied using rm-rf. If Linux really needs to delete the local mount point, you can unmount it first, and then delete the local mount point:
[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 /] #