Most UNIX operating systems have V nodes. But for Linux, there is only a general I node, but no v node.
Next we will discuss the I nodes in Linux.
--------------------------------------------------------------------------------
In Linux, file search is not based on the file name. In fact, I nodes are used to locate files. We can regard the I node as a pointer FIP. When a file is stored on a disk, the file must be stored on a disk. As you can imagine, since file data is stored on a disk, if we know the address of the file data, when we want to read and write the file, can we directly use this address to find the file?
Yes, in Linux, I nodes can actually think of it as an address pointing to the file storage area on the disk. However, we generally cannot directly use this address, but indirectly use it through the file name. In fact, the I node not only contains the address of the file data storage area, but also contains a lot of information, such as the data size and file information. However, the I node does not save the file name. The file name is saved in a directory. Each directory item contains a file name and an I node.
We can look at the relationship between directory items, I nodes, and file data through a graph.
As you can see, the directory item contains the file name and I node.
At the same time, you will find that the I nodes of directory item A and directory item B point to the same storage area, where the storage area stores printf ("ha") data.
That means helloa. C and hellob. C have the same content.
This introduces the concept of hard link and symbolic link.
Hard link ln-d
Symbol link ln-s.
To obtain the relationship between helloa. C and hellob. C, run the following command:
View plaincopy to clipboardprint?
# Ln-D helloa. c hellob. c
# Ln-D helloa. c hellob. c
In this way, the helloa. C hard link hellob. C is obtained.
For hard links. If the source file helloa. C is deleted, the data files on the disk are not deleted. Because the number of hard links of the file is recorded on the I node. Only when the number of hard links is 0 and the file name is deleted will the data be deleted on the disk.
That is to say. Here, if we use the command:
View plaincopy to clipboardprint?
# Rm-RF helloa. c
# Rm-RF helloa. c
Hellob. C can also be used normally. Its content is printf ("ha ");
But if it is a symbolic link:
View plaincopy to clipboardprint?
# Ln-s hellob. c helloc. c
# Ln-s hellob. c helloc. c
This is the so-called symbolic link, which is actually the index of the file index. After the source file hellob. C is deleted, the disk data file is still in use and helloc. C cannot be used.
The Symbolic Link contains the path strength of a file name. If the file name is deleted, the symbolic link will naturally not work properly.
This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/feiyinzilgd/archive/2010/05/19/5609157.aspx