Disk management in linux: (1) disk structure, partitions, and linux

Source: Internet
Author: User

Disk management in linux: (1) disk structure, partitions, and linux

Recently, I have compiled some knowledge about disk management and found that there are still a lot of data. I have divided it into four parts to share with you:

1. Disk structure, understanding partitions

2. Manage partitions and format the File System

3. mount and mount the/etc/fstab configuration file.

4. Peripheral connection and common tools

This article begins with the basic knowledge of disks-disk structure and partitions. (The basics will be boring, but the basics are still very important, so I hope you will learn more)

I. device type:

(1) block device: block, access unit: block, disk

Character device: char, access unit "character", keyboard


(2) mechanical and solid state Disks

HDD): Is the traditional ordinary hard drive, mainly from:Disk, head, Disk rotating shaft and control motor, head controller, data converter, interface, cache and other components. All disks on the HDD are attached to one rotating axis, and each disk is

There is a head on the storage surface of each disk. The distance between the head and the disk is smaller than the diameter of the first wire. All the heads are connected to one head controller, the head Controller is responsible for the movement of each head. The head can move in the radius of the disk. When the disk is rotated thousands of times per minute, the head can be positioned at the specified position of the disk for Data Reading and writing. The data is written to the disk by the electromagnetic stream through the magnetic head to change the polarity. The data can also be read in the opposite way. The hard disk is a precision device and the air entering the hard disk must be filtered out.

SSD): Solid State ElectronicsMade from storage chip ArraysThe hard disk consists of a control unit and a storage unit (FLASH chip and DRAM chip. SSD is identical to common hard disks in terms of interface specifications, functions, and usage,

The product shape and size are also consistent with that of a General hard disk.


Compared with HDD, SSD has obvious advantages in anti-cracking, transmission rate, power consumption, weight, and noise,SSD transmission rate is twice the performance of HDD

Compared with SSD,HDD has absolute advantages in price, capacity, and service life

Hard Disks are valuable and data is priceless. At present, SSD cannot completely replace HHD



(3) Device Files

① Name the device file of the disk device:/dev/DEV_FILE

② Different disk IDs: a-z, aa, AB...


Different partitions on the same device: 1, 2 ,...


③ Hard disk storage terminology

Head: head

Track: track

Cylinder: cylinder

Secotr: Sector, 512 bytes (minimum unit)

④ HDD disk structure


512 bytes * 64 sector/track * 1024 tracks/disk 256 head (Disk) 8 GB

Number of slice sectors/track/Disk Surface

(512 bytes * 64 sector /track * 256) Size of a cylindrical Disk: 8 M * 1024 track = 8G



(4) How to Use partition space? (Each step will be explained in detail later)

① Device recognition

② Device partitioning

③ Format the file system type

④ Create entries in the/etc/fstab file

⑤ Mount a New File System


(5) Why partition?

① Optimized I/O performance

② Implement disk space quota restrictions

③ Improve the repair speed

④ Isolate systems and programs

⑤ Install multiple operating systems

6. Use different file systems


(6) Two addressing methods: CHS and LBA


24-bit addressing

The first 10 digits represent cylinder, the middle 8 digits represent head, And the last 6 digits represent sector. .

Maximum addressing space 8 GB

LBA (logical block addressing ):

LBA is an integer that completes disk addressing by converting to the CHS format

LBA uses 48 bit addressing

Maximum addressing space: Pb

Because the address space of the CHS addressing mode is less than 8 GB, you can use the CHS addressing mode or LBA addressing mode when the disk capacity is less than 8 GB; when the disk capacity is greater than about 8 GB, you can only use the LBA addressing mode.


II. Introduction to partitions

Two partitioning Methods: MBR and GPT

(1) MBR: Master Boot Record. In June 1982, 32 bits are used to represent the number of sectors. The number of partitions cannot exceed 2 TB.

How to partition: by the cylinder

0 channels 0 sectors: 512 bytes

446 bytes: boot loader

64 bytes: partitioned table

16 bytes: identifies a partition

2 bytes: 55AA, ending mark

4 primary partitions; 3 primary partitions + 1 extension (N logical partitions)


Partition Table (DPT) Structure



(2) The Hard Disk Master Boot Record MBR consists of three parts:

① The main Bootstrap program (offset h--0088h) is responsible for loading from the active partition and running the System Bootstrap program.

Error information data area. The offset address 0089H--00E1H indicates the error message, and 00E2H--01BDH indicates 0 bytes.

② The Partition Table (DPT, Disk Partition Table) contains four Partition items, the offset address 01BEH--01FDH, each Partition Table item is 16 bytes long, a total of 64 bytes

Partition item 1, partition item 2, partition item 3, partition Item 4

③ The ending flag. The two byte values of the Offset address 01FE--01FF are the ending flag 55AA.



(3) GPT partitioning

① GPT: GUID (Globals Unique Identifiers) partitiontable supports 128 partitions, 64-bit, and 8Z (512 Byte/block) 64Z (4096 Byte/block)

Use the 128-bit UUID (Universally Unique Identifier) to indicate that the GPT Partition Table is automatically backed up at the beginning and end of the disk and partition, with the CRC check bit

UEFI hardware supports GPT to enable the Operating System

② The EFI part can be divided into four areas: EFI Information Zone (GPT header), partition table, GPT partition, and backup Area



This is the foundation of the first article, and the next article is a wonderful operation. Do not miss it ~~~



          I hope to help you. Please let me know if you have any errors ~


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.