0

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.

orb
  • 1
  • 2

1 Answers1

3

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.

  • 3
    you might want to edit the important parts of the blogpost in your own words into your answer, so the answer stays valid when the link does not work anymore. – Dennis Nolte Oct 08 '15 at 07:54
  • 1
    I added a summary of the blog post, if you disagree with my edit feel free to roll back. – Reaces Oct 08 '15 at 08:03
  • It is not on NFS, and indeed i have already shown the result of `fuser -u ``find trash`` ` which includes the result of `fuser -u trash/src/tob` and showing there is no process inhibit the deletion. – orb Oct 09 '15 at 02:16
  • Tried rebooting or going to a lower runlevel? Minimizing the number of active daemons. – Anders Olsson Oct 09 '15 at 09:26
  • Yup, and they all fail me :( – orb Oct 18 '15 at 01:38
  • Maybe you could monitor who's accessing the file: http://serverfault.com/questions/320716/find-out-which-process-is-changing-a-file , either using the 'auditd' package, as in the link. Or using LoggedFS for FUSE (which should work on Solaris): http://loggedfs.sourceforge.net/ . A third option with be to look at who has inotify (Solaris equivalent) watches set up against this file, but I would try the monitoring approach first. – Anders Olsson Oct 19 '15 at 05:56