Linux Basics: 11, soft connections and hard links

Source: Internet
Author: User

Soft connections and Hard links)


ln hard Links

Role: primarily for secure backup

Grammar:

ln source Dest

Principle:

Normal file

The inode is the file's permissions, attribution, time and other information and block number, block is the actual file data.

Catalog Files

The inode is the directory's permissions, attribution, time and other information and block number, and block is stored in the Inode and its file name list similar to the following table

Directory inode:drwxr-xr-x root root (time) (Block number "**1")

                                                                                                            |

Block number **1


4275611

passwd

4283645

22

Inode File name

...

...


As a result, the hard link is actually adding a record in the list above, with the contents "inode Number of source file" and "Link file name". At this point the overall connection logic should be, as

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/5B/28/wKioL1UBDhfSetvtAAAfRlmZQaA596.gif "title=" Hard_ Link1.gif "alt=" Wkiol1ubdhfsetvtaaafrlmzqaa596.gif "/>

After the hard link, the actual file Inode is equivalent to two entries, which are written in the directory file block inside, the two portals have the same inode number, but the file name is not the same, because of this, so the hard link is not an additional inode number, Just the equivalent of a layer of security to the source files to prevent accidental deletion.

PS: Hard links do not produce new inode

PS: Cannot make hard links across partitions

PS: Cannot make hard links to directories

Ln-s Soft Connection

Role: Can be used for "capacity sharing" and "inode sharing" between different partitions

Syntax: ln-s source Dest

Principle:

Soft links and hard links are different, and soft links are newly allocated by the system to an inode and Block,block is the source file information.

Link file inode

Block: The information that saved the source file

------>

Source file Inode

Block: Actual file information

Based on this principle, a soft connection can generate new inode, or a soft connection to the directory, can be seen to understand

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/5B/28/wKioL1UBD7fBwhr-AAAf1fsaVt0535.gif "title=" Symbolic_link1.gif "alt=" Wkiol1ubd7fbwhr-aaaf1fsavt0535.gif "/>

PS: Hard links may not be due to the possibility of generating a directory loopback

PS: Try to write absolute path

PS: The size of the soft connection and the length of the file name of the connection


This article is from the "30 Demon People" blog, please make sure to keep this source http://301ren.blog.51cto.com/8887653/1619643

Linux Basics: 11, soft connections and hard links

Related Article

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.