Inode index nodes and soft and hard links

Source: Internet
Author: User

Inode Index Node

Inode ( Index Node table contains a list of all file system files

A node (an index node) is a table item that contains information about the file (metadata), including:

file type, permissions, UID , GID

Number of links (pointing to the number of path names for this file name)

The size of the file and the different timestamps

Data block pointer to file on disk

Additional data about the file

INODE table Structure

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/85/3F/wKioL1eeCezStK0SAAIVl4UUmvc861.png-wh_500x0-wm_3 -wmp_4-s_3318610134.png "title=" capture. PNG "alt=" wkiol1eecezstk0saaivl4uumvc861.png-wh_50 "/>

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/85/3F/wKiom1eeCh_hkLPvAAFoLFRHDuQ734.png-wh_500x0-wm_3 -wmp_4-s_3214545737.png "title=" capture. PNG "alt=" wkiom1eech_hklpvaafolfrhduq734.png-wh_50 "/>

Ls-i can view the node encoding

650) this.width=650; "Width=" 3 "height=" 2 "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/themes/default/images/word.gif") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "/>650) this.width=650; "Src=" http://s1.51cto.com/wyfs02/M00/85/3F/wKiom1eeCp3wcVfRAAAY3AzkuY8103.png-wh_500x0-wm_3-wmp _4-s_4254389973.png "title=" image 2.png "alt=" Wkiom1eecp3wcvfraaay3azkuy8103.png-wh_50 "/>

The Inode Table node is the metadata, and each partition has a table of nodes.

In a partition, a file has only one node number, just like a person's ID number.

650) this.width=650; "Width=" 143 "height=" "src="/e/u261/themes/default/images/spacer.gif "style=" background: URL ("/e/u261/themes/default/images/word.gif") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "/> Hard Links:

command is ln source file directory / link file name

Theoretical knowledge:

Number of connections = number of file names.

multiple files in the same partition name , a node corresponds to multiple name is equivalent to a business card.

cannot be created across partitions and cannot be created for a directory

RM link for descending count of commands

File to exist, with at least one link number

When the number of links is zero, the file is deleted

Experiment :

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/85/3F/wKioL1eeCq-w-lf-AAAFjwpetfA224.png-wh_500x0-wm_3 -wmp_4-s_403480523.png "title=" image 1.png "alt=" wkiol1eecq-w-lf-aaafjwpetfa224.png-wh_50 "/>

The following command can compare I created 3 links,290, node number. 3, which represents several links.

The number of connections, and its data on the hard disk will not increase, but in the directory to add a few more records.

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/85/3F/wKioL1eeCtPxSqGeAAAL487wwPE074.png-wh_500x0-wm_3 -wmp_4-s_3419848739.png "title=" image 3.png "alt=" wkiol1eectpxsqgeaaal487wwpe074.png-wh_50 "/>

Soft connection:

command is a ln-s source file link file name

Theory:

Soft connection is a shortcut to the popular word.

A file that corresponds to multiple names

Can be created across partitions and can be done for directories.

source file One but deleting the shortcut is invalid.

The number of connections does not grow

Experiment:

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/85/3F/wKiom1eeCvbSKSzJAAA3EVzpMCk863.png-wh_500x0-wm_3 -wmp_4-s_4134414306.png "title=" image 4.png "alt=" wkiom1eecvbskszjaaa3evzpmck863.png-wh_50 "/>

is created across partitions

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/85/3F/wKioL1eeCxLyV0vXAAAp7FHajY0669.png-wh_500x0-wm_3 -wmp_4-s_1881664928.png "title=" image 5.png "alt=" wkiol1eecxlyv0vxaaap7fhajy0669.png-wh_50 "/>

Ln-s the relative / Absolute Path of the original file ( relative to the path of the soft connection file ) soft Connect file

as shown ;

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/85/3F/wKiom1eeCz6ih3msAAAvok0NjPM427.png-wh_500x0-wm_3 -wmp_4-s_1486960571.png "title=" image 6.png "alt=" wkiom1eecz6ih3msaaavok0njpm427.png-wh_50 "/>

RM Command:

the number of links is decremented, thereby releasing the Inode number can be reused

Put data blocks in the free list

Delete a catalog entry

The data is not actually deleted immediately, but is overwritten when another file uses the data block.

if MV The target and source of the command are in the same file system, as MV Command

Create a new directory entry with a new file name

Delete old directory entries corresponding to older file names

does not affect Inode table (except timestamp) or data location on disk: No data is moved

in the CP the command:

Assign a free Inode number, in Inode Create a new entry in the table

Create a directory entry in the directory, with the name Inode Number Association

Copy data to generate a new file


Inode index nodes and soft and hard links

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.