Test Header HTML Code

硬连接(hard link)与符号连接(symbolic link)

i节点(inode):Linux为每个文件分配一个数字,即inode (or
“index node”) ,在任何存储设备上均为唯一的. 如果两个路径指向具有同一个inode的文件节点,那么其中一条路径即为硬连接(hard link)

硬连接hard link: A hard link is a reference to another file in the current directory or a different directory.Whenever some action is performed to the hard link, it is actually done to the file the hard link refers to. Hard links are accessed quickly because they do not have to be dereferenced, but Linux limits where a hard link can be placed. As long as a file is being referred to by at least one directory entry, it won’t be deleted. For example, if a file has one hard link, both the link and the original file have to be deleted to remove the file. 一言以蔽之:硬连接相当于文件本身,直接指向原文件。

 

符号连接symbolic link: This link is a file that contains the pathname of another file. Unlike hard links, symbolic links have no restrictions on where they can be used.They are slower and some commands affect the link file itself instead of the file the link points to. Symbolic links are not “hard” because they have to be dereferenced:When Linux opens the symbolic link file, it reads the correct pathname and opens that file instead.When the file being referred to is deleted, the symbolic link file becomes a dangling link to a non-existent file.符号连接是指向一个了特殊文件,该文件再指向目标文件。

 

创建硬连接: ln source_file target_file

创建软连接: ln -s source_file target_file

posted on 2011-01-18 17:25  宁静的水泡  阅读(1102)  评论(0编辑  收藏  举报

导航

Test Rooter HTML Code