How to Partition a Disk on Fedora Using fdisk, parted, or GNOME Disks

Partition a Fedora disk using fdisk, parted, or GNOME Disks to split storage into manageable sections for data or OS installation.

The blank drive problem

You just connected a fresh four-terabyte drive to your Fedora machine. The desktop shows nothing. The terminal shows a raw block device. You need to carve it into usable slices before you can format it and mount it. One wrong keystroke wipes your existing data. You need a reliable way to draw those boundaries without guessing.

What partitioning actually does

A disk is just a continuous stream of sectors. The operating system needs a map to know where one file system ends and another begins. That map is the partition table. Modern Fedora systems use GPT, which stands for GUID Partition Table. GPT supports drives larger than two terabytes and stores a backup copy of the table at the very end of the disk. Legacy BIOS systems use MBR, which caps out at two terabytes and only allows four primary partitions. When you partition, you are not formatting. You are drawing lines on a blank canvas. The file system comes later.

Fedora assigns temporary names like /dev/sdb or /dev/nvme0n1 based on the order the kernel detects hardware. Those names change when you reboot or plug in a different drive. Always verify the target disk with lsblk before touching it. Point your commands at the wrong device and the data is gone.

Run lsblk -o NAME,SIZE,TYPE,MOUNTPOINT to confirm you are looking at the correct raw disk. Check the size and type columns. Never run partitioning commands against a mounted volume or your root drive.

Drawing boundaries with fdisk

fdisk is the traditional command-line tool. It reads the partition table into memory, lets you edit it interactively, and writes it back only when you explicitly commit. Nothing changes on the disk until you tell it to. This safety net makes it ideal for manual work.

Here is how to create a GPT table and a single partition that spans the entire drive.

sudo fdisk /dev/sdb
# WHY: opens the interactive partition editor for the target disk
# WHY: sudo is required because writing to block devices needs root privileges
# WHY: fdisk loads the current table into memory without touching the disk yet

Inside the prompt, type g to create a new GPT partition table. Type n to start a new partition. Accept the default partition number by pressing Enter. Accept the default first sector by pressing Enter again. Accept the default last sector by pressing Enter to use the full remaining space. Type w to write the table to disk and exit.

The w command is the only point of no return. If you change your mind before typing it, press q to quit without saving. fdisk will warn you that changes are lost.

Here is how to verify the layout immediately after writing.

lsblk -f /dev/sdb
# WHY: shows the new partition tree with filesystem type and label columns
# WHY: the -f flag reveals whether a filesystem has been created yet
# WHY: you should see sdb1 listed with no FSTYPE until you format it

Convention aside: modern drives use 4096-byte physical sectors. fdisk aligns partitions to 1MiB boundaries by default, which guarantees optimal performance on SSDs and enterprise HDDs. You do not need to calculate sector math manually. Trust the defaults.

Write the table once. Format the partition next. Do not mix partitioning and formatting in the same mental step.

Scripting layouts with parted

parted handles GPT natively and accepts direct commands without an interactive prompt. It is faster for automation and cleaner for one-off tasks. Unlike fdisk, parted applies changes immediately as you run each command. There is no commit step.

Here is how to initialize a GPT disk and create a full-size partition in two lines.

sudo parted /dev/sdb mklabel gpt
# WHY: creates a fresh GPT partition table and overwrites any existing layout
# WHY: mklabel is the parted command for setting the disk label type
# WHY: run this only on a blank or disposable drive

sudo parted /dev/sdb mkpart primary ext4 1MiB 100%
# WHY: creates a partition starting at 1MiB for alignment
# WHY: ext4 is the filesystem type hint stored in the GPT partition entry
# WHY: 100% tells parted to extend to the end of the disk

The 1MiB start offset ensures the first partition does not overlap the GPT header, which occupies the first few megabytes. The 100% end marker tells parted to calculate the exact last sector automatically.

Convention aside: parted is the tool behind gnome-disks and many cloud image builders. It speaks the same language as sgdisk and gdisk, but with a simpler syntax. Use it when you need to reproduce the exact same layout across multiple machines.

Run parted /dev/sdb print to see the final table. The output shows partition numbers, start/end sectors, sizes, and flags.

Visual control with GNOME Disks

GNOME Disks provides a graphical interface that maps directly to udisks2 and parted under the hood. It is useful when you prefer visual confirmation or are managing a single desktop drive.

Open the application from your desktop menu. Select the target disk from the left sidebar. Click the three-dot menu in the top right corner and choose Disk Contents. Click the plus button to add a new partition. Set the size, choose the filesystem type, and click Format. The wizard handles alignment and table creation automatically.

The GUI shows a color-coded bar representing the disk layout. Unallocated space appears gray. Formatted partitions appear in their filesystem color. You can resize, move, or delete partitions by dragging the edges or right-clicking the segments.

Convention aside: GNOME Disks uses persistent device paths internally, so it survives reboots better than manual /dev/sdX references. It also integrates with udisks2 to handle mount points and automount policies.

Check the partition table after formatting. The GUI updates instantly, but the kernel sometimes caches old block device nodes.

Verify the table before formatting

Partitioning is complete when the kernel recognizes the new slices. You must verify the layout before creating filesystems or mounting volumes.

Here is how to confirm the kernel sees the new partition nodes.

lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT
# WHY: lists all block devices with their hierarchy and mount status
# WHY: the FSTYPE column stays empty until you run mkfs on the partition
# WHY: verify that sdb1 appears as a child of sdb with type part

sudo blkid /dev/sdb1
# WHY: reads the partition metadata and filesystem signature
# WHY: blkid returns nothing until a filesystem is written to the slice
# WHY: this prevents accidental formatting of an already populated drive

If lsblk does not show the new partition, run sudo partprobe /dev/sdb to force the kernel to re-read the partition table. This is common after using fdisk or parted on a disk that was previously mounted.

Run lsblk first. Read the tree structure before guessing which device to format.

Common pitfalls and exact error messages

Partitioning fails when the disk is busy, the table is corrupted, or the tool conflicts with existing metadata. Recognizing the exact error saves time.

Device or resource busy

This appears when a partition on the target disk is mounted, used by LVM, or locked by a swap device. Unmount all partitions with sudo umount /dev/sdb*. Disable swap with sudo swapoff /dev/sdb2. Stop any LVM activation with sudo lvchange -an /dev/mapper/vg-lv. Run the partitioning command again.

GPT: failed to get VPD page 0x83

This occurs on older USB bridges or virtual machines that do not support SCSI VPD queries. The disk is still usable. Add the --ignore-errors flag to parted or switch to fdisk, which does not rely on VPD pages for GPT creation.

Warning: The kernel is still using the old partition table.

fdisk prints this after you write a new table. The kernel has not refreshed its internal block device cache. Run sudo partprobe or reboot. Do not format the new partition until the warning disappears.

Convention aside: always use /dev/disk/by-id/ paths in scripts. The by-id symlinks never change across reboots. Run ls -l /dev/disk/by-id/ to find the stable name for your drive. Point fdisk or parted at the symlink instead of /dev/sdX.

Snapshot the system before the upgrade. Future-you will thank you.

Which tool fits your workflow

Use fdisk when you need fine-grained control over partition alignment and type codes. Use parted when you are scripting disk setup or working with GPT on headless servers. Use GNOME Disks when you prefer visual confirmation and are managing a single desktop drive. Stay with the command line when you need to reproduce the exact same layout across multiple machines.

Where to go next