One minute to understand the Linux file system

Principle Linux file system
file has a file name and the data in all operating systems, file systems on a Linux system is divided into two parts: User data (user data) and metadata (metadata). User data, i.e. the data block (data block), data block is a local log file contents are true; metadata are additional attributes file, such as file size, creation time, owner, etc.; Linux system, element the data in the inode number (inode is part of the metadata file but does not include the file name, inode number that is inode number) that uniquely identifies the file rather than the file name is. The file name is only for the convenience of people's memories and use the system to find the correct file or program data blocks through the inode number.

Linux file system directory
most versions of Linux using the FHS (English: Filesystem Hierarchy Standard Chinese: the file system hierarchy standard), the FHS defines the purpose of each system zone, the minimum configuration of files and directories is also given the required the exceptions and contradictions treatment. For file systems ext2 / 3/4, the default data block size is 4096 byte, when the need to create a new file or directory, the minimum allocation unit is a data block, i.e. 4K size, such as a content file 4M, will 1000 allocation data block to store the contents of this file, the attribute of the file or directory, authority, data block number exist in the corresponding inode. When a new directory when the default allocation of a block, is seen 4096byte, file name and directory inode information in the file to be stored in this block. Directory file grows, the meta-information to be stored will increase, a block is not enough, then the application will block, but the block is the smallest unit, so the size will always be a multiple of 4096. Therefore, when using Linux command to view the new catalog Why 4096 will show a.

Linux links
Linux system introduces two links: hard link (hard link) and soft links (also known as symbolic links, namely soft link or symbolic link). Links to solve the shared file system Linux, but also brought a hidden file path, permission to increase security and save storage and other benefits. We can well understand the difference between a hard link and a soft link based on the above knowledge.
Hard link: the file is no different from ordinary, inode blocks point to the same file on the hard disk.
Soft Link: save the absolute path of the file it represents, is another kind of file, different inode, a separate block on the hard disk, replace its own path access.

Guess you like

Origin www.cnblogs.com/zhouzhifei/p/11589905.html