๐ŸŽ New User? Get 20% off your first purchase with code NEWUSER20 ยท โšก Instant download ยท ๐Ÿ”’ Secure checkout Register Now โ†’
Menu

Categories

๐Ÿ’ก Disk & Storage October 12, 2026 15

Linux Command: parted

GPT and MBR partition management tool

Terminal โ€” Disk & Storage
Command
$ sudo parted /dev/sda print
Output
Model: ATA VBOX HARDDISK (scsi)\nDisk /dev/sda: 107GB\nPartition Table: gpt\n\nNumber Start End Size File system Name Flags\n 1 1049kB 538MB 537MB fat32 EFI boot, esp\n 2 538MB 107GB 107GB ext4 primary

The parted command is a disk partitioning tool that supports both GPT (GUID Partition Table) and MBR (Master Boot Record) partition schemes. Unlike fdisk which historically only supported MBR, parted handles GPT partitions natively, making it essential for modern systems with drives larger than 2TB. parted supports creating, resizing, moving, and deleting partitions on hard drives, SSDs, and other block devices. It can work in both interactive and scripted (non-interactive) modes, making it suitable for both manual administration and automated provisioning. One of parted's unique features is the ability to resize partitions โ€” growing or shrinking them without data loss (when combined with filesystem resize tools). This makes it invaluable for server administration where storage requirements change over time. For enterprise environments using LVM, RAID, or complex storage configurations, parted is typically the first step in preparing physical volumes before creating LVM physical volumes (pvcreate), volume groups, and logical volumes.

Syntax

parted [OPTIONS] [DEVICE] [COMMAND]

Key Options

  • print โ€” Display partition table of a device
  • mklabel gpt โ€” Create a new GPT partition table
  • mkpart โ€” Create a new partition
  • resizepart NUM END โ€” Resize a partition to new end position
  • rm NUM โ€” Delete a partition by number
  • set NUM FLAG on/off โ€” Set a flag on a partition (boot, lvm, raid)

Examples

View partition table

sudo parted /dev/sda print

Output: Model: ATA VBOX HARDDISK (scsi)\nDisk /dev/sda: 107GB\nPartition Table: gpt\n\nNumber Start End Size File system Name Flags\n 1 1049kB 538MB 537MB fat32 EFI boot,

Create GPT partition table on new disk

sudo parted -s /dev/sdb mklabel gpt

Create a single partition using full disk

sudo parted -s /dev/sdb mkpart primary ext4 0% 100%

Pro Tips

  • Unlike fdisk which requires writing changes, parted applies changes IMMEDIATELY. There is no undo. Double-check the device path before any destructive operation.
  • Use 0% and 100% instead of exact byte values for optimal partition alignment. This ensures partitions align to physical sector boundaries.
  • Use GPT for disks larger than 2TB, UEFI systems, or when you need more than 4 primary partitions. MBR is only needed for legacy BIOS systems.

Learn more: Full parted reference โ†’

Share this tip