Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!adm!matt@oddjob.uchicago.EDU From: matt@oddjob.uchicago.EDU (My Name Here) Newsgroups: comp.unix.wizards Subject: Re: Symbolic linking vs. Hard linking on BSD Message-ID: <10913@brl-adm.ARPA> Date: 18 Dec 87 20:32:16 GMT Sender: news@brl-adm.ARPA Lines: 36 In article <926DBLCU@CUNYVM> you write: ) Can anyone out there please describe for me the difference between ) symbolic & hard linking in the BSD environment? This question belonged in comp.unix.questions, not ...wizards. A normal everyday file has a bunch of data blocks that hold the contents of the file. There is also something called an "inode" which contains the addresses of the data blocks, the total size of the file, the owner, the permission bits, last access and modification time, and a few other bits. The inode does not include the name of the file anywhere. Some directory has an entry for a certain name, along with the number of an inode. The name is now a name for the file described by the inode. A "hard link" to a file is merely another entry (in the same or a different directory) which indicates the same inode number. Inode numbers start from 1 on each disk partition, so there is no way for a directory to have an entry for a file on another filesystem. Also, there is no way to distinguish the "first" entry for a file from any others. All hard links are equal. If you delete the original entry, the file still exists under its other names. The inode and the data blocks are not released for re-use until all entries for the file have been removed. A "soft link" is a special kind of file. It's inode has a code in it that says "I am a symbolic link". The content of the file is just the name of the file that this is a link to. That target file may or may not exist at any given moment. Since the symbolic link contains a name rather than an inode number, the referenced file (if it does exist) may be on any filesystem. ________________________________________________________ Matt University matt@oddjob.uchicago.edu Crawford of Chicago {astrovax,ihnp4}!oddjob!matt