Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm trying to delete /var/www/html but I'm getting this error:

rm: cannot remove `html': Device or resource busy
share|improve this question
Long shot, but do you have /var/www/html configured as a mount point for another filesystem? –  jgoldschrafe Oct 8 '11 at 14:58

4 Answers 4

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.

share|improve this answer

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

# lsof +D /var/www/html
share|improve this answer

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


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.

bash    8138 iain  cwd    DIR  253,0 4096 1982790 /var/www/html/iain
share|improve this answer
Nothing shows up. No errors or anything. –  Hugo Oct 8 '11 at 14:45
try /sbin/fuser -m /var/www/html –  Iain Oct 8 '11 at 14:58

Here is the solution:

  1. go into the directory and type ls -a
  2. you will find .xyz (dot file) file
  3. vi .xyz and look into what is the content of the file
  4. ps -ef |grep username
  5. you will see the .xyz content in the 8th column (last row)
  6. kill -9 <job ids> here <job ids> means 2nd column of corresponding error caused content in the 8th column
  7. now try to delete the folder or file.

You can overcome this error.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.