Cannot delete folder with rm -rf. Error: device or resource busy

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.


You can use lsof or fuser to indentify which is using this directory, something like this:

# lsof +D /var/www/html