The main partitioning mechanism has MBR and GPT two MBR partitions: The first sector is the most important, with the following: The boot code (Bootstrap codes area) and the partition table (partition table), where Bootstrap code area occupies 446 bytes, and Partition table occupies 16*4 bytes, know the start and end magnetic column of the divider, the last two bytes is the boot identity 55h and AAH can only use a hard disk not exceeding 2T, otherwise only use 2T space (with third-party solution) up to 4 primary partitions, The extended partition occupies the primary partition location and cannot format the logical partition on the extended partition: Linux supports up to 63 IDE partitions, 15 SCSI partitions file systems are divided into three chunks: Superblock: Record The overall information of this filesystem, Including the total amount of inode/block, the amount of use, the amount of surplus, and the format of the file system and related information. Each block group may have superblock, but only later as a backup. Inode: Record the properties of the file, a file occupies an inode, while recording the data of the block number of the file, the size of fixed to 128bytes, recording a block number requires 4bytes, so the system defines the block number of the record area as 12 direct, 1 indirect, 1 double indirect and 1 three indirect record areas. Use the Stat command to view the Inode information for a file-file: Display file name -size: Display size -Blocks: Total number of data blocks used by the file -IO Block:io block size -Regular File: Document type (regular file) -device: Unit number -Inode:inode number -Links: Number of links -access: File Permissions -Gid, UID: The GID and UID of the file ownership. - access Time: Abbreviated to Atime, which indicates when the file was accessed. When the contents of the file are accessed, update the - modify time: abbreviated to Mtime, which indicates the modified time of the contents of the file, and when the data content of the file is modified, the time is updated. - change Time: Abbreviated to CTime, indicating the status of the file, when the status of the file is modified, update this time, such as the number of links, size, permissions, blocks number of files. Block: The actual record fileContent, if the file is too large, it will occupy more than one block. The maximum number of files in each block, the size and amount of data can not be changed after formatting. ?? When a directory is created, an inode and several blocks are assigned to the login. Where the Inode records the permissions and attributes associated with the directory and records the assigned block number, while block is the inode number data that is recorded in this directory with the file name. Example: The system reads the/ETC/PASSWD process as follows: (1) through the information of the mount point to find the/dev/xxx inode number 2 root directory inode, and the INODE specification permission allows us to read the contents of the block (with R and X) (2)/the B Lock: After obtaining block's number in the last step, and finding the Inode number (16777281) (3) that contains the etc/directory, the inode of the etc/: reads the 16,777,281th inode and learns that the user has R and X permissions, so you can read etc Block Content (4) etc/block: After the last step to obtain the block number, and find the content has passwd file inode number (18313675) (5) passwd inode: Read 18,313,675th inode Know the user has R permissions, so you can read canceled passwd block content (6) passwd BLOCK: Finally, the block content data read out. The process of establishing a new file is as follows: (1) First determine if the user wants to add a new file to the directory has W and x permissions (2) According to the inode bitmap found unused inode number, the new file permissions and attributes to write (3) according to block Bitmap finds the unused block number, writes the actual data and updates the block point in the Inode (4) synchronizes the newly written information to the Inode bitmap and block bitmap, and updates the superblock Want to know what Linux supports the file system, go to the current Core module directory: Ls-l/lib/modules/$ (uname-r)/kernel/fs, where uname- R for Output Linux the version number system is currently loaded into the in-memory supported file system through the command Cat/proc/filesystems view the entire Linux file system is through VFS ( virtual filesystem Switch) core function to read the file system, through the VFS, can be a variety of specific file systems into a unified framework, different disk partitions can contain different specific file systems, their use and traditional single file system is no different , users can operate on different file systems and files through the same set of system calls, which can be performed across physical media and file systems, with full support for network shared files and access to files on remote nodes as well as files on local nodes. VFS is essentially a running environment that exists in memory and supports a variety of specific file systems, with features such as recording the type of file system installed, establishing a connection between the device and the file system, implementing universal file-oriented operations, Mapping to specific file systems when working with specific file systems The VFS is able to converge on different file systems because it defines the basic abstraction interfaces and data types that all file systems must support, and the various file systems are consistent with their definitions. Non-UNIX-type file systems must also be encapsulated to provide an interface that conforms to the VFS concept (such as file systems that do not support inode concepts, must assemble inode structures in memory, as if they contain inode), which must be introduced to special handling at the site of use, This allows the file system to be compatible with the UNIX operating system usage rules and the VFS interface requirements.  DF list The overall disk usage of the file system-H displays the size of the file system as an easy-to-read format-I does not use the hard disk capacity and the number of inode displays the type of the filesystem du-sh * lists all archive capacities in the current directory-S list Total - h display in a person's easy-to-read format dumpe2fs/dev/sda3 View file system details-H list only superblock data fdisk: MBR-based partitioning tool, Root user can run Fdisk-l list all installed hard disks and partition information
Disk/DEV/SDA:21.5GB,21474836480bytes41943040sectorsunits= Sectors of1* += +bytessector size (logical/physical): +Bytes/ +Bytesi/o Size (minimum/optimal): +Bytes/ +bytesdisk label Type:dosdisk identifier:0x000b2bc5Device Boot Start End Blocks Id System/DEV/SDA1 *2048 2099199 1048576 theLinux/dev/sda22099200 41943039 199219208e Linux LVM
FDISK/DEV/SDA the partition, press "M" to enter the help page and follow the instructions.
Command (M for Help): Mcommand Action A toggle A Bootable Flag B Edit BSD Disklabel c toggle the DOS compatibility flag d Delete a partition G create a NE W Empty GPT partition table G Create an IRIX (SGI) partition table l list known partition types M print this m ENU n Add a new partition o create a new empty DOS partition table p print the partition table Q quit with Out saving changes s create a new empty Sun Disklabel t change a partition "s system ID u change display/entry units v ve Rify the partition table w write Span style= "COLOR: #000000" > table to disk and exit X extra functionality (experts only)
After creating the partition, you need to set id,linux default to 83, and eventually write the partition table to disk and exit. /proc/partprobe Update kernel partition information RAW devices need to be formatted to use (Create File system) NTFS (Windows) Ext3, EXT4 (Linux) mke2fs-t ext4/dev/ sda3   -T Specify the type of file system you want to create -C Detect damage at creation -L label Specify volume label (first name) &NBSP ; -B blocksize Specify file system block size MKFS.EXT4 /dev/sda3 e2label/dev/sda3 labelname superscript signature , general capitalization fsck Check and repair of corrupted file system (must be uninstalled first) -y Direct fix &NBS P  -T specified type (when corruption is critical) for corrupted data that is recognized as a file, fsck puts it into the Lost+found directory after the file system is created, the disk needs to be mounted in a directory in order to use manual mount operations. or configure the system to automatically mount Mount /dev/sda3 /mnt/(mount point) The Mount command without commands displays all mounted file systems Mount-o remount, Ro/dev Sda3 /mnt/-o Specify mount options ro,rw &NBSP ;   Download read-only or read-write, default read/write remount to re-mount Sync/async &N Bsp Do not use cache/use cache Noatime/atime Access files when file access time is not updated/file access time when accessing files umount devices/ mount point (must be uninstalled and then operated) fuser-m /mnt Review the process of using the file system lsof /mnt View files in use   /ETC/FSTAB definitions need to be automatically hung File system/dev/sda3 /mnt EXT4   ; defaults & nbsp 0 0 need to mount device mount point File system mount options  D UMP, FSCK-related label=xx identification
Operating system-File system (5) Linux file System management