I'm trying to delete /var/www/html but I'm getting this error:
rm: cannot remove `html': Device or resource busy
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
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 said
/dev/vda3 20G 172M 20G 1% /usr/local/tomcat/data
that is, I had a partition mounted to that point. Mystery solved.
It's likely that there is a process running that is using a file or files found somewhere in the tree below
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