Recently began to pick up the Linux again, because the work is very little, so see things easily forget.
These days to see the Linux partition, and how to make the file system and other related commands to use, the following in accordance with this process to say, lest they forget later.
1. Partitioning
A disk partition, that is, the starting and ending cylinders of the specified partition. When we install the Linux system, we will divide the disk into separate pieces, which is the partition, the cylinder is the smallest unit of the partition, the cylinder is composed of sectors, the first sector is the most important, there is MBR (446byte) and partition table (64byte), the sector size fixed to 512byte.
2. File System
How does the file system come about, after partitioning the hard disk, when it is necessary to read and write data to the hard disk, we do not know what the relevant structure inside the hard disk is, what should we do, give him a map of our familiar directory, so where to save where, from where to remove it is very clear. The process of mapping the directory, which we call the production filesystem, will be explained in detail later.
But a file system is so large and rather difficult to manage. Therefore, a file system is divided into a number of block groups, each block group contains 6 important content: Superblock, File system description, block corresponding table, Inode table, inode table, block table.
* The contents of the file are stored in the block table, and the Inode table records the properties of the file and the block table corresponding to the file.
Superblock: It stores information about the entire file system, such as the total number of blocks and inode, the Mount time, the last time the data was written, and so on.
File System Description : Describes the block group for the start block and the end block number.
Block Correspondence Table : Records which blocks hold data and which block is free to use
inode Correspondence Table : Records which indode hold the data and which inode idle can be used.
inode table: The related attributes of the record file, and the block number of the content, one file only corresponds to one inode (fixed size 128byte).
block table: Record the contents of a file, a file can exist multiple blocks (with a size of 1k,2k,4k different sizes)
DF: system that lists all files in the system
-H: Show friendly units in the results, g,m,k
-T: The type of file system shown in the results, such as EXT4, etc.
-I: does not display the hard disk capacity, but displays the number of Inode
-A: Displays all file systems, including special file systems
dumpe2fs Device name : View details about the device (Superlock, etc.)
Example: DUMPE2FS/DEV/SDA1
3. file System production
(1) when installing Linux, partition, you can manually select the partition format when the file system, mounted directory.
(2) if the disk still has the remaining space, we can manually create the file system by command, the process of
create partition-format-mount directory 3 steps.
(2-1) FDISK partitions the disk
With the DF command, we can see the device name, the IDE interface for the/dev/hda...,sata interface for the/DEV/SDA ...
fdisk disk File name (Note that it is/DEV/SDA, do not add numbers)
related actions : P View so partition
N New Partition
D Delete Partition
Adding a partition using n operations is possible.
(2-2) Mkfs the partition, which is what file system to format
mkfs-t File system device name
Example: Mkfs-t ext4/dev/sda5 represents a file system that formats the device/dev/sda5 as a EXT4
If the new partition is immediately formatted, the partition does not exist and you can perform a command partprobe or reboot to join the newly created partition to the partition table
(2-3)Mount mount, map the formatted partition to the directory
mount-l "volume label name" Directory : Use the device's label to Mount,
e2lable can modify the device's volume label name e2lable device Name "lable name"
mount device name directory : Mount the device to a directory
mount-l : View all mount conditions
Mount--bind Catalog directory: Mount directory to Directory
unmount uninstalling unmount device name/directory
Above these three departments can complete a file system of the production, remember fdisk,mkfs,mount!