The difference between hard and soft links in a Linux file system

Source: Internet
Author: User
Establish a Hard link command: ln src-link dest-link
Establish a soft link: ln-s src-link dest-link 1. Hard links are aliases, and soft links are shortcut 2. Hard links and source links point to the same I node, soft links are different 3. Hard links cannot span file systems, and soft links can be 4. Deleting both hard and soft links does not affect the original link 5. Hard links can only be for files, soft links for files and directories

6. Questions about the I node. Hard connections No matter how many, all point to the same I node, will increase the number of node connections, as long as the junction number of connections is not 0, the file exists, regardless of whether you delete the source file or the connected file. As long as there is one exists, the file exists (in fact, it does not divide the source file connection files, because they point to the same I node). When you modify the source file or any one of the connection files, the other files will be changed synchronously. Soft links do not use the I node number directly as a file pointer, but instead use the file path masterpiece as a pointer. Therefore, deleting a connection file has no effect on the source file, but deleting the source file will cause the connection file to be unable to find the file to point to. The soft link has its own inode, and there is a small space on the disk to store the path name.

Note: I node: it is a data structure used internally by UNIX to describe the characteristics of a file. We usually call the I node the file index node (information node). The I node contains important information about most of the file, including the address of the file data block on disk. Each I node has its own flag number, which we call the file sequence number. I node contains information 1. file type 2. File is the main relationship 3. Access to files 4. The time of the file is truncated.

The difference between hard and soft links in a Linux file system (RPM)

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.