Linux primary partition, extended partition, logical partition connection and Difference

Source: Internet
Author: User
Tags ide hard drive dell r710

Basic ConceptsThere are three types of hard disk partitions, primary partition, extended disk partition, logical partition. A hard disk primary partition has at least 1, a maximum of 4, and an extended partition can be no more than 1. and the primary partition + extended partition must not exceed 4 total. A logical partition can have several. The primary partition that is activated under Windows is the boot partition of the hard disk, and he is the first partition of the hard disk, and the normal division is the C zone. Both the primary and logical partitions under Linux can be used to put the system on, booting the OS, and grub will be compatible with Windows system boot. After dividing the main partition, the rest of the sections can be divided into extended partitions, which are generally divided into extended partitions, or not fully divided, and the remainder is wasted. However, the extended partition is not used directly, and is used in logical partitioning, so the extended partition can be divided into logical partitions. Their relationship is a contained relationship, and all logical partitions are part of the extended partition. In Linux, the first hard disk partition is HDA partition, the primary partition number is hda1-4, and the logical partition starts from 5. Capacity of the hard disk = capacity of primary partition + capacity of extended partition partition capacity = The capacity of each logical partition and the primary partition can also become a "boot partition", which is identified by the operating system and the motherboard as the first partition of the hard disk. So the C-disk will always be in the first place on all partitions. MBR (master boot Record) of the partition table (primary partition table) can only hold 4 partitions, if you want to divide more partitions will be an extended partition table (EBR), the extended partition table is placed on a system ID 0x05 primary partition, the primary partition is an extended partition, the extended partition can be divided into several partitions, Each partition is a logical partition2 extended partitions and logical partitions Both DOS and FAT file systems were originally designed to support up to 24 partitions on a single hard drive, using a 24 drive letter from C to Z, respectively. However, the partition table in the master boot record can only contain up to 4 partition records, in order to solve this problem effectively, DOS Partition command Fdisk allows the user to create an extended partition and then establish up to 23 logical partitions within the extended partition, each of which is assigned a separate drive letter. Can be used by the computer as a standalone physical device. Information about logical partitions is stored within the extended partition, and information about the primary and extended partitions is stored in the MBR of the hard disk. This means that no matter how many partitions a hard disk has, its master boot record contains only the primary partition (that is, the boot partition) and the extended partition two partitions.

In the process of installing CentOS5.3, you will encounter a disk partition interface, the drop-down menu has 4 options, you do not choose the default, open the drop-down menu, select the last item (translated into Chinese means: Create a custom split mode). Then select the confirmation in the lower right corner and set up/////////and swap in the next dialogue screen, after completion. Confirm the split area after setting.

In order to emphasize the emphasis, the important content of the picture, write again.

/root directory ext3 hda1

/home User Directory ext3 hda2

Swap swap partition Swap Hda3

Explanation of the HDA1:

Hd:ide hard drive. If it is a SCSI hard disk, then SD, this can only remember, there is no better way.

A:: First hard drive. If it is a second hard disk, then B, and so on c,d ...

1: Primary partition. Where 1,2,3,4 are the primary partition (or extended partition, primary partition + extended partition <=4, this is because the hard disk has 64 bytes to describe the partition, each takes up 16 bytes), from the 5th logical partition, maximum to 16, the new Linux version Unlimited

The relationship between disk capacity and primary partition, extended partition, logical partition:

Capacity of the hard disk = capacity of primary partition + capacity of extended partition

Capacity of the extended partition = The sum of the capacity of each logical partition

A physical hard disk can only have: one to four primary partitions (but only one of which is the active primary partition), or one to three primary partitions, and one extended partition. correspond to HDA1,HDA2,HDA3,HDA4 respectively.

Linux stipulates that each hard disk device can have up to 4 primary partitions (including the extended partition), any one of the extended partition will occupy a primary partition number, that is, on one hard disk, the primary partition and the extended partition total is 4.

The confusion I had was: I didn't know that the extended partition would occupy the primary partition (up to 4) a partition number.

My summary: A hard disk can only set the primary partition, then the primary partition can be set up 4 area code. It can also be set to the primary partition + logical partition, which is also a maximum of 4 partition numbers, but becomes 4 = 3 + 1. Where 4 is the primary partition and the extended partition add up to 4, 3 is the primary partition, can be less than or equal to 3, and 1 is the extended partition number, which occupies a primary partition number. From 5 to 16, all are logical partitions. If there is only one 5, the extended partition is no longer partitioned, and the extended partition is the logical partition (the total number of disks in the extended partition equals the total number of disks in a logical partition). It is common for extended partitions to be partitioned into several logical partitions, identified by numbers such as 5,6,7,8.

Again to understand the above partition:

/root directory ext3 hda1 Active primary partition, start OS

/home User directory ext3 hda2 primary partition

Swap swap partition swap HDA3 primary partition

This may imply that there is an extended partition, which should be hda4. Because you can also set Hda5,hda6 in the back,......

It is also possible that there are only 3 primary partitions (up to 4) that are already full of disk capacity.

Assuming that your Linux operating system has only 16000M of disk space, then allocate disk space as set out above. This will not extend the partition.

HDD partition Memo (primary partition, extended partition and logical partition) and Linux hard disk partitioning tool parted introduction

We know that the first sector of the hard disk, which is the No. 0 sector, is used to hold the master boot record (MBR), so it is also called an MBR sector. A sector is 512 bytes, so the MBR size is also 512 bytes, the specific data structure is: 446-byte boot code, 64-byte partition table and 2-byte signature value "55AA". Since the MBR partition table has only 64 bytes, this determines that it can store only 4 partition records. This is why a hard drive can have up to 4 "primary partitions". Remember, "primary partition" refers to the partition that is recorded in the MBR partition table of the master boot record, except that the primary partition is not special, but some old operating systems in the past often cannot be installed on partitions outside the primary partition, so the primary partition is labeled "Specifically for installing the operating system".

We already know that the sub-table area in the MBR can only hold 4 partitions (that is, 4 primary partitions), how the system divides more than 4 partitions? A straightforward and simple idea is to subdivide one of the main partitions and derive a two-level partition table. Yes, the primary partition that is used for two partitions is the "extended partition", and the two-level partition below It is the "logical Partition".

about how to use the parted tool in Linux under the partition, here reprinted an article, explained very clearly. Original source: http://dngood.blog.51cto.com/446195/647702/

A key word

limitations of MBR and 2TB
When using Fdisk to create a partition, we can only create a partition of 2TB size, if your disk (array) is larger than 2TB, only by dividing multiple partitions to make full use of disk capacity, which is less than the 2TB partition of friends, but for the use of more than 2TB partition ( For example, 5TB partition) Friends will encounter problems, to break through this limit, we first understand the next MBR (Master Boot Record) and GPT (GUID Partition Table).


MBR
The master boot record, which is also called the boot sector, is the first sector that must be read when the computer accesses the hard disk, and its three-dimensional address on the hard disk is (cylinder, head, sector) = (0,0,1).

MBR is produced by a partitioner (such as fdisk,parted), which does not depend on any operating system, and the hard drive boot program can also be changed to enable multi-system booting.

The structure of the master boot record lets you know that it contains only a 64-byte hard disk partition table. Because each partition information requires 16 bytes, it is possible to identify up to 4 primary partitions for a hard disk with MBR-type partition structure (the Disk volume label type is MS-DOS). Therefore, it is not possible to get more than 4 primary partitions for a hard disk with this partition structure. You need to draw out the extended partition here. An extended partition is also a primary partition (Primary partition), but it differs from the primary partition in that it can theoretically be divided into countless logical partitions, each with an extended boot record (EBR) similar to the MBR structure.
In the MBR partition table, up to 4 primary partitions or 3 primary partitions + one extended partition, which means that the extended partition can only have one, and then subdivided into multiple logical partitions.
On a Linux system, the hard disk partition is named SDA1-SDA4 or HDA1-HDA4 (where a means that the hard disk number may be a, B, C, and so on). On an MBR hard disk, partition number 1-4 is the primary partition (or extended partition), and the logical partition number can only start at 5.
In the MBR partition table, the maximum capacity of a partition is 2T, and the starting cylinder for each partition must be within the first 2T of the disk. You have a 3T hard drive, you have to divide it into 2 partitions at least, and the starting sector of the last partition is in the first 2T space of the hard disk. If the hard disk is too large, you must use GPT instead.



GPT
The globally unique identity partition table (GUID Partition table, abbreviation: GPT) is the partition structure of an entity hard disk. It is part of the EFI (Extensible Firmware Interface standard) to replace the master boot Record partition table in the BIOS. However, because the MBR partition table does not support partitions larger than 2.2TB (2.2x1012 bytes), there are some BIOS systems that replace MBR partitioned tables with GPT partitioned tables in order to support large-capacity hard disks.

In the MBR hard disk, the partition information is stored directly in the master boot Record (MBR) (the master boot record also stores the system's boot program). However, in GPT hard disks, the location information of the partitioned table is stored in the GPT header. For compatibility reasons, however, the first sector of the hard disk is still used as an MBR and then the GPT header.

GPT disk partitioning style supports a maximum volume of 18 compared to the style of MBR disk partitioning that supports a maximum volume of 2 TB (terabytes) and a maximum of 4 primary partitions per disk (or 3 primary partitions, one extended partition and unlimited logical drives) EB (exabytes) and there is no upper limit on the number of partitions per disk, only limited by the operating system (because the partition table itself needs to occupy a certain amount of space, initially planning the hard disk partition, the space left to the partition table determines the maximum number of partitions, the IA-64 version of Windows limited to a maximum of 128 partitions, This is also the minimum size of the partition table as specified by the EFI standard). Unlike MBR partitioned disks, critical platform operational data is located in partitions, not in non-partitioned or hidden sectors. In addition, the GPT partition disk has a backup partition table to improve the integrity of the partitioned data structure.


EFI
The Extensible Firmware Interface (English name extensible Firmware Interface or EFI) is a personal computer system specification used to define the software interface between the operating system and the system firmware, as an alternative to the BIOS upgrade scheme. The Extensible Firmware Interface is responsible for the power-on self-test (POST), the connection operating system, and the interface that connects the operating system to the hardware.
EFI was originally developed by Intel and is now being promoted and developed by the UEFI Forum.


UEFI
is developed by EFI1.10, its owner is no longer intel, but an international organization called Unified EFI form, contributors have Intel,microsoft,ami, and several manufacturers, belonging to open source, the current version is 2.1.

Two create a partition larger than 2TB

MBR and GPT, both are partition formats, where the MBR maximum partition is less than or equal to 2TB, and the GPT partition does not have a 2TB limit, the theoretical maximum partition is eb!

Now we know that to create a partition larger than 2TB, you cannot use the MBR format partition table, and to use the GPT-formatted partition table, our most commonly used Fdisk partitioning tool will not be able to use the parted partition tool under Linux!

The test environment is:

Dell R710 2u Server

CPU 5606 XEON

Mem 16G

Disk 6*1TB SAS 7200rpm

RAID Level 5 PERC 6i Card

Rhel 6 64bit, creating a 4TB size partition

The following formally begins the partition:

1 before using parted partition, we first use fdisk-l to view the hard drive information!

2 Top of the information we know/dev/sdb 4.6TB, now use the parted command, such as.

3 after entering the parted, perform the 2,3,4,5,6,7,8,9,10,10,11 step, the instruction below has the explanation!

4 when the partition is complete, use print to see the information for the partition! Size 4684GB

5 quit is used to exit the parted environment, and information prompts update/etx/fstab!

6 again with Fdisk-l to view the next SDB hard drive, now has the SDB1 partition, note system gpt!

7 parted is here to finish!

The following format/DEV/SDB1 file system is EXT4:

1 Execute MKFS.EXT4/DEV/SDB1 All the way to enter!

Update/etc/fstab :

1. Use blkid to view the UUID of the partition , for example, to copy the UUID of the new partition/DEV/SDB1

2 Add the/DEV/SDB1 UUID to the/ETC/FSTAB,/DEV/SDB1 mount in the/data directory!

3 now complete, check below!

Mount-a re-mount the records in the/etc/fstab file!

Mount can discover that/DEV/SDB1 is already mounted to the/data directory!

Df-h found/data 4.2TB

Three detailed introduction to the next parted command

[Email protected] ~]# parted--help
Usage: parted [options] ... [Device [command [parameters] ...] ...]
Apply the command with "parameters" to "Device". If the command is not given, it runs in interactive mode.

Options:
-H,--help displays this help message
-I,--interactive prompts the user when necessary
-S,--script never prompt the user
-V,--version display version

Command:
Check the MINOR for a simple check of the file system
CP [From-device] From-minor to-minor Copying the file system to another partition
Help [command] print general assistance information, or information about the command
Mklabel label type Create a new disk label (partition table)
MKFS MINOR file system type in MINOR creates a file system of type "file system type"
Mkpart partition Type [file system type] Start point end point Create a partition
MKPARTFS partition type file system type start point end point Create a partition with a file system
Move MINOR start point moving the partition numbered MINOR
Name MINOR names the partition with number MINOR named "Name"
Print [MINOR] the partition table, or partition
Quit quitting the program
Rescue start point end point saves missing partitions near "start point", "End point"
Resize MINOR Start point change the size of the file system in the partition numbered MINOR
RM MINOR Delete a partition numbered MINOR
Select Device Choose the device to edit
Set MINOR Flag Status change flag for partition numbered MINOR

Attention

Mklabel Label-type must be a bit of these types:

* BSD

* Loop (Raw disk access)

* GPT

* Mac

* MSDOS

* PC98

* Sun

Example: (parted) Mklabel GTP or (parted) Mklabel Msdos

Mkpart (Create new partition)

Format: Mkpart part-type fs-type start end

To create a new partition

Part-type is one of the following types of primary (primary partition), extended (extended partition), logical (logical partition).

Fs-type to specify the file system, such as EXT4.

Start and end are specific locations where the new partition starts and ends. 0 means start and end, 1 means ending, or in megabytes or GB!

Category: Linux good text to the top attention to my collection of this article Alxe_yu
Follow-1
Fans-10 + plus attention00? Previous article: How to delete UltraEdit's search history and replace history
? Next: Win7 Create WiFi hotspot detailed Tutorial Posted @2013-12-02 23:41 Alxe_yu Read (11593) Comments (0) Edit Collection

Linux primary partition, extended partition, logical partition connection and Difference

Related Article

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.