Path: utzoo!mnetor!uunet!lll-winken!csustan!polyslo!sdejarne
From: sdejarne@polyslo.UUCP (Steve DeJarnett)
Newsgroups: comp.unix.wizards
Subject: Re: `rm -rf dir' fails with Directory not empty
Message-ID: <884@polyslo.UUCP>
Date: 13 Dec 87 20:01:46 GMT
References: <125@Edvax.UUCP> <1430@cuuxb.ATT.COM>
Reply-To: sdejarne@polyslo.UUCP (Steve DeJarnett)
Organization: Cal Poly State Univ,CSC Dept,San Luis Obispo,CA 93407
Lines: 36
Keywords: screwy files, bad inodes
Summary: It is not necessarily because of . files


	I had a problem like this on an HP-9000 system recently.  The problem
was that there was a file in the directory that was undeletable.  rm -rf didn't
catch it, but things like find(1) and ls(1) did.  fsck(1m) didn't notice it, so
basically I was out of luck.  What I ended up doing was emptying the directory,
then doing an "od -dc ." which showed me the files in the directory and their
corresponding inode numbers.  Then I used fsdb(1m) to change the type of the
inode of the file that couldn't be deleted to a type that signalled that the 
inode was unused.  fsck(1m) then caught it and removed it (when I told it to).
I'm not sure if that's you're problem, but it's worth a try.  BE CAREFUL USING
fsdb(1m)!!!!!!!  Our version presumed that you knew what you were doing, so it
didn't check anything that you did.  It also did it in real-time (no undo 
features).  

	Also, in response to another follow-up posted by someone at AT&T, I
think that "rm -rf" should get rid of any . files in the directory.  That is
kind of what the purpose of "rm -rf" is (i.e. "Get rid of every file in all 
directories below the named one, including the named one").  The only problem
I ever ran into with that was not having write permissions on some of the 
subdirectories below the one being removed.  If you don't have write permission
on the directory, rm won't remove it, and therefore, "rm -rf" will bomb when
it sees that there is still an entry (a directory that isn't empty, or that 
can't be removed due to not having write permission) along the path.  

	Make sure your permissions are right (although, if you are root, it
shouldn't matter).

	Good luck.


-------------------------------------------------------------------------------
| Steve DeJarnett		|    ...!ihnp4!csun!polyslo!sdejarne	      |
| Computer Systems Lab		|    ...!{csustan,csun,sdsu}!polyslo!sdejarne |
| Cal Poly State Univ		|    ...!ucbvax!voder!polyslo!sdejarne	      |
| San Luis Obispo, CA  93407	|    					      |
-------------------------------------------------------------------------------
#include