Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!snorkelwacker.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: comp.unix.questions Subject: Re: removing hard linked directories Message-ID: <1991Mar20.115508.25638@athena.mit.edu> Date: 20 Mar 91 11:55:08 GMT References: <1991Mar20.013744.12749@ux1.cso.uiuc.edu> Sender: news@athena.mit.edu (News system) Organization: Massachusetts Institute of Technology Lines: 28 In article <1991Mar20.013744.12749@ux1.cso.uiuc.edu>, phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) writes: |> How would you recommend removing a directory that is linked under several |> different names? The directory really is empty but rmdir lies and says |> it is not empty. Well, first of all, perhaps you already know this, but the problem you are having is just one of the many reasons why the man pages for ln(1) and link(2) say that you shouldn't create hard links to directories. There are other reasons, like creating circles in the filesystem that can confuse various oft-used system utilities. Second, my version of "fsck" automatically deals with hard links to directories. I created the directory /foo on a filesystem and then hard-linked /bar to it, and when I ran fsck, got "/bar IS AN EXTRANEOUS HARD LINK TO DIRECTORY /foo\n\nREMOVE? " If your fsck isn't smart enough to do that, then you can help it along a little bit by figuring out the inode number of the directory with multiple links, unmounting the filesystem and then running "clri" on the inode. When you do this, fsck should be able to clean up. This worked for me too. Fsck asked a few questions about the directories in question, I said yes to all of them and the directories went away. -- Jonathan Kamens USnail: MIT Project Athena 11 Ashford Terrace jik@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8085 Home: 617-782-0710