Hugo Asked: 2011-10-09 06:28:24 +0800 CST2011-10-09 06:28:24 +0800 CST 2011-10-09 06:28:24 +0800 CST Cannot delete folder with rm -rf. Error: device or resource busy 772 I'm trying to delete /var/www/html but I'm getting this error: rm: cannot remove `html': Device or resource busy debian directory var rm 3 Answers Voted annaken 2013-03-02T04:24:57+08:002013-03-02T04:24:57+08:00 I was having the same issue, I was trying and failing to delete /usr/local/tomcat/data with the error rm: cannot remove/usr/local/tomcat/data': Device or resource busy` until I noticed that df -h said /dev/vda3 20G 172M 20G 1% /usr/local/tomcat/data that is, I had a partition mounted to that point. Mystery solved. quanta 2011-10-09T06:42:34+08:002011-10-09T06:42:34+08:00 You can use lsof or fuser to indentify which is using this directory, something like this: # lsof +D /var/www/html user9517 2011-10-09T06:43:23+08:002011-10-09T06:43:23+08:00 It's likely that there is a process running that is using a file or files found somewhere in the tree below /var/www/html try lsof +D /var/www/html to get a list of the processes using files in the tree. Sample output below shows that a bash shell with PID 8138 is using /var/www/html/iain. COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME bash 8138 iain cwd DIR 253,0 4096 1982790 /var/www/html/iain
I was having the same issue, I was trying and failing to delete
with the error
rm: cannot remove
/usr/local/tomcat/data': Device or resource busy`until I noticed that
df -h
saidthat is, I had a partition mounted to that point. Mystery solved.
You can use
lsof
orfuser
to indentify which is using this directory, something like this:It's likely that there is a process running that is using a file or files found somewhere in the tree below
/var/www/html
try
to get a list of the processes using files in the tree. Sample output below shows that a bash shell with PID 8138 is using /var/www/html/iain.