Detailed explanation of i-nodes and the difference between soft links and hard links

The i - node is a 64 -byte long table, which contains the relevant information of the file, including important information such as the size of the file, the owner of the file, the access method of the file, and the type of the file. The most important content in the i -node table is the disk address table.

There are 13 block numbers in the disk address table, and the file will read the corresponding blocks sequentially in the order that the block numbers appear in the disk address table. The Linux file system connects the i -node and the file name. When the file needs to be read, the file system searches the current directory table for the item corresponding to the file name, thereby obtaining the i - node number of the file . The disk address table connects the physical blocks of the scattered files into the logical structure of the file

Links are divided into soft links (symbolic links) and hard links

A symbolic link is to create a separate file that will let the data read point to the filename of the file it links to, similar to a shortcut in Windows

symlink ln -s source filename target filename

1. Symbolic links can create links to files and directories

2. Can span file systems (that is, span disk partitions)

3.  The linked file type makes 1

4.  Linked files have new i - nodes

5. When the source file is deleted, the target file cannot be used; however, if a new file with the same name as the source file is re-created, the target can also be used, but the content has changed.

 

 

Hard link: Generate a new file name through the Inode of the file system, not a new file, but just create a new file name in a certain directory to link to the management record of a certain inode number.

1. Hard links cannot cross file systems, they just link files

2. The  linked file type is -

3. i- nodes are the same

4. Source file deletion does not affect target files


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325852639&siteId=291194637