Sorted:Huake XiaotaoHttp://www.cnblogs.com/hust-ghtao/
We all know that a disk can be divided into multiple partitions. In Windows, you may have a disk and partition it into C, D, and E disks. The C, D, and E are partitions. However, Linux devices all exist as files. What is the partition file name? What are the restrictions on disk partitioning?
1. Relationship between the disk connection method and the device file name
There are two common disk interfaces for personal computers: The IDE interface and the SATA interface. Currently, the mainstream is the SATA interface. We call a device that can connect to the IDE interface as an IDE device, whether it is a disk or a CD.
For ide interfaces, the host provides two ide interfaces, each of which connects two devices. Therefore, a host can connect up to four devices. The IDE devices of each interface are classified into master and slave. The file names of the four devices are shown in the table.
For SATA interfaces, disk interfaces such as SATA, USB, and scsia are all driven by the SCSI module. Therefore, the file names of these interfaces are all driven by the SCSI module, therefore, the disk device file names of these interfaces are in the/dev/SD [A-p] format. However, unlike the IDE interface, the file names of disk devices on the SATA/USB interface do not have a certain order, which is determined by the order in which the Linux kernel detects the disk.
2. Disk Composition
- Disk components include:
- # Circular Disk (mainly the data record );
- # Head of the mechanical arm and the manipulator arm (data on the disk can be read and written );
- # The spindle motor can rotate the disc so that the head of the mechanical arm can read and write data on the disc.
- The composition of the disc:
- $ The slice is the smallest physical storage unit, with each slice 512b;
- $ Create a partition, that is, a cylindrical disk. A Cylindrical disk is the smallest unit of the partition;
- $ The first sector is the most important, with the hard disk Master Boot Record MBR and partition table, among which mbr446b and Partition Table 64b.
- The file names of disks with various interfaces in Linux are:
- (1)/dev/SD [A-p] [1-15]: indicates the disk file name of SCSI, SATA, USB, Flash, and other interfaces.
- (2)/dev/HD [a-d] [1-63]: The Disk File Name of the IDE interface.
3. Disk Partition Table
How is the disk partitioned? We can't cut it with a saw! The cylinder is the smallest unit of the file system and the smallest unit of the partition. We use the method of referring to the cylinder number for partitioning. In fact, the essence of a partition is to set the start and end cylindrical numbers for each partition in the partition table.
In the 64b capacity of the partition table, there are four groups of record areas. Each record area records the numbers of the start and end columns of the corresponding partition. If you look at the hard disk in the form of a long bar and then look at the cylindrical column, then the 64b record segment:
If the name of the hard drive device is/dev/hda, the device names of the four partitions in Linux are shown as follows, and a number is followed by the file name, this number is related to the partition location.
- P1:/dev/hda1
- P2:/dev/hda2
- P3:/dev/hda3
- P4:/dev/hda4
Because the partition table has only 64 B and can only accommodate up to 4 partitions, these four partitions are called primary partitions or extended partitions.
Summary:
- (1) In fact, the so-called partition is only for the 64 B partition table.
- (2) The default Partition Table of the hard disk can only write information about the four partition areas.
- (3) The information of these four groups is called the primary or extended partition.
- (4) the smallest unit of a partition is a cylindrical disk.
- (5) When the system needs to write data to the disk, it must refer to the disk partition table to process data for a partition.
We have introduced the basic knowledge of partitioning. Let's look back and find out why partition is required?
- (1) data security. Different partitions isolate different types of data to ensure data security and facilitate management.
- (2) system performance. As the partition divides the dataset into the segments of a cylindrical table, the speed and performance of data reading will be improved because the data set is concentrated.
Disk Partition (1)