GPT partitioning under Linux

Source: Internet
Author: User

The GPT partition under Linux, which is another partition for MBR partitioning, has many advantages:


(1) Almost break the limit of the number of partitions.


Up to 128 primary partitions can be supported in a GPT partitioned table.


(2) The capacity of a single partition is almost unlimited.


A single partition supports a maximum of 1EB capacity.


Therefore, the concept of logical partitioning in the GPT partition, the primary and extended partitions, is already blurred. It's not even necessary to call it that. Actually, we know.


The reason why the extended partition exists is to solve the limitation of the number of partitions in the MBR. Since in GPT, the number of partitions is almost no


Limitations, then these concepts are of course blurred.


(3) Here are the steps to create a GPT partition:


is still new to join a hard drive, we want to partition it. The tool used is "parted", this tool can do both MBR partition, but also can do GPT partition. Of course, it is mainly used to do GPT partition, the following is the operation of the partition process:


1. Type the command "parted" at the command line, as follows:

[Email protected] ~]# parted

GNU Parted 2.1

Using/DEV/SDA

Welcome to GNU parted! Type ' help ' to view a list of commands.

(parted)


2. Let's take a look at the help information of the parted tool, and then, type the following information to help us partition:

Align-check TYPE n Check partition N for

TYPE (min|opt) alignment

Check number do a simple check on the

File system

CP [From-device] from-number to-number copy file system to

Another partition

Help [COMMAND] Print general help, or

Help on COMMAND

Mklabel,mktable Label-type Create a new Disklabel

(Partition Table)

MKFS number Fs-type make a fs-type file

System on partition number

Mkpart Part-type [Fs-type] START END make a partition

Mkpartfs part-type fs-type START END make a partition with a

File system

Move number START END move partition number

Name Number name name partition number as

NAME

Print [devices|free|list,all| Number] Display the partition

Table, available devices, free space, all found partitions,

or a particular partition

Quit Exit Program

Rescue START END Rescue a lost partition

Near START and END

Resize number START END Resize partition number

and its file system

RM Number Delete Partition number

Select Device Choose the device to

Edit

Set number flag state change the FLAG on

Partition number

Toggle [Number [FLAG]] toggle the state of FLAG

On partition number

Unit unit Set the default unit to

UNIT

Version Display the version

Number and copyright information of GNU Parted




3. Select the newly added hard drive, here, its name is/DEV/SDB, select the device to enter the partition:

(parted) Select/dev/sdb

Using/dev/sdb

(parted)



4. Next select the format of the partition table, which should be selected as GPT format. Indicates that we are a GPT partition, type "Mklabel GPT", as follows:

(parted) Select/dev/sdb

Using/dev/sdb

(parted) Mklabel GPT

(parted) Mklabel GPT

Warning: The existing disk label ON/DEV/SDB is destroyed and all

Data on this disk would be lost. Want to continue?

Is/yes/no/no? Y


5. In parted, you can select either an interactive partition (i.e. a question-and-answer method) or


In the way of the command, we partition it in an interactive way.


Type the command Mkpart, as follows:

(parted) Mkpart

Partition name? []? Fuly

6. Here is a name for the partition. Because the primary partition is blurred in the GPT partition and the concept of extended partitioning is not defined,


So the name of the partition can come up at will. A name "Fuly", as follows:

(parted) Mkpart

Partition name? []? Fuly

File system type? [Ext2]?


7. Let you choose the type of file system, here, regardless of the default. Press the ENTER key directly, as follows:

(parted) Mkpart

Partition name? []? Fuly

File system type? [Ext2]?

Starting point?


8. Here is the starting point for the size of the input file. Note that this differs from the starting point in the MBR partition. The starting point for the actual file size is entered here.


For example, I want to give this partition 200M, then its starting point here is 0, type 0, as follows:

Starting point? 0

End point? 200

Warning: The resulting partition is not a properly aligned for best

Performance.

Ignore/ignore/abandon/cancel? Cancel


9. Altogether pop-up warning, probably means that the storage on the disk does not achieve the best alignment, the reason is that our starting point starts from 0 .


If you don't understand, just remember. Here we cancel, and then start from 1. As follows:

(parted) Mkpart

Partition name? []? Fuly

File system type? [Ext2]?

Starting point? 1

End point? 2000


10. In this way, the partition is completed in one step. So let's see if this partition exists, type print, as follows:

(parted) Print

Model:vmware, VMware Virtual S (SCSI)

Disk/dev/sdb:21.5gb

Sector size (logical/physical): 512b/512b

Partition TABLE:GPT


Number Start End Size File system Name Flag

1 1049kB 2000MB 1999MB fuly



11. See the partition fuly we just created. You can also see that its size is actually 1999MB.


The above is partitioned in an interactive way. Let's take another partition and partition it using the command line. As follows:

(parted) Mkpart Mage 2000 3000

(parted)


is not simpler, in fact this command means to create a partition named Mage, the size of 1000M, the starting point is 2000 (


Because we just finished at 2000), the end point is naturally 3000.


12. Did the partition succeed? Then check it out with print, as follows:

(parted) Print

Model:vmware, VMware Virtual S (SCSI)

Disk/dev/sdb:21.5gb

Sector size (logical/physical): 512b/512b

Partition TABLE:GPT


Number Start End Size File system Name Flag

1 1049kB 2000MB 1999MB fuly

2 2000MB 3000MB 1000MB Mage


(parted)


The partition Mage exists.


13. Well, suppose we need two partitions, then the partition is complete. How do I save the exit?


Just type quit. As follows:

(parted) quit

Info: Need to Update/etc/fstab.


Well, unlike MBR, which is also useful w to write to a partitioned table, GPT takes effect directly when it exits with quit.


This way our entire division work is done.


14. We have used the "fdisk-l" command to view the partition of the hard disk, now try again, as follows:

[Email protected] ~]# fdisk-l


disk/dev/sda:21.5 GB, 21474836480 bytes

255 heads, Sectors/track, 2610 cylinders

Units = Cylinders of 16065 * 8225280 bytes

Sector size (logical/physical): bytes/512 bytes

I/O size (minimum/optimal): bytes/512 bytes

Disk identifier:0x0006a288


Device Boot Start End Blocks Id System

/DEV/SDA1 * 1 1020 8192000 Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2 1020 1275 2048000, Linux Swap/solaris


Warning:gpt (GUID Partition Table) detected on '/DEV/SDB '! The util Fdisk doesn ' t support GPT. Use GNU Parted.



disk/dev/sdb:21.5 GB, 21474836480 bytes

255 heads, Sectors/track, 2610 cylinders

Units = Cylinders of 16065 * 8225280 bytes

Sector size (logical/physical): bytes/512 bytes

I/O size (minimum/optimal): bytes/512 bytes

Disk identifier:0x00000000


Device Boot Start End Blocks Id System

/DEV/SDB1 1 2611 20971519+ ee GPT


We found that we were not able to see the partition information we had just now. Because the Fdisk tool cannot be used to view the details of the GPT partition type.

You can only view partition information (that is, MBR partitions) of the MSDOS type. So how do you look at it? Or you want to use the parted tool. First select a sub-partition such as GPT


's hard drive, then print. You can simply type the command "Print all" below:

[Email protected] ~]# parted

GNU Parted 2.1

Using/DEV/SDA

Welcome to GNU parted! Type ' help ' to view a list of commands.

(parted) Print all

Model:vmware, VMware Virtual S (SCSI)

Disk/dev/sda:21.5gb

Sector size (logical/physical): 512b/512b

Partition Table:msdos


Number Start End Size Type File system flag

1 1049kB 8390MB 8389MB primary EXT4 start

2 8390MB 10.5GB 2097MB primary Linux-swap (v1)



Model:vmware, VMware Virtual S (SCSI)

Disk/dev/sdb:21.5gb

Sector size (logical/physical): 512b/512b

Partition TABLE:GPT


Number Start End Size File system Name Flag

1 1049kB 2000MB 1999MB fuly

2 2000MB 3000MB 1000MB Mage



Warning:/dev/sr0 (read-only file system) cannot be opened read-write. /dev/sr0 has been opened as read-only.

Model:necvmwar VMware IDE CDR10 (SCSI)

disk/dev/sr0:7770mb

Sector size (logical/physical): 2048b/2048b

Partition Table:msdos


Number Start End Size Type File system flag

2 10.6MB 36.3MB 25.7MB Primary


In summary, the GPT partition is created.



This article is from the "Li Wenming blog" blog, make sure to keep this source http://liwenming18.blog.51cto.com/11068518/1750412

GPT partitioning under Linux

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.