Disk Partitioning
Dividing a physical or virtual disk into separate logical sections before a filesystem can be created on any of them - and the two competing partition table formats you'll run into.
A raw disk isn't usable until it's partitioned: divided into one or more sections, each of which can then hold its own filesystem (see Filesystem Types) and get mounted independently (see Mounting and fstab).
Two partition table formats
MBR (Master Boot Record) is the legacy format: limited to 4 primary partitions (or 3 primary + 1 extended, holding logical partitions inside it), and a 2 TiB size limit per partition.
GPT (GUID Partition Table) is the modern standard: up to 128 partitions without the primary/extended distinction, no practical size limit for any drive you'd actually buy, and required for booting from a disk larger than 2 TiB. Use GPT for anything new - MBR only matters now for compatibility with very old BIOS-only systems.
sudo parted /dev/sdb print
Model: ATA Samsung SSD (scsi)
Disk /dev/sdb: 2000GB
Partition Table: gpt
Number Start End Size File system Name Flags
1 1049kB 2000GB 2000GB ext4
Viewing what's already there
lsblk
sudo fdisk -l /dev/sdb
sudo blkid
lsblk gives a quick tree view of devices and mount points; fdisk -l
shows detailed partition table info for a specific disk; blkid lists
UUIDs and filesystem types, which you'll need for /etc/fstab.
Partitioning tools
| Tool | Notes |
|---|---|
fdisk |
MBR-focused traditionally, now GPT-aware on modern systems; interactive, terse prompts |
gdisk |
GPT-specific version of fdisk's interface |
parted |
Supports both table formats, scriptable non-interactively |
| Distro installers (Ubiquity, Anaconda, Calamares) | Guided partitioning during OS install - what most people actually use day-to-day |
A minimal parted session creating a GPT table and one partition using
the whole disk:
sudo parted /dev/sdb -- mklabel gpt
sudo parted /dev/sdb -- mkpart primary ext4 0% 100%
This changes the partition table, not the filesystem
Partitioning only defines the boundaries - it doesn't put a filesystem on the partition. That's a separate step:
sudo mkfs.ext4 /dev/sdb1
Skipping this step (or running it against the wrong device) is one of the
most common ways to destroy data by accident - always double- and
triple-check the device name (/dev/sdb1, not /dev/sda1) before running
either a partitioning tool or mkfs in write mode. There is no confirmation
prompt that saves you from targeting the wrong disk.
LVM as an alternative layer
Logical Volume Manager (LVM) sits between raw partitions and filesystems, letting you resize, snapshot, and span volumes across multiple physical disks without being locked into fixed partition boundaries. Many distro installers offer it by default for the root filesystem; it's worth knowing it exists even if the partitioning basics above are enough for a single straightforward disk.