LINUXT system disk Partitioning knowledge

Source: Internet
Author: User

L023
Hard disk Size: 512 bytes number of headsNumber of sectors * magnetic degrees
Head: Head
Track: Tracks
Cylinder: Cylinder surface
Sector: Sector, 512bytes (MBR)

Partitioning tools
Partitions below fdisk 2T
Gdisk parted if the hard drive exceeds 2T, the Gdisk parted can be used.





Http://www.cnblogs.com/duzhaoqi/p/7392327.html
Mechanical hard drives and solid-state drives
Mechanical HDD (HDD):

Hard disk drive, which is a traditional HDD, consists of a few parts: platters, heads, disc spindles and control motors, head controllers, data converters, interfaces, caches, etc. All the discs in the mechanical hard disk are mounted on a rotating shaft, each disc is parallel, 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 head hair, all the heads are connected to a head controller, and the head controller is responsible for the movement of the heads. The head can move along the radius of the disc, plus the disk rotates at a high speed of thousands of RPM, the head can be positioned at the specified position of the disk for data read and write operations. The data is written to the disk by the magnetic flux through the magnetic head by the electromagnetic flow, or it can be read in the opposite way. Hard drive for precision equipment, air entering the hard drive must be filtered





Solid-state drives (SSDs):

Solid state drives, a hard disk made of a solid electronic memory chip array, consisting of a control unit and a memory unit (Flash chip, DRAM chip). SSD in the interface specification and definition, function and use of the same as the ordinary hard disk, in the product shape and size also with ordinary hard disk consistent device files





Compared to HDD, SSD has obvious advantages in shock resistance, transmission rate, power consumption, weight and noise, SSD transfer rate performance is twice times of HDD. HDDs have an absolute advantage over SSDs in terms of price, capacity, and service life

Hard disk price, data priceless, the current SSD can not completely replace HHD





Hard Disk interface type
Parallel:

ide:133mb/s

scsi:640mb/s

Serial:

sata:6gbps

sas:6gbps

usb:480mb/s

Rpm:rotations

Per minute





Hard disk storage Terminology
Head: Head

Track: Tracks

Cylinder: Cylinder surface

Sector: Sector, 512bytes (MBR)





On a Linux device, the disk is a device-numbered

Device number:

Main device number: Major numbers, identifying device types

Second device number: Minor numbers, identifying different devices under the same type





Device file name for disk device:/dev/dev_file

SCSI, SATA, SAS, Ide,usb:/DEV/SD

Virtual Disk:/DEV/VD

Different disk identities: A-z,aa,ab ...

/DEV/SDA,/dev/sdb, ...

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

/DEV/SDA1,/dev/sda5





Mechanical hard disk structure
Chs/lba addressing
CHS

C:cylinder

H:head

S:sector

With 24bit bit addressing

The first 10 bits represent cylinder, the middle 8 represents head, and the next 6 bits represent sector.





One cylinder size:

512bytes (Sector) 2^6 (sector/track) 2^8 (head)

=8388608bytes=8192kb=8mb

Maximum addressing space 8GB

LBA (Logical Block Addressing)

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

LBA with 48 bit bit addressing

Maximum addressing space 128PB





Since the address space of CHS is within approximately 8GB, it is possible to use CHS addressing or LBA addressing when disk capacity is less than about 8GB, and only LBA addressing is used when disk capacity is greater than approximately 8GB





CHS vs. LBA conversion

Number of #c, #h, #s分别是磁柱, heads, sectors

#lba是逻辑区块编号

H=heads per cylinder, number of heads per magnetic column

S=sectors per track, number of sectors per tracks

#lba = (#cH + #h)s+ #s-1

LBA can correspond to CHS using the following formula:

#c = #lba/(s*h)

#h = (#lba/S)%H

#s = (#lba%s) +1

For example:

CHS Total =[600, 10, 84], #lba=1234 the corresponding CHS number:





#c =1234/(84*10) =1

#h = (1234/84)%10=4

#s = (1234%84) +1=59

So:

#chs = (1, 4, 59)

Disk partitioning
Why partitioning
Optimizing I/O performance

Implementing disk space Quota limits

Improved repair speed

Isolating systems and programs

Install multiple OS

Using different file systems

Partitioning method
Two ways to partition: MBR, GPT

MBR partition format
Mbr:master boot Record, 1982, using 32-bit representation of sector number, partitions not exceeding 2T

How to partition: Press Cylinder

0 Track 0 Sector: 512bytes

446bytes:boot Loader

64bytes: Partition Table

16bytes: Identify a partition

2bytes:55aa

4 primary partition, 3 primary partition +1 extension (n logical partition)









Standard MBR structure

Site location

Function

Describe

0000-0088

Master Boot Program

Master Boot Program

0089-01bd

Error information Data area

Error area

01be-01cd

Partition 1 (16 bytes)









Partition table

01ce-01dd

Partition 2 (16 bytes)

01de-01ed

Partition 3 (16 bytes)

01ee-01fd

Partition 4 (16 bytes)

01FE

55





End Flag

01FF

Aa





Hard disk partition structure information

Number of bytes stored

Content and Meaning

1th byte

Boot flag with a value of 80H representing the active partition, and 00H representing the inactive partition

Section 2,3,4 bytes

The starting magnetic number of this partition, the sector code, the cylinder number. which

Magnetic number-2nd byte

Sector code-3rd byte low six bits

Cylinder number-3rd byte high 2 bit, 4th byte 8 bit

5th byte

Partition type character:

00h-indicates that the partition is not in use

06h-fat16 Basic Partitions

0bh-fat32 Basic Partitions

05h-Extended Partition

07H-NTFS partition

0fh-(LBA mode) extended partition (83H for Linux partition)

Section 6,7,8 bytes

This section of the end of the magnetic number, sector code, cylinder number. which

Magnetic number-6th byte

Sector code-7th byte low six bits

Cylinder number-7th byte high 2 bit, 8th byte 8 bit

Section 9,10,11,12 bytes

Partition Start relative Sector code

Section 13,14,15,16 bytes

Total number of sectors in the partition





GPT partition format
Gpt:guid (Globals Unique Identifiers)

Partitiontable supports 128 partitions, uses 64-bit, supports 8Z (512byte/block) 64Z (4096byte/block) using 128-bit UUID (universally Unique Identifier) Indicates that the disk and partition GPT partition tables are automatically backed up at the head and tail two parts, and have CRC check bit UEFI (Unified extended Firmware Interface) hardware support GPT, which enables the operating system to boot





GPT partition information is in the partition, not like MBR in the main boot sector, in order to protect GPT from the MBR class Disk management software, GPT in the main boot sector to establish a protection partition (protective MBR) MBR partition table (this partition is not necessary), This type of partition is identified as 0xEE, the size of the protected partition under Windows 128mb,mac OS x 200MB, in the window Disk Manager named GPT protected Partition, you can have MBR class Disk management software to the GPT as an unknown format of the partition, Instead of mistakenly treating it as an unpartitioned disk.

In addition, to protect the partitioned table, the GPT partition information is saved at the head and tail of each partition so that the partition table is lost and then resumed.

LINUXT system disk Partitioning knowledge

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.