Guid Partition Table In linux - Example Partition Large Size Disk

Posted on : August 27, 2012 , Last Updated on : October 14, 2016 By
| Reply More

GUID Partition Table

The GUID Partition Table (GPT) is a new table layout on physical disk which has proposed by Intel due to the limitations of the previous MBR (Master Boot Record). Before learning GPT, it is worth mentioning the MBR and its limitations briefly.

What is MBR?

A Master Boot Record (MBR) is a special type of boot sector at the very beginning of partitioned hard disk. It holds the information on how the logical partitions, containing file systems, are organized on that disk.

The main disadvantage of using MBR is that it uses 32 bit Logical Block Address (LBA) values along with the sector size 512 bytes. This limits the maximum addressable size of the disk to be 2 TiB. Now, commercial purpose servers are having huge disks which require partition sizes larger than 2TiB. The MBR partitioning scheme is therefore in the process of being superseded by the GUID Partition Table (GPT) scheme in new computers.

GUID partitioning Table

GPT forms a part of the Extensible Firmware Interface (EFI) standard (Intel's proposed replacement for the PC BIOS). GPT allocates 64 bits for logical block addresses and therefore allows a maximum disk and partition size of 264−1 sectors.

GPT Scheme

Diagram illustrates the layout of the GUID Partition Table scheme. In this example, each logical block (LBA) is 512 bytes in size, and each partition entry is 128 bytes. LBA addresses that are negative indicate position from the end of the volume, with −1 as the last addressable block. As you can see from the diagram, there is a secondary GPT header and secondary GPT table are available at the end of the volume. These are the copies of primary GPT header and primary GPT table which can be used ofr recovery in case the primary got corrupted.

Kernel support

In order to use GPT, the Linux kernel should be compiled using the option “CONFIG_EFI_PARTITION”. This is now available with almost latest versions. You can check whether the option CONFIG_EFI_PARTITION is available in the current kernel as follows (Replace your kernel verion)

grep EFI /boot/config-2.6.26-2-amd64

Creating GPT partition on a 6TB Disk

The common fdisk utility will not work with GPT. You will not be able to create partitions larger than 2TB using fdisk. In order to create partitions larger than 2TB, you need to use GNU parted or gdisk utility. In this article we will use GNU parted utility to create a partition with size 6TB.

1. Setting partition table to GPT

You need to use parted command to create a 6TB partition. In ‘parted’ prompt, issue the mklabel command to set the partition table to ‘gpt’.

# parted /dev/sdb
GNU Parted 2.3
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) print
Error: /dev/sdb: unrecognised disk label

(parted) mklabel gpt

(parted) print
Model: Unknown (unknown)
Disk /dev/sdb: 5910GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

2. Creating a single partition using the whole disk

In parted prompt, you can use ‘mkpart’ command to create partition.

parted /dev/sdb

(parted) mkpart primary 0GB 5910GB

(parted) print
Model: Unknown (unknown)
Disk /dev/sdb: 5910GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 1049kB 5910GB 5910GB primary

3. Format the filesystem

In order to use this partition, you need to format the filesystem first using the following command.

mkfs.ext3 /dev/sdb1

4. Mounting the partition

Now, we can create a folder named backup and mount this partition on it.

mkdir /backup
mount /dev/sdb1 /backup

Now, you will be able to view this partition in ‘df –h’ command.

# df –h | grep backup
/dev/sdb1 5.3T 61M 5.1T 1% /backup


Tagged With :

Free Linux Ebook to Download

Leave a Reply

All comments are subject to moderation.