First, the hard disk
The function of a hard disk is quite simple but important, and it is responsible for recording the various data required by the system. The hard disk record data has two aspects, one is the hardware aspect storage principle and the structure, on the other hand is the software aspect data and the file system. The main behavior of a hard disk is to store and remove data.
The basic components that make up the hard disk can be divided into the actual disk (Plat platter) used to store the data, the head (head) to read the data, the motor to help the head to find the reading position, etc. These components form a structure that can read data at any location on a different disk.
Second, disk (Plat platter)
A disk is a part of a hard disk that is really used to store information, and looks like a disc, with holes in the middle for the motor to run through (the hard disk must be rotated to find data), and each hard disk has at least one disk.
Generally, the size of the disk in the hard disk, currently mainly 3.5 inches and 5.25 inches two, and the notebook computer uses a disk size is generally 2.5 inches, some even only 1 inches, large disk shock resistance is poor, and generally the larger the disk drive performance is worse (because the disk rotation speed is reduced, Events that search for data on disk grow longer, but because of the large surface area, there is more data to store.
Most disks are made of aluminum, and because the disk is running at a high speed, the disk surface must be fairly smooth, and the weight distribution must be fairly uniform. The surface of the disk aluminum alloy, then coated with a layer of magnetic material for data writing (write or read data is actually in this layer of magnetic material, and aluminum-independent), the magnetic material is coated with plating or sputtering method, so the distribution is fairly uniform, and finally on the magnetic material, will add a thin layer of protective film, To provide lubrication to avoid damage caused by abnormal head-to-disk contact. Both sides of the disk can be used, so there are two heads on each disk to read the data.
Digital information can be sensed on disk because magnetic changes can be made to specific areas on the disk, so we only need to take advantage of a number of devices that can sense magnetic changes, which can be read in accordance with the magnetic changes in specific areas of the disk.
Three, hard disk data unit 1. Tracks (track)
A disk is divided into multiple tracks, in fact a track is a circle of data on the disk (that is, the same disk and all domestic tracks will be arranged in concentric circles), like a ring in the tree rings. So the smallest amount of data can be recorded on the track closest to the inner ring (the smaller the circle is because the closer the inner ring is).
2. Cylinder (Cylinder)
Multiple disks rotated around the motor rotation axis, each with two disk faces (slices), with multiple tracks (track) in each disc. A track of the same size on multiple disks forms a cylinder on a vertical space, similar to a pile of hula hoop (tracks) of the same size, from the end of the sleeve to the head, visually constituting a hollow tube (cylinder).
3. Head (Header)
When you need to use data from a disk, you need to use the head to read or write data. So the head can be said to be the interface between the disk and other digital devices in the computer. The head is responsible for converting the digital bit data into magnetic changes so that the data is written to the disk, and the reverse action can read the data from the disk. The quality of the head seriously affects the performance of the entire hard drive, for example, when we increase the density of the disk and the speed of disk rotation to increase the rate of data transmission, it is necessary to have a precision magnetic head to read the data correctly, so whenever the development of new technology head, usually drive the entire drive efficiency improvement.
4. Sector (Sector)
In fact, only the data is divided into the track, not to achieve the purpose of segmenting the data area (the size of the data in a track is still quite large, even the smallest inner circle of the track is the same), so we will then divide the track into many sectors. Since the data capacity of the inner ring track is small, the number of sectors separated by the inner ring track will be less than that of the outer ring track. A sector is the smallest unit of data that can be read on a disk , a size of 512Bytes, which means that 1 bytes of files, regardless of whether the volume of data in this sector is 2KB or 16KB, is the size of a sector. The data inside each sector is treated as continuous data, so when you actually access it, you need to specify the address of the data in the sector to find the data you need.
Four, the hard disk in the Linux representation
All Linux devices are abstracted as a file and stored in the/dev directory.
Depending on the interface can be divided into: IDE, SATA, SAS, SCSI, USB.
The hard drive name is typically: device type + [A-z], where [A-z] represents the first few hard drives.
The name of the IDE hard disk is typically: hd[a-z] . The names of SATA hard drives, SAS hard drives, SCSI hard drives, and USB hard drives are typically: sd[a-z] . For example, the first SATA hard drive is named/DEV/SDA, the second SATA hard drive is named/dev/sdb, and so on ...
Five, partition
The disk of a hard disk is logically divided into zones, each of which is used as a separate disk for easy management.
Different partitions are represented by: "Device name + partition number", such as Sda1,sda2.
The main partitioning mechanism is MBR and GPT.
Six, MBR (master boot record, master boot recording)
MBR is a traditional partitioning mechanism applied to most PC devices that use BIOS booting (Apple uses EFI)
- MBR supports 32-bit and 64-bit operating systems
- MBR supports a limited number of partitions
- MBR supports hard drives up to 2T, more than 2T hard drives can only use 2T space (with third-party workaround) because the MBR has only 32 bits of addressable space
MBR structure:
Occupies the first 512 bytes of the hard disk, which is the 0 cylinder 0 Track 1 sector. The first 446 bytes are boot code, different operating system boot code is not the same. Then there are 4 16-byte primary partition table information. The last 2 bytes are AA, which is the boot identifier of the operating system.
MBR Partition:
Primary partition: Up to 4 primary partitions can be created.
Extended partition: An extended partition occupies a primary partition location.
Logical partitioning: Logical partitions are created based on extended partitions. Linux supports a maximum of 63 IDE partitions and 15 SCSI partitions.
Seven, GPT (GUID Partition table, globally unique identity partition table)
GPT is a newer partitioning mechanism that solves many of the drawbacks of the MBR.
- GPT supports more than 2T of hard drives
- GPT Backward-compatible MBR
- GPT partitions must use a 64-bit system
- Both MAC and Linux systems support GPT Partitioning
- Windows7 64-bit, WindowsServer2008 64-bit support GPT partition
Reference book: "Computer DIY Hardware Principle/upgrade/optimization"
Reference link: Linux Disk basic concepts (disk, partition, MBR, GPT)
Linux entry record: Vi. Linux hardware-related concepts (hard disk, disk, track, cylinder, head, sector, partition, MBR, GPT)