Disks & Partitions

Disks & Partitioning

A raw disk on its own isn't directly usable for storing files - it first needs to be divided into partitions (separate sections the system treats as independent storage areas), and each partition then needs a filesystem written to it (covered in the next section).

Disks appear as device files under /dev, named by the kind of hardware they represent: sda, sdb (SATA/SCSI disks), nvme0n1 (NVMe SSDs), vda (virtio, common in virtual machines). Partitions on a disk get a number appended: sda1 is the first partition on sda; nvme0n1p1 is the first partition on nvme0n1 (the extra p before the number avoids ambiguity with the disk's own numeric-looking name).

CommandPurpose
lsblkTree of block devices
blkidUUIDs & filesystem types
fdisk /dev/sdaPartition (MBR & GPT)
parted /dev/sdaScriptable partitioning (GPT)
gdiskGPT-specific
$ lsblk
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda      8:0    0  50G  0 disk
├─sda1   8:1    0   1G  0 part /boot
└─sda2   8:2    0  49G  0 part /

This is the tree view in action: sda is the whole 50 GB physical disk, and it's been split into two partitions - a small 1 GB sda1 mounted at /boot, and the remaining 49 GB sda2 mounted as the root filesystem. The indentation and tree characters (├─, └─) visually show that the partitions are children of the disk.

Tip: The BIOS/UEFI distinction from the System Architecture module resurfaces here directly: MBR partitioning (used with legacy BIOS) is limited to 4 primary partitions and 2 TB disks; GPT (required for UEFI, but usable with BIOS too) supports up to 128 partitions and effectively unlimited disk sizes. If you're setting up a UEFI system, you must use GPT - there's no choice about it.