Linux Disk partitioning detailed

Source: Internet
Author: User

To create a partition on a new hard disk, follow the following sequence: set up the primary partition → set up the extended partition → establish the logical partition → activate the primary partition → format all of the partitions.

The primary partition of a hard disk is the hard disk partition that contains the files and data necessary to boot the operating system, and the hard disk must have a primary partition to install the operating system on the hard disk.
An extended partition is a partition other than the primary partition, but it cannot be used directly, and it must be divided into logical partitions. Logical partitioning is the D, E, F, and so on that we normally see in the operating system.

A partition is essentially a format for a hard disk. When we create the partition, we have set the physical parameters of the hard disk, specified the main boot record of the hard disk under the BIOS system (that is, the master boot record, generally referred to as MBR) and the location of the boot record backup.
The information required for the file system and other operating systems to manage the hard disk is implemented through advanced formatting, which is the format command.

The partition of a hard disk consists of a primary partition, an extended partition, and a logical partition: The maximum number of primary partitions (note that the extended partition is also a primary partition) is four, the number of which is determined by the primary boot record MBR (master boot Recorder) of the hard disk, and the MBR holds the boot manager (such as GRUB) and partition table records. The extended partition can contain more than one logical partition---so the primary partition range is from 1-4, and the logical partition starts from 5.

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/8E/F7/wKiom1jP6IzRfp1-AAGLR6fa0O0472.jpg "title=" 2011121227271955101667_ copy. jpg "alt=" wkiom1jp6izrfp1-aaglr6fa0o0472.jpg "/>

Windows and Linux support the partitioning structure:
One primary partition + one expansion area
Two primary partitions + one expansion area
Three primary partitions + one expansion area
Four separate primary partitions.

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/8E/F7/wKiom1jP6PfwAw4sAACORKo9rOY273.jpg "title=" 2011121227271955009248_ copy. jpg "alt=" wkiom1jp6pfwaw4saacorko9roy273.jpg "/>

Primary partition : Also known as the boot partition, can create up to 4, when the creation of four primary partitions, you can no longer create the extension partition, of course, there is no logical partition. The primary partition is independent, corresponding to the first partition on the disk, and "General" is the C drive. In the Windows system, all primary and logical partitions are called "Disks" or "drives", and all of the available storage media are displayed as "disks" of the operating system. Therefore, the primary and logical partitions cannot be distinguished from the concept of "disk". and the drive letter can be modified in the operating system, which is to add the "general" two word reasons.

Extended partition : In addition to the primary partition, the remaining disk space is the extended partition, the extended partition is a concept, in fact, is not visible. When the entire hard disk is divided into a primary partition, there is no extended partition.

Logical Partitioning : On top of the extended partition, you can create multiple logical partitions. Logical partitions are equivalent to a block of storage, and the operating system has other logical partitions, and the primary partition has nothing to do with "standalone".

Active partition : is the currently active partition that the operating system can start.

Formatting is for primary and logical partitions. It is formatted because it is related to the operating system managing the file system. A partition that is not formatted is like a blank sheet of paper, and to write data, you must make a "grid" of white papers, one in each lattice. and the operating system only recognize these squares.

The Linux partition differs from the Windows,linux under the hard disk device name (the IDE hard disk is HDX (x is from a-d) because the IDE hard disk has a maximum of four, the SCSI,SATA,USB hard disk is SDX (x is a-Z), and the hard disk primary partition is up to 4.

CentOS under Disk Management

1. Disk partition Format description

The Linux partition differs from the Windows,linux under the hard drive device name (IDE hard disk is HDX (x is from a-d) because the IDE hard disk is up to four, the SCSI,SATA,USB hard disk is SDX (x is a-Z), the hard disk primary partition is up to 4, needless to say you know ... So the primary partition starts from SDB1 to SDB4, and the logical partition starts with SDB5 (logical partition always starts from SDB5 ... ) device name can be viewed using fdisk–l

2. Detailed Zoning

Log on to the system using the SSH Remote Connection tool and use the FDISK-L command to view the disk status

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/8E/F7/wKiom1jP6deg7259AACR4p-N-Ls235.jpg "title=" 2012071021284113.jpg "alt=" Wkiom1jp6deg7259aacr4p-n-ls235.jpg "/>

Here you can see two hard disks hda and HDB, the first HDD HDA is installed system. The HDB hard disk is not partitioned. This example will partition this 10G hard disk, Partition plan: Divide a primary partition, size 3G, file format ext3. Three logical partitions, each of which is 2g,2g,3g in size. The actual number and size of partitions can be determined by the situation.

Here is the detailed steps of the partition, because each step is carried out and explained, the content is slightly complex, in fact, very simple.
Enter FDISK/DEV/HDB and then enter to partition the hard drive. Such as

650) this.width=650; "style=" WIDTH:550PX;HEIGHT:229PX; "src=" http://files.jb51.net/file_images/article/201207/ 2012071021284114.jpg "/>

Enter N to new partition, then enter P return to create a new primary partition.

650) this.width=650; "style=" WIDTH:401PX;HEIGHT:97PX; "src=" http://files.jb51.net/file_images/article/201207/ 2012071021284115.jpg "/>

This is required to select the partition number in 1-4, enter 1 return car

650) this.width=650; "style=" WIDTH:440PX;HEIGHT:119PX; "src=" http://files.jb51.net/file_images/article/201207/ 2012071021284116.jpg "/>

First cylinder (1-20805, default 1): Here is the column to set the beginning of the partition, the direct return to select the default, enter after the

650) this.width=650; "style=" WIDTH:500PX;HEIGHT:119PX; "src=" http://files.jb51.net/file_images/article/201207/ 2012071021284117.jpg "/>

Last cylinder or +size or +sizem or +sizek (1-20805, default 20805): Here is the setting of the end cylinder of the partition, +3g indicates the end of 3G from the starting cylinder, is also set the partition size to 3G, enter +3g after the return , as shown

650) this.width=650; "style=" width:510px;height:104px; "src=" http://files.jb51.net/file_images/article/201207/ 2012071021284118.jpg "/>

Here you can enter p to see if the partition was successful, enter P carriage, such as: Display partition success

650) this.width=650; "style=" width:525px;height:151px; "src=" http://files.jb51.net/file_images/article/201207/ 2012071021284119.jpg "/>

Next we'll divide the extended partition, press N to enter

650) this.width=650; "style=" width:473px;height:106px; "src=" http://files.jb51.net/file_images/article/201207/ 2012071021284120.jpg "/>

Enter e here, which means to create an extended partition, enter the E return

650) this.width=650; "style=" WIDTH:415PX;HEIGHT:87PX; "src=" http://files.jb51.net/file_images/article/201207/ 2012071021284121.jpg "/>

Enter partition number 2 return car

650) this.width=650; "style=" width:499px;height:73px; "src=" http://files.jb51.net/file_images/article/201207/ 2012071021284122.jpg "/>

Press ENTER directly here to select the default

650) this.width=650; "style=" width:545px;height:71px; "src=" http://files.jb51.net/file_images/article/201207/ 2012071021284123.jpg "/>

Here is also the direct carriage return select default, which indicates that the disk after the first primary partition is divided into a logical partition

650) this.width=650; "style=" width:536px;height:94px; "src=" http://files.jb51.net/file_images/article/201207/ 2012071021284124.jpg "/>

Here you can enter the command p to view the current partition status, as

650) this.width=650; "style=" WIDTH:470PX;HEIGHT:159PX; "src=" http://files.jb51.net/file_images/article/201207/ 2012071021284125.jpg "/>

Start dividing the logical partition under the extended partition HDB2 here! Next, enter command N return

650) this.width=650; "style=" width:486px;height:121px; "src=" http://files.jb51.net/file_images/article/201207/ 2012071021284126.jpg "/>

Enter L here to select Create Logical partition, enter L return

650) this.width=650; "style=" width:480px;height:92px; "src=" http://files.jb51.net/file_images/article/201207/ 2012071021284127.jpg "/>

Use the carriage return directly here to select the default

650) this.width=650; "style=" WIDTH:528PX;HEIGHT:79PX; "src=" http://files.jb51.net/file_images/article/201207/ 2012071021284128.jpg "/>

Enter +2g here to divide the partition size to 2G, enter +2g carriage return

650) this.width=650; "style=" width:553px;height:70px; "src=" http://files.jb51.net/file_images/article/201207/ 2012071021284129.jpg "/>

Here to divide the two logical space according to the plan, enter n return, then enter the L enter to select the logical partition, then go directly to select the default starting cylinder, enter +2g return to set the partition size

650) this.width=650; "style=" width:545px;height:144px; "src=" http://files.jb51.net/file_images/article/201207/ 2012071021284130.jpg "/>

The following is the disk size of the extended partition to all the last logical partition, enter n return, and then enter L Select the logical partition, and then directly enter select the default starting cylinder, and finally do not set the disk size direct carriage return

650) this.width=650; "style=" width:536px;height:161px; "src=" http://files.jb51.net/file_images/article/201207/ 2012071021284131.jpg "/>

Enter P again to view the current partition status

650) this.width=650; "style=" width:520px;height:203px; "src=" http://files.jb51.net/file_images/article/201207/ 2012071021284132.jpg "/>

Divide the space with our plan to divide the same, and finally enter W return, to save and exit.

Using the Fdisk-l command again, you can see that the disk HDB has been partitioned successfully.

650) this.width=650; "style=" width:509px;height:316px; "src=" http://files.jb51.net/file_images/article/201207/ 2012071021284133.jpg "/>

Disk partition is successful, the following will be formatted

Using the command mkfs-t EXT3/DEV/HDB1

Mkfs-t EXT3/DEV/HDB5

Mkfs-t EXT3/DEV/HDB6

Mkfs-t EXT3/DEV/HDB7

Format the disk separately, formatted as a ext3 file type

Since this partition process is finished!

Attached: parameter explanations for FDISK and MKFS,MKSWAP commands

The fdisk command is detailed:

M: Get Help

N: New Partition

P: Show partition Table

D: Delete partition

B: Set the volume label

W: Write to partition table

T: Change the partition file system type

V: Test partition

L: Displays the file system code supported by FDISK

Q: Exit

Creation of file systems:

MKFS parameter Partitioning

-T File system type specifies the type of file system established

Note: mkfs–t ext3 =mkfs.ext3

-c Check for bad path before setting up file system

-L file name: Read bad path from file

-V Show detailed conditions

Mkswap partition on partition to establish swap partition

Example: establishing the Swap partition command on HDB7 is as follows:

Mkswap/etc/hdb7


This article is from the "he Mountain Stone" blog, please be sure to keep this source http://zhangshujie.blog.51cto.com/4921537/1908603

Linux Disk partitioning detailed

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.