Creating GPT partitions in Linux

Creating GPT partitions in Linux

Creating GPT partitions in Linux empowers IT professionals with a modern and robust method for efficient storage management, offering advantages like larger drive support, data integrity, and enhanced system security.

Table of Contents


In the ever-evolving landscape of information technology, efficient data management and storage are critical components for any system’s success. Partitions play a pivotal role in optimizing storage utilization, organization, and data security. Among the various partitioning schemes available, the GUID Partition Table (GPT) has emerged as a modern and robust method for partitioning storage devices in Linux systems. This article will delve into the significance of GPT partitions, their history, and provide IT professionals with a step-by-step guide on how to create GPT partitions on Linux systems.

Creating GPT partitions in Linux

Photo by Pixabay from Pexels

Brief History

Traditionally, the Master Boot Record (MBR) partitioning scheme was widely used in computers to organize and manage storage. However, with the advancement of technology and the need for larger storage capacities, MBR’s limitations became apparent. This paved the way for GPT, which was introduced as a modern replacement for MBR in the late 2000s.

MBR versus GPT

GPT offers several advantages over MBR, making it highly significant in today’s IT landscape:

  1. Support for Larger Drives: MBR can only support up to 2TB drives, while GPT can handle drives of up to 9.4 zettabytes, ensuring compatibility with modern high-capacity drives.

  2. Flexible Partitioning: GPT allows for an almost unlimited number of partitions, facilitating better organization and utilization of storage resources.

  3. Data Integrity: GPT incorporates redundancy checks to prevent data corruption and improve data recovery processes.

  4. Modern Features: GPT supports modern features like Secure Boot, which enhances system security by only allowing trusted software to run during boot-up.

  5. GUIDs for Identification: Each partition in GPT is assigned a unique GUID (Globally Unique Identifier), making it easier to distinguish partitions even across different systems.

Creating GPT Partitions: Using Gdisk

Before proceeding with the creation of GPT partitions, ensure you have the necessary permissions and backup your important data. Here’s a comprehensive step-by-step guide to creating GPT partitions on a Linux system.

Identify the Disk

Begin by identifying the disk you want to partition. You can use the lsblk or fdisk -l command to list the available disks.

					# lsblk

Create Partitions

Use the gdisk utility to create GPT partitions on the selected disk. Replace /dev/sdX or /dev/vdX (baremetal server or virtual machine) with the appropriate disk identifier.

Interactive Partitioning

Within the gdisk interface, use the following commands to create partitions:

  • Type n to create a new partition.
  • Specify the partition number.
  • Choose the starting and ending sectors.
  • Assign a partition type (Linux filesystem, swap, etc.).
  • Repeat these steps for each partition you want to create.

Write Changes

After creating partitions, type w to write the changes to the disk.

Format Partitions

Use appropriate commands to format the newly created partitions. For example, to format a partition as ext4:

					# mkfs.ext4 /dev/sdX1 or mkfs.ext4 /dev/vdX1

Creating GPT Partitions: Using Parted

In previous sections, we reviewed how to identify a disk and create partitions using fdisk and gdisk. Partitioning a disk using parted is similar: 

					# parted /dev/sdX or /dev/vdX

Create Partitions

Inside the parted utility, follow these steps to create partitions:

  1. Use the mklabel gpt command to create an GPT partition table on the disk.
  2. Create a partition using the mkpart command. Specify the partition name (primary).
  3. Set the partition’s start and end points using percentages or sizes.
  4. Repeat the process for additional partitions.
					# parted /dev/vdb mkpart primary 2048s 2GiB
Information: You may need to update /etc/fstab.

# lsblk
vda           252:0    0  50G  0 disk 
├─vda1        252:1    0   2G  0 part /boot
└─vda2        252:2    0  48G  0 part 
  ├─vg00-root 253:0    0  15G  0 lvm  /
  ├─vg00-swap 253:1    0   4G  0 lvm  [SWAP]
  └─vg00-home 253:2    0  10G  0 lvm  /home
vdb           252:16   0  25G  0 disk 
└─vdb1        252:17   0   2G  0 part 
vdc           252:32   0  25G  0 disk 


The example (above) assumes the block device is /dev/vdb. Furthermore, it illustrates the creation of a 2GiB GPT partition.

Quit, Save, Format

Exit the parted interface and save the changes.

					(parted) quit or (parted) q

To format the partition use the mkfs.[filesystem_type]. The example below formats /dev/vdb1 to ext4.

					# mkfs.ext4 /dev/vdb1

Update /etc/fstab

To ensure the partitions are mounted at boot, update the /etc/fstab file with the appropriate entries. Use the UUID of each partition to reference them.

					# blkid /dev/vdb1 | awk '{print $2}' >> /etc/fstab

# cat /etc/fstab
# /etc/fstab
# Created by anaconda on Sun Jun  5 00:54:27 2022
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
/dev/mapper/vg00-root   /                       xfs     defaults        0 0
UUID=e48e0a2a-53b0-4cfb-850e-897372dfae0b /boot                   xfs     defaults        0 0
/dev/mapper/vg00-home   /home                   xfs     defaults        0 0
/dev/mapper/vg00-swap   none                    swap    defaults        0 0


Edit the /etc/fstab file using your favorite text editor.

					# vim /etc/fstab


Include the directory path, filesystem type and defaults entries. Also, ensure the /datastore directory exists before rebooting the machine.

					UUID="964c20d2-cc37-4562-b265-dbc3eee1bb9b"  /datastore   ext4  defaults 0 0


Efficient storage management is a critical aspect of modern IT infrastructure, and GPT partitions offer a versatile and robust solution for achieving this goal in Linux systems. By understanding the significance of GPT, its advantages over MBR, and following the step-by-step guide provided, IT professionals can confidently create GPT partitions, optimizing storage utilization and enhancing data security. Embrace the power of GPT partitions to propel your systems into a new era of storage management excellence. Was this article helpful to you? If so, let us know in the comments. We appreciate your feedback!

Note: Always exercise caution when performing disk operations, and ensure you have backups of important data before making any changes.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *