> This might be a question out > of ignorance, but is this a symbolic link (ln -s) or a hard link, and what > is the difference anyway?
With a hard link, you have a separate directory entry to the identical inode on the disk. The resulting link is *indistinguishable* from the original file and will persist through a renaming of the original file. In fact, if you delete the original file, the link will still point to the real data. (An inode is not actually marked as "deleted" until all references to it are deleted. With a hard link, you just have multiple references to the same point on the disk.) With a symbolic link, you have a separate directory entry pointing to the *name* of the original file. Windows 95 added this type of thing with a "Shortcut", and MacOS has an "alias". A symlink just points to the filename. If the original file is renamed, moved, or deleted, the link breaks. Here is a real quick look at the difference. Note that I am using the '-i' option to the ls command that shows the actual inodes on disk. I have one file: $ ls -li total 16 1811630 drwxrwxr-x 2 dyork dyork 4096 Oct 25 12:29 ./ 179521 drwxrwxrwt 40 root root 4096 Oct 25 12:28 ../ 1811631 -rw-r--r-- 2 dyork dyork 1164 Oct 25 12:29 foo I make the links: $ ln foo hfoo $ ln -s foo sfoo $ ls -li total 16 1811630 drwxrwxr-x 2 dyork dyork 4096 Oct 25 12:29 ./ 179521 drwxrwxrwt 40 root root 4096 Oct 25 12:28 ../ 1811631 -rw-r--r-- 2 dyork dyork 1164 Oct 25 12:29 foo 1811631 -rw-r--r-- 2 dyork dyork 1164 Oct 25 12:29 hfoo 1811632 lrwxrwxrwx 1 dyork dyork 3 Oct 25 12:29 sfoo -> foo Note that the hard link shows the same size as the original as it *is* the same thing as the original. They symlink shows a size of the number of characters in the name it is linking to. Move the original file. Hard link works. Symlink is broken. $ mv foo foo2 $ ls -li total 16 1811630 drwxrwxr-x 2 dyork dyork 4096 Oct 25 12:35 ./ 179521 drwxrwxrwt 40 root root 4096 Oct 25 12:28 ../ 1811631 -rw-r--r-- 2 dyork dyork 1164 Oct 25 12:29 foo2 1811631 -rw-r--r-- 2 dyork dyork 1164 Oct 25 12:29 hfoo 1811632 lrwxrwxrwx 1 dyork dyork 3 Oct 25 12:29 sfoo -> foo Delete the original file. Hard link works. Symlink is broken. $ rm foo2 $ ls -li total 12 1811630 drwxrwxr-x 2 dyork dyork 4096 Oct 25 12:36 ./ 179521 drwxrwxrwt 40 root root 4096 Oct 25 12:28 ../ 1811631 -rw-r--r-- 1 dyork dyork 1164 Oct 25 12:29 hfoo 1811632 lrwxrwxrwx 1 dyork dyork 3 Oct 25 12:29 sfoo -> foo Create a new file with the original *name*. Hard link points to the *original* contents. Symlink now works, but points to the *new* contents (which in this case is nothing). $ touch foo $ ls -li total 12 1811630 drwxrwxr-x 2 dyork dyork 4096 Oct 25 12:36 ./ 179521 drwxrwxrwt 40 root root 4096 Oct 25 12:28 ../ 1811633 -rw-rw-r-- 1 dyork dyork 0 Oct 25 12:36 foo 1811631 -rw-r--r-- 1 dyork dyork 1164 Oct 25 12:29 hfoo 1811632 lrwxrwxrwx 1 dyork dyork 3 Oct 25 12:29 sfoo -> foo $ You will find that things like init scripts (and most system admin that I can think of) gets done with symlinks, as there is only *one* definite copy of the contents. You also cannot do a hard link from one partition to another, as they both need to point to the same inode on the disk they are on... but you can do symlinks from anywhere to anywhere. Dan -- Dan York, Director of Training, Network Server Solutions Group Mitel Networks Corporation [EMAIL PROTECTED] Ph: +1-613-751-4401 Cell: +1-613-263-4312 Fax: +1-613-564-7739 150 Metcalfe Street, Suite 1500, Ottawa,ON K2P 1P1 Canada http://www.e-smith.com/ http://www.mitel.com/sme/ -- Please report bugs to [EMAIL PROTECTED] Please mail [EMAIL PROTECTED] (only) to discuss security issues Support for registered customers and partners to [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Archives by mail and http://www.mail-archive.com/devinfo%40lists.e-smith.org