Properly plan hard disk partitions-Linux Enterprise applications-Linux server application information. The following is a detailed description. Reasonable planning of Hard Disk Partitions
Abstract:
It is reasonable to plan the partition structure and how to divide a hard disk (including a mobile storage device). To reduce the risks and unnecessary troubles caused by unreasonable hard disk division, it is necessary to repeat how to plan the partition structure of a hard disk;
I. Calculation of Hard Disk types, physical geometric structures, hard disk capacity, and partition size
1. Hard Disk Type and physical GEOMETRIC STRUCTURE
Hard Disks are mainly SCSI, IDE, and popular SATA;
Any kind of hard disk production must be standard; with the corresponding standard upgrade, hard disk production technology is also upgrading; such as SCSI standard has gone through the SCSI-1, SCSI-2, SCSI-3; at present, we often see in the server site Ultral-160 is based on SCSI-3 standards; IDE follows the ATA standards, and the current popular SATA, is the ATA Standard upgrade version; the IDE is a parallel port device while the SATA is a serial port. The objective of SATA development is to replace the IDE;
The physical geometric structure of a hard disk is composed of a disk, a disk surface, a cylindrical disk, and a sector. A hard disk is enclosed by several discs, forming a decent bar; each disc has an upper/lower surface. The head is in contact with the disk surface to read data;
2. Algorithm of hard disk capacity and partition size;
The following information can be found through fdsik-l:
Disk/dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Device Boot Start End Blocks Id System
/Dev/hda1*1 765 6144831 7 HPFS/NTFS
/Dev/hda2 766 2805 16386300 c W95 FAT32 (LBA)
/Dev/hda3 2806 9729 55617030 5 Extended
/Dev/hda5 2806 3825 8193118 + 83 Linux
/Dev/hda6 3826 5100 10241406 83 Linux
/Dev/hda7 5101 5198 787153 + 82 Linux swap/Solaris
/Dev/hda8 5199 6657 11719386 83 Linux
/Dev/hda9 6658 7751 8787523 + 83 Linux
/Dev/hda10 7752 9729 15888253 + 83 Linux
Heads is the disk surface, sectors is the slice, cylinders is the cylinders, and each slice is 512 bytes, that is, 0.5 kb;
Through the above example, we found that the hard disk has 255 disk faces, 63 sectors, and 9729 cylinders. Therefore, the entire hard disk volume conversion formula should be:
Number of magnetic surfaces x number of sectors x size of each sector 512 x number of cylinders = hard disk volume (unit: bytes)
Tip:
Since hard disk manufacturers and Operating System Conversion are not the same, hard disk manufacturers use a 10-digit conversion method, while the operating system uses a 2-digit conversion method. Therefore, when converting to M or G, the results of different algorithms are different. Therefore, our hard disk is sometimes labeled as 80 GB, which is a few MB in the operating system;
In the above example, the hard disk manufacturers algorithm and operating system arithmetic comparison:
Hard Disk manufacturers: 80023749120 bytes = 80023749.120 K = 80023.749120 M (convert to large units, divide each time by 1000)
Operating System: 80023749120 bytes = 78148192.5 K = 76316.594238281 M (conversion to large units, divided by 1024 each time)
Ii. Hard Disk Partition criteria and reasonable partition structure
1. Hard Disk Partition criteria
A hard disk partition consists of a primary partition, an extended partition, and a logical partition;
Therefore, we must follow this standard for Hard Disk Partitions. the maximum number of primary partitions (including extended partitions) is four. Primary partitions (including extended partitions) the number of Hard Disk Master Boot records determined by MBR (Master Boot Recorder), MBR stores startup management programs (GRUB, LILO, NTLOARDER, etc.) and Partition Table records.
The extended partition is also a primary partition;
Extended partitions can contain more logical partitions;
Therefore, the range of the primary partition (including the extended partition) is from 1 to 4, and the logical partition is from 5;
For example:
Device Boot Start End Blocks Id System
/Dev/hda1*1 765 6144831 7 HPFS/NTFS
/Dev/hda2 766 2805 16386300 c W95 FAT32 (LBA)
/Dev/hda3 2806 9729 55617030 5 Extended
/Dev/hda5 2806 3825 8193118 + 83 Linux
/Dev/hda6 3826 5100 10241406 83 Linux
/Dev/hda7 5101 5198 787153 + 82 Linux swap/Solaris
/Dev/hda8 5199 6657 11719386 83 Linux
/Dev/hda9 6658 7751 8787523 + 83 Linux
/Dev/hda10 7752 9729 15888253 + 83 Linux
2. Representation of hard disk devices (including mobile storage devices) in Linux or other Unix-like systems;
IDE Hard Disks are generally expressed as hd * in Linux or other Unix-like systems, such as hda, hdb ......, we can use fdisk-l to check whether fdisk-l prevails;
SCSI and SATA hard disks are usually represented as sd * in Linux, for example, sda and sdb ...... take fdisk-l as the standard.
The mobile storage device is represented as sd * in linux, for example, sda, sdb... is subject to fdisk-l.
3. Reasonable planning and partitioning
One of the partition structures: four primary partitions without extended partitions;
This situation works, and the degree of freedom of partitions is relatively large. partitions are not restricted and can be divided into more than five partitions;
2) The most reasonable partitioning method;
The most reasonable partition structure: the primary partition is in the front, the extended partition is in the back, and then the logical partition is divided in the extended partition; the number of Primary partitions + the number of extended partitions should be controlled within four; for example, the following partition is better;
Based on this title, let's take a look at our example. Does it comply with this standard?
Device Boot Start End Blocks Id System
/Dev/hda1*1 765 6144831 7 HPFS/NTFS
/Dev/hda2 766 2805 16386300 c W95 FAT32 (LBA)
/Dev/hda3 2806 9729 55617030 5 Extended
/Dev/hda5 2806 3825 8193118 + 83 Linux
/Dev/hda6 3826 5100 10241406 83 Linux
/Dev/hda7 5101 5198 787153 + 82 Linux swap/Solaris
/Dev/hda8 5199 6657 11719386 83 Linux
/Dev/hda9 6658 7751 8787523 + 83 Linux
/Dev/hda10 7752 9729 15888253 + 83 Linux
Postscript:
Writing partition basics mainly aims to let new students know what a reasonable partition structure is. If hard disk partitioning is well planned, it also saves a lot of trouble for learning;
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.