Linux : Creating a GPT (GUID) partition table for large drives

By | October 4, 2014

With larger drive these days that exceed 2 Tb, the traditional MSDOS partition table add a barrier of 2 Tb maximum for partitions.  Fortunately, the GUID Partition Table which is well known as GPT that push this limit to 18 EB (exabyte).

You are probably familiar with the “fdisk” legacy partitioning tool, however this does not support GPT. To achieve this task, you will need to use “parted”. This example will assume you are using “/dev/sdf” as target drive.

1. If you do not have Parted on your system, simply install :

yum install parted

2. Tell Parted which drive to use :

parted /dev/sdf

3. Create the GPT label :

mklabel gpt

4. Select which measurement unit to use (we will use terabyte here) :

unit TB

5. Define the start and end points of the partition you wish to create (we will use the whole disk here) :

mkpart primary 0TB 3.60TB

6. We are done now, you can print the results :

print

7. You can exit the utility and partition using your favorite filesystem at this point :

quit

Here is a console output example of the steps we’ve done above :

# parted /dev/sdf
GNU Parted 3.1
Using /dev/sdf
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt
Warning: The existing disk label on /dev/sdf will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? y
(parted) unit TB
(parted) mkpart primary 0 0
(parted) mkpart primary 0TB 3.60TB
(parted) print
Model: HP P2000G3 FC/iSCSI (scsi)
Disk /dev/sdf: 3.60TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name     Flags
 1      0.00TB  3.60TB  3.60TB  ext4         primary

(parted) quit
Information: You may need to update /etc/fstab.