Cannot remove an empty folder with no user using by rm -rf

rmsolaris

This is a solaris machine (unix)

I have a folder contains some subfolders, but there is no file in it.

root # ls -al `find trash`
trash:
total 6
drwxrwxrwx   3 root     root         512 Aug  6 07:37 .
drwxr-xr-x   9 ----     ----        1024 Oct  8 06:20 ..
drwxrwxrwx   3 root     root         512 Aug  6 07:37 src

trash/src:
total 6
drwxrwxrwx   3 root     root         512 Aug  6 07:37 .
drwxrwxrwx   3 root     root         512 Aug  6 07:37 ..
drwxrwxrwx   3 root     root         512 Aug  6 07:37 tob

trash/src/tob:
total 4
drwxrwxrwx   3 root     root         512 Aug  6 07:37 .
drwxrwxrwx   3 root     root         512 Aug  6 07:37 ..

I try to remove it but fail:

root # rm -rf trash
rm: Unable to remove directory trash/src/tob: File exists
rm: Unable to remove directory trash/src: File exists
rm: Unable to remove directory trash: File exists

I try to look for mount point but fail:

root # mount | grep `pwd`

I try to look for process running with pwd in it but fail:

root # fuser -u `find trash`
trash:
trash/src:
trash/src/tob:

Is there any clue how should i delete this folder, without formatting the disk.
I'm still a newbie to unix, so please tell me also the command if you are looking for more information.

Best Answer

Probably some process is recreating the tob file directly after rm deletes it. Here's a blog post on handling it.

Removing this file only replaces it with another. There are two solutions: manually delete the file on the NFS server, or (if you don't have that type of access) kill its process.

If the file is not on NFS, the advise to check which process has a handle to the file, and kill it still is applicable. Check with:

fuser -u <file>

After killing the process you should be able to delete the directory.