Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!bionet!ames!vsi1!teraida!teda!mikel From: mikel@teda.UUCP (Mikel Lechner) Newsgroups: comp.unix.wizards Subject: Re: Undeletable files. Message-ID: <493@teda.UUCP> Date: 27 Feb 90 06:27:40 GMT References: <22347@pasteur.Berkeley.EDU> <1990Feb24.183157.15439@pds3> Distribution: usa Organization: Teradyne EDA Inc., Santa Clara, Calif. Lines: 39 bob@pds3 (Robert A. Earl) writes: >In article <22347@pasteur.Berkeley.EDU> c91a1-rd@amazon.Berkeley.EDU.UUCP (Raja (Reader)) writes: >>I tried to remove an old, unwanted directory in the root system. >>There werea couple of subdirectories in that directory, and no matter what >>commands I used, I just could not remove it. rm -R, rmdir, etc. I then ran >>icheck and then fsck, and still no errors were reported. Then, on >>doing an ls -ilR, I noted that the directories were circularly linked! >>One of the subdirectories had the same inode number as it's parent. >>I then ran clri, and tried to first remove that inode number only, and >>then that inode nbr and the other sub-directory inode. Both times I failed. >If you have root permissions on your system, you should be able to use the >'unlink' command to solve this one. (Note: I have just created and solved the >problem you described on my SCO XENIX 386 2.3.2 system, SVR2 + BSD stuff) I once this problem in an old release of SunOS (3.2 I think). The unlink command refused to delete a directory which was linked. It turned out that the system call to remove a directory tested for a link count == 2 before attempting to delete the directory. This was used as a shortcut to avoid checking the directory to determine if it was really empty. However, in the case of a linked directory the link count for an emtpy directory is > 2. I deleted the problem directory by: 1) bringing the system to single user, 2) sync'ing the disks, 3) clri'ing the offending inode, 4) stopping the system and rebooting with a sync, 5) running fsck on reboot which finds and fixes the filesystem errors, caused by the clri. -- If you explain so clearly that nobody can misunderstand, somebody will. Mikel Lechner Teradyne EDA, Inc. UUCP: mikel@teraida.UUCP