Removing a directory hangs

directoryfreezerm

I'm a non-root user on a shared compile server that mounts /home via NFS from some other host. I have a directory ~/a/b with lots of subdirectories c1,c2,.... I wanted to delete ~/a/b completely, and succeeded for most of the cN directories. But a few (say c1) are completely inaccessible: I can execute them (i.e. cd into them) but neither list (ls) let alone remove them. If I say rm -rf ~/a/b/c1, the process hangs in a D state.

What can I do as a non-root user to get rid of ~/a/b?


Update: I just ssh'd to the file-server (to rule out NFS) and I cannot perform the operation there either, so this doesn't seem to be an NFS problem after all. However, why does the kernel refuse to remove a directory?

Best Answer

Removing a file or directory is an atomic operation requiring one system call, so if the rm command hangs, it's because the kernel is stuck. On an NFS filesystem, this can be (and usually is) due to the server not responding. On a local filesystem, this can be (and usually is) due to a hardware failure. Your disk is probably failing; the kernel logs would confirm that.

Related Question