panda's tech note

GPT partitioning

GUID Partition Table (GPT), instead of Master Boot Record (MBR), is used for modern disks with large capacity, especially larger than 2 TiB because MBR does not support region upper than 2 TiB. In Linux, parted command is used to partition disks.

# parted /dev/sda

This command launches an intractive command line interface.

You may first examine the current partition table by typing p:

(parted) p                                                                
Error: /dev/sda: unrecognised disk label
Model: ATA HGST HDN726040AL (scsi)                                        
Disk /dev/sda: 4001GB
Sector size (logical/physical): 512B/4096B
Partition Table: unknown
Disk Flags:

This example displays the information of the blank disk (with no partition).

First, make label gpt to make the disk a GPT partitioned disk:

(parted) mklabel gpt

If you want to allocate one partition with the maximum capacity of the disk, the following command can be used. Note that the second argument of the mkpart command is the file system type, and the third and forth arguments are the beginning and the end of the partition, respectively.

(parted) mkpart ext4 0% 100%

Now, one partition with whole size of the disk is created as follows.

(parted) p                                                                
Model: ATA HGST HDN726040AL (scsi)
Disk /dev/sda: 4001GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  4001GB  4001GB               ext4

You can exit from this tool by typing q:

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