Hard link and symbolic link soft link hard link

Source: Internet
Author: User

Hard Link)

The UNIX file system provides a mechanism to link different files to the same file. We call this mechanism a link. It allows a singleProgramUse different names for the same file. The advantage is that the file system

There is only one copy of the file. The system simply creates a new registration item in the directory to achieve this connection. This registration item has a new file name and inode Number of the file to be connected, the Directory of the file
The registration item is the so-called file hard link (hard link, directory registration item:
File name --> inode of the file; there can be multiple file names, but the file inode is only one ). No matter how many hard links a file has, there is only one inode describing it on the disk,
As long as the number of links to the file is not 0, the file will remain. Hard links cannot span the file system or create hard links to directories!
Hard
The connection is directly established on the node table (inode). When a hard connection points to a file, the Count value on the node table is updated. For example, a file is connected twice (hard connection ).
Count of Files
It is 3, and no matter any one of the three file names is accessed, the effect is exactly the same. However, if you delete any of the three files, you only need to reduce the Count value by 1, does not delete the actual content (any existing
File itself is even a hard connection) the content will be deleted only when the Count value is changed to 0, that is, no hard connection points.

symbolic link
we call a symbolic link soft link a special file pointing to another file, the data part of this file only contains the path name of the file to be linked. Soft links are introduced to overcome the shortcomings of hard links. Soft
links do not directly use inode numbers as file pointers, but use file pathnames as pointers (soft links: file name +
data section --> path name of the target file ). The software has its own inode, and there is a small space on the disk to store the path name. Therefore, soft links can be used across file systems or directories!
second, a soft link can be used to link a non-existent file name, but the link can be opened only after the file corresponding to the name is created.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.