Operating systems-File systems (3) Linux directory Configuration

Source: Internet
Author: User
Tags parent directory system log

File systems are typically implemented in a hierarchical structure: file management, directory management, and Disk Management file control blocks (BLOCK,FCB) are the only data structures that the operating system establishes for each file and contains all the file attributes. The FCB is usually pooled and organized together to form a file directory with two directory entries, each describing subdirectories and files. The catalog item format is defined by the uniform standard, and all the files made up of catalog items are called catalog files, saved in the store, and the files are Si cho into memory. In the tree directory structure, the full name of a file includes all the subdirectory paths encountered from the root directory to the file, and also known as path names, each subdirectory name is separated by a forward slash/(Unix) or backslash \ (win) partition of a hard disk can be organized into a subtree, Each subtrees tree can correspond to a logical drive (Win), or a number of sub-trees can be grafted into a big tree (Unix) Linux, the FCB is divided into the file name and index node inode, index nodes location is identified by the inode number, placed in the disk Inode area. The catalog entry contains only the file name and inode number, which is called the base Catalog item directory file and is never empty, and is automatically created with two special catalog entries:. Point out the Inode entry,. Indicates the Inode entry for the parent directory entry. Therefore, when you create a new directory, the I_nlink in the directory file's own inode is 2, and the I_nlink in the upper directory file inode increases by 1. All point to the same Inode directory file the basic function is to convert the file name to the physical location on the disk for this information. Based on the file path name provided by the user, the sequential lookup method is used to find each subdirectory name in the pathname from the root directory or the current working directory, and use it as an index to search all levels of directory files by layer, and finally find the matching file directory entries. You can also use some optimization methods to speed up the search of a directory:
    • Catalog table items are the sequence of keys, you can use the binary search method
    • The hash method is used to transform each file name into a unique directory table entry with transformation function.
One problem with tree-type directory structure is that when a file passes through many directory nodes, it is inconvenient to use, and the system often accesses the file memory many times when looking for a directory along the path, which slows down the access speed greatly. If the directory of all files is copied to main memory, the access speed is faster, but also increases the overhead of main memory. An effective way is to copy the commonly used and in use of those files directory into main memory, so that neither add too much main memory overhead, but also significantly reduce the directory lookup time system can create a file descriptor table for each user process, when the user uses a file, the first through the "open" operation, Copy the file about directory information to the specified main memory area, and fill in the File descriptor table to establish the connection between the user process and the file index. When you no longer use the file, use "Close" to disconnect the user process from the file and, if the directory has been modified, update the corresponding directory file in the secondary.  linux root directory is:/bin: Executable (command), all users have permissions to/boot: Boot boot required things, Grub boot program, Vmlinuz file (bootable, compressed Linux kernel)/dev: All devices and interface devices, such as sd[ A-Z (area code)] is a SATA, SCSI, SAS, USB interface hard disk, Hd[a-z] is the IDE device/home: System Default User house directory, each user has a folder              ~ represents the current user home directory, and ~username represents a user's home directory/root: System administrator user's home directory, into the single maintenance mode only mount home directory, the directory can have root home directory/usr/lib: library file, Some programs use dynamic function libraries, especially/lib/modules to place core-related modules (drivers)/media: Removable devices such as floppy disks, CD-ROM/OPT: Third-party large software/tmp: General program or place where the executing program places temporary files/mnt: Mount directory/ ETC: Almost all profiles, the general user can query but only the root has the right to modify/sbin: Power on, repair, restore the system required instructions, root users can execute/proc: System real-time information, a virtual file system, each time you start re-create, put the data actually in memory             such as Cpuinfo, Meminfo, Version/var      /var/lib/: Data generated by each service, such as MySQL data Library Default Write/var/lib/mysql/             /var/log/: System log, with DMESG (core boot log)        xferlog   ( FTP Service log)                                nbsp                       messages (System error log)    secure (security log) &NB Sp                          ,         &NB Sp                 maillog (mail system log)         wtmp (login log)   &NBSP ;                          ,         &NB Sp               cron (custom task log)   using the mkdir command to create a directory
[Email protected] ~]$mkdir -P TEST1/TEST2/TEST3/TEST4
#有了-P option to build a multi-level directory yourself
[Email protected] ~]$mkdir711 test2
#有了-m option to configure permissions, or the system uses the default properties rmdir delete empty directory-P along with the upper empty directory

Operating systems-File systems (3) Linux directory Configuration

Related Article

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.