hard link


hard link

(file system)One of several directory entries which refer tothe same Unix file. A hard link is created with the "ln"(link) command:

ln

where and are pathnames within thesame file system. Hard links to the same file areindistinguishable from each other except that they havedifferent pathnames. They all refer to the same inode andthe inode contains all the information about a file.

The standard ln command does not usually allow you to create ahard link to a directory, chiefly because the standard rmand rmdir commands do not allow you to delete such a link.Some systems provide link and unlink commands which givedirect access to the system calls of the same name, forwhich no such restrictions apply.

Normally all hard links to a file must be in the same file system because a directory entry just relates a pathname toan inode within the same file system. The only exception is amount point.

The restrictions on hard links to directories and betweenfile systems are very common but are not mandated by POSIX.Symbolic links are often used instead of hard links becausethey do not suffer from these restrictions.

The space associated with a file is not freed until all thehard links to the file are deleted. This explains why thesystem call to delete a file is called "unlink".

Microsoft Windows NTFS supports hard links via thefsutil command.

Unix manual page: ln(1).

http://microsoft.com/windowsxp/home/using/productdoc/en/fsutil_hardlink.asp.