Everything is a document
All the devices in Linux are treated as a file, including our IO devices, and in general, they are placed in the/dev directory
Eg:ide HDD/dev/hd[a-p] (A-p is its number)
Disk partition Table
A. master boot partition MBR: Install boot loader, total 446bytes
B. Partition table: Record the state of the entire hard disk partition, total 64bytes
The partition table is located in the first sector of the MBR, the scope of each partition is recorded, we say that the partition is actually set in the partition table
* * Partition table is written by default to four groups of partitions
BIOS: The first program to be executed on boot
CMOS: Record the parameters of the drive, embedded in the memory of the motherboard
start -up process : The BIOS reads the first sector according to the user's settings to get the hard drive to boot mbr-> the boot loader in MBR to load kernel files---kernel file work
* * Important hotkey 650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0047.gif "alt=" J_0047.gif "/>
[TAB] Fill command
[Ctrl]+c Stop a program that is currently running
[Ctrl]+d directly from the text interface, equivalent to exit
Use the man command to query the parameters of a command is that we will see the command being queried contains a number for example: Man date will see Date (1)
The meaning of the number stands in relation to the purpose of the document as follows:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/7E/E2/wKiom1cLlP3guxsgAABAM1Cx1bI865.png "title=" table. png " alt= "Wkiom1cllp3guxsgaabam1cx1bi865.png"/>
Try:man NULL
Try the above command, we will find null (4), control the above meaning to see what it means
The correct shutdown method: Because Linux can work with multiple users , we must check who is online (using the WHO command) before shutting down the machine.
Don't be violent, shut down, don't destroy other people's data.
Before shutting down, notify online users that you can use the shutdown and Erboot commands ~
Use a few more SYCN before the system restarts or shuts down
system operation mode: 0 shutdown 3 pure Command mode 5 graphical interface 6 restart
User rights: R-Read W-write x-Execute
Change Permissions command: chmod chattr (Hidden permission) (parameters can be queried with man)
View Permissions command: LL llattr
Change the file belongs to user group: CHAGRP
change user owner: Chown
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7E/E2/wKiom1cLlP-SjmdCAAAnX1nfPNc032.png "title=" User groups. png "alt=" Wkiom1cllp-sjmdcaaanx1nfpnc032.png "/>
File type:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/7E/DF/wKioL1cLlbHDsvzaAABPxJfQmrk995.png "title=" file type. PNG "alt=" Wkiol1cllbhdsvzaaabpxjfqmrk995.png "/>
EXT2 file system: Linux regular file system (file system specified file attributes/permissions are different)
Inode : File permissions and attributes, block number where the file data is recorded
Data Block : Actual data (may occupy multiple blocks when the file is large)
Superblock : Records The overall file system Information
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7E/E2/wKiom1cLlP6gVZUgAAATUB04wD4314.png "title=" Inode and Block.png "alt=" Wkiom1cllp6gvzugaaatub04wd4314.png "/>
According to the information in the inode, we can find the block that holds the file data, which is called an indexed file system .
* If a file storage block is too fragmented to read, the disk address time will be longer so so-called " fragments "
Defragmentation will join the block that the same file belongs to
Block
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/7E/E2/wKiom1cLlbOSKoZvAAAXxnw3NK8365.png "style=" float: none; "title=" block size. PNG "alt=" Wkiom1cllboskozvaaaxxnw3nk8365.png "/>
Block size According to the actual situation, if you choose 4KB and all the small files stored will cause a lot of waste
Inode
Access mode, owner, size, creation and state change time, last read time, last modified time, feature flag, content point
Each inode size is 128b , and each file occupies a Ionode
* The number of files the file system can create is related to the number of inode
When reading the file, find the inode and see if the permissions match, and if it matches, find the appropriate block.
Point to block mode: direct, indirect, single indirect, double indirect, three indirect
Total: direct + indirect
Superblock
Block and inode total, file system mount time, Block,inode size, validbit value: If a filesystem is hung at 0 otherwise 1
Block table, inode table, File system description
* size is 1024b the superblock of each section can be dumpe2fs queried
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7E/E0/wKioL1cLlmfyricrAABcui-4mAE662.png "style=" float: none; "Title=" dumpe2fs. PNG "alt=" Wkiol1cllmfyricraabcui-4mae662.png "/>
View the number of inode numbers used in the directory files using ls-i
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7E/DF/wKioL1cLlbKCQqz7AAAZMFgWuls441.png "title=" View the directory inode number. PNG "alt=" Wkiol1cllbkcqqz7aaazmfgwuls441.png "/>
The process of reading a file
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/7E/DF/wKioL1cLlbLj39u9AAAV5fT-SaY590.png "title=" The inode for the file read. PNG "alt=" Wkiol1cllblj39u9aaav5ft-say590.png "/>
a process for adding a file :
1. Determine if the user has a W x permission for the file, and if so, add
2. Find unused Inode numbers according to Inode bitmap, and write the properties and permissions of the new file
3. Locate the block bitmap to find the unused block number and write the actual data, updating the Inode's point to block
4. Updating Inode bitmap and block bitmap
* * Log file system : Resolving Data inconsistency status issues (EXT3)
We specifically partition a block in the file system to record file writes or revisions
Preparation : Records the information to be written when the system is writing to a file
Write : Write file data, update meta data
end : Record after completing update meta data
This article is from the "Zimomo" blog, make sure to keep this source http://zimomo.blog.51cto.com/10799874/1762749
Linux Basic Article One