This article mainly introduces the naming rules for hard disks and partitions in Linux.
Generally, for the IDE hard disk, the hard disk on the master of the first ide slot is/dev/hda, the hard disk on slave is/dev/HDB, and the master of the second slot is
The hard disk on is/dev/HDC, and the hard disk on slave is/dev/HDD. For a SCSI hard disk, it becomes/dev/SDA ~ /Dev/SDD.
Each hard disk can only have up to four primary partitions. Generally, to have more partitions, we will set extended partitions and then set logical partitions in the extended partitions. The four primary partitions correspond to/dev.
/Hda1 ~ /Dev/hda4, and the logical partitions start from hda5. Extended partitions, as a container of logical partitions, also occupy hda1 ~ One in hda4.
The following uses fdisk to view the partition information on my machine:
Disk / Dev / Hda: 4294 MB, 4294967296 Bytes
255 Heads, 63 Sectors/ Track, 522 Cylinders
Units = cylinders 16065 * 512 = 8225280 Bytes
Device boot start end blocks ID system
/ Dev / Hda1 * 1 13 104391 83 Linux
/ Dev / Hda2 14 144 1052257 + 82 Linux swap / Solaris
/ Dev / Hda3145 273 1036192 + 83 Linux
/ Dev / Hda4 274 522 2000092 + 5 Extended
/ Dev / Hda5 274 522 2000061 83 Linux
We can see that I shared three physical partitions, hda1, hda2, hda3, and an extended partition hda4, and set a logical partition hda5 in hda4.
Note that replacing the master and slave of the hard disk will change the operating system's recognition of the hard disk, so the system will often be inaccessible, to solve this problem, you may need to manually modify grub, fstab, and other locations, which is very prone to errors. Therefore, it is best not to change the slot location of the hard disk easily.