Linux disk partition related

The composition of the concept

disk: track, cylinder, sector

Track : concentric circle
sector: the smallest unit of hard disk data storage (512byte)
Cylinder: the part between tracks?

Disk partition

MBR (Master Boot Record): place the information area of ​​the hard disk. MBR is the most important area of ​​the entire hard disk. Once the physical entity of the MBR is damaged, the hard disk is almost scrapped. Generally speaking, MBR has 512 bytes. , and can be divided into two parts. The first part has 446 bytes and is used to store the boot code, that is, the bootloader. The second part has 64 bytes, which is used to store the disk partition table. Among them, the information of each partition needs to be recorded with 16 bytes. Therefore, a hard disk can have up to 4 partitions, which are called primary partitions and extended partitions.

Generally speaking, "hard disk partition" refers to modifying the disk partition table, which defines "the nth disk block is from the xth cylinder to the yth cylinder". Therefore, when the system wants to read the nth disk block, it is to read the information from the xth cylinder to the yth cylinder on the hard disk. Because a hard disk has at most four partitions, and there can only be one extended

partition, it is usually formed in the form

of . The partition table can only be generated by defining four partitions. If you want to divide the disk into five partitions, what should you do? Define some partition definitions into other partition tables by defining extended partitions, which are actually logical partitions. surface. Extended partitions cannot be used directly, they also need to be divided into logical partitions. Benefits of Disk Partitioning







Why partition the hard disk? Because a large-capacity hard disk is like a large cabinet, there are many ways to store various files in this cabinet, but in order to facilitate management and use, the large cabinet is generally divided into relatively independent "compartments" or "compartments" one by one. drawers", never use a large cabinet as a large drawer. Hard disk partitions, like the use of large cabinets, divide them into logical partitions one by one (expressed as logical drive letters one by one), which has absolutely incomparable advantages without partitioning.

Linux default partitionable

boot partition
This partition corresponds to /boot directory, about 100MB. This partition stores Linux Grub (bootloader) and kernel source code. The user can access the partition by accessing the /boot directory. In other words, the operation of the user to the /boot directory is to operate the partition.

swap partition
This partition has no corresponding directory, so users cannot access it.
The swap partition under Linux is virtual memory. Virtual memory is used to store temporary data in the swap partition when the system memory space is insufficient, wait for a period of time, and then transfer the data into the memory for execution. Therefore, virtual The memory only temporarily stores data, and there is no execution in this space.

Virtual memory refers to simulating an area on the hard disk as memory. Therefore, the actual physical address of virtual memory is still on the hard disk. Virtual memory, or swap partition, can only be accessed by the system, and its size is twice the size of physical memory.

Root partition
In Linux operating system, all directories except /boot directory correspond to this partition. Therefore, users can access this partition by accessing all other directories except /boot directory.

The difference between windows and linux
In the Windows operating system, the physical addresses are first separated, and then a directory is created on the partition. In the Windows operating system, all paths start from a drive letter, such as C://program file.
Linux is just the opposite, there is a directory first, and then the physical address is mapped to the directory. In Linux operating system, all paths start from the root directory.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326785875&siteId=291194637