Linux operating system file BASICS (2)

Source: Internet
Author: User

The following is a detailed description of the basic knowledge of the Linux operating system file system. It should be useful to many friends who do not have full knowledge of the Linux operating system. Therefore, you can learn from the following. Hope to help you.

Next, I will introduce the basic knowledge of Linux File System.

Ii. linux File System
A file system refers to the physical space of a file. in linux, each partition is a file system with its own directory hierarchy. In linux, the file systems that belong to different partitions form a general directory hierarchy of the system in a certain way. The operation of an operating system is inseparable from file operations. Therefore, you must possess and maintain your own file system.

The Llinux file system uses an index node to record file information, which acts as a file allocation table in windows. An index node is a structure that contains information such as the length of a file, creation and modification time, permission, ownership, and location on the disk. A file system maintains an array of index nodes. Each file or directory corresponds to the unique element in the index node array. The system assigns a number to each index node, that is, the index number of the node in the array, which is called the index node number.

The linux File System saves the node number and file name of the file index in the directory at the same time. Therefore, the directory is only a table that combines the file name and its index node number. Each pair of file names in the Directory and the index node number are called a connection.

A file has a unique index node number that corresponds to it. For an index node number, multiple file names can correspond to it. Therefore, the same file on the disk can be accessed through different paths. You can use the ln command to create a new connection to an existing file without copying the file content. There are soft connections and hard connections. Soft connections are also called symbolic connections. Their respective features are:
Hard connection: the original file name and connection file name both point to the same physical address.
The directory cannot have a hard connection; the hard connection cannot span the file system and cannot span different partitions)
Only one file is copied to the disk, saving hard disk space;
Deleting a file is successful only when the same index node is a unique connection. This prevents unnecessary accidental deletion.
Symbolic connection: using the ln-s command to establish a symbolic connection to a file is a special file in linux. As a file, its data is the path name of the file it connects. Similar to the shortcut in windows.
You can delete the original file and save the connection file. This does not prevent accidental deletion.
The content of this section is too abstract, and the node is an array. I have tried to be as popular as possible, but it is not a good example for demonstration. If you are still in the fog of the cloud, there is no way I can do it. I only need to remember that I will gradually understand and understand it in practical application in the future. This is also a learning method.

3. mount a File System
As shown in the previous section, each partition in linux is a file system and has its own directory hierarchy. In linux, the file systems that belong to different partitions form a general directory hierarchy of the system in a certain way. The "according to certain method" mentioned here refers to the Mount. Mount the top-level directories of one file system to the subdirectories of another file system to make them a whole, called mounting. This subdirectory is called a mount point.
For example:
Root partition:
/Root directory

 
 
  1. ┃  
  2. ┏━━━━┳━━━━━┳━━━━━┳━━━━━╋━━━━━┳━━━━━┳━━━━━┳━━━━━┓  
  3. ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃  
  4. bin home dev etc lib sbin tmp usr var  
  5. ┃  
  6. ┏━┻━┓  
  7. ┃ ┃  
  8. rc.d cron.d  
  9. ┃  
  10. ┏━━━┳━━━┳━┻━┳━━━━┓  
  11. ┃ ┃ ┃ ┃ ┃  
  12. init.d rc0.d rc1.d rc2.d ……  

/Usr partition:

 
 
  1. usr  
  2. ┃  
  3. ┏━━━━┳━━━╋━━━┳━━━┳━━━┓  
  4. ┃ ┃ ┃ ┃ ┃ ┃  
  5. X11R6 src lib local man bin  
  6. ┃ ┃  
  7. ┃ ┏━━━╋━━━┓  
  8. ┃ ┃ ┃ ┃  
  9. linux bin lib src  

After mounting, the figure at the beginning of the article is formed. Does it look like hanging up? Note: 1. the mount point must be a directory.

Click "basic knowledge of Linux Operating System File System (2)" below to continue viewing.

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.