[comp.unix.aux] Hardlinked directories

logan@rockville.dg.com (James L. Logan) (06/28/90)

In article <7979.9006261239@tsuna.cogs.susx.ac.uk>
eddyg@cogs.sussex.ac.uk ("Edward J. Groenendaal") writes:  
# And so I'm left with two directories, both empty, which I can't
# delete!!!
# 
# Can anyone help me from this predicament???

Cd to one of the directory names that was linked and type
"ls -la".  You said the directories are empty.  How empty? If you
do not see "." and ".." listed,  

	1.  cd to the parent directory (Using a full pathname starting
	with "/" since ".." doesn't exist).
	2.  Type "ls -li" and check that the inode numbers are the same
	and that there are only 2 links (there should be).  
	3.  Use /etc/unlink to remove both directories.

otherwise if "." and ".." are listed,

	1.  cd to the previous directory.
	2.  Use /etc/unlink to remove ONE of the directories.
	3.  Use /bin/rmdir to remove the other.

-- 
James Logan                        UUCP: uunet!inpnms!logan
Data General Telecommunications    Inet: logan@rockville.dg.com
2098 Gaither Road                 Phone: (301) 590-3198
Rockville, MD 20850

liam@cs.qmw.ac.uk (William Roberts) (07/03/90)

Tut, tut - you shouldn't do that!  That is I presume a SysV
hangover since the Berkeley systems respect the file system
abstraction and provide actual system calls to manipulate
directories.

Anyway, find the inode number of a directory containing the one
of your links that you'd prefer to be rid of, move everything
else out of it and then use /etc/clri to zap that parent
directory: move the contents of the linked directory as well if
both links are in the same directory, since zapping the parent
inode with clri will kill both of them.

Then reboot the machine brutally by pulling the plug or
pressing the reset button (hmm, might be an idea to sync a few
times before doing the clri). Fsck will put things back
together and fix the link count on your directory.


If the above doesn't work first time, keep attacking things
with clri until you either wipe out everything or you solve the
problem. Both are probably more fun than using fsdb (see the
manual page, it may work for you).
-- 

William Roberts                 ARPA: liam@cs.qmw.ac.uk
Queen Mary & Westfield College  UUCP: liam@qmw-cs.UUCP
Mile End Road                   AppleLink: UK0087
LONDON, E1 4NS, UK              Tel:  071-975 5250 (Fax: 081-980 6533)