[comp.unix.ultrix] Need help: deleting a *hardlinked* directory...

david@glance.ch (David Mosberger) (09/01/90)

Well, i know that it is impossible to hardlink directories. However,
here is a way  that you can do the impossible: try to rename a directory on
an NFS-mounted filesystem and you will receive the error message:

		mv: ?? cannot unlink <old directory name>

but the new directory does already exist. Both directory entries point
to the same inode number, so they are really hardlinked. The tricky
part is, to get rid of these directories. Neither `rm' nor `rmdir' work
and `fsck' doesn't complain either. Studying the ULTRIX documentation
didn't help either---so, do *you* know of a way of deleting a hard-linked
directory?

Here is a description of the environment in which the described effect
is reproducable:

	System on which the `mv' command was issued:

		SCO ODT (i386 Unix System V3.2)

	System accessed by NFS:

		ULTRIX-32 V3.1

The NFS system was soft mounted (this is probably a wrong for a rw mounted
NFS filesystem, on the other side, it is very inconvenient to have an
application blocking just because an NFS server was shutdown) and the
directory name was much shorter than 14 characters.

Any help is appreciated!

	--dave

-- 
-------------------------------------------------------------------------
David Mosberger						Glance Ltd.
Software Engineer					Gewerbestrasse 4
david@glance.ch						8162 Steinmaur

grr@cbmvax.commodore.com (George Robbins) (09/02/90)

In article <1990Sep1.131832.510@glance.ch> david@elava.UUCP (David Mosberger) writes:
> Well, i know that it is impossible to hardlink directories. However,
> here is a way  that you can do the impossible: try to rename a directory on
> an NFS-mounted filesystem and you will receive the error message:

normally you'd use  unlink(8) where the filesystem is locally mounted, but
ultrix seems to be missing this fine utility.  You could try writing an idiot
program to invoke the unlink(2) system call on the file or give clri(8) a try,
followed by an fsck to clean up the mess...

-- 
George Robbins - now working for,     uucp:   {uunet|pyramid|rutgers}!cbmvax!grr
but no way officially representing:   domain: grr@cbmvax.commodore.com
Commodore, Engineering Department     phone:  215-431-9349 (only by moonlite)