Skip to content

4.1 Disks and Partitions

In Linux, everything is a file. Devices live in /dev.

  • SATA/SCSI: /dev/sda, /dev/sdb
  • NVMe: /dev/nvme0n1, /dev/nvme0n2
  • Virtual (VirtIO): /dev/vda

To see what you have attached:

lsblk

We take a raw disk (e.g., /dev/sdb) and slice it into partitions (e.g., /dev/sdb1).

Traditional tool working with MBR (and basic GPT).

sudo fdisk /dev/sdb
# Commands in menu: 'n' (new), 'p' (print), 'w' (write), 'd' (delete)

Modern tool designed specifically for GPT (GUID Partition Table).

sudo gdisk /dev/sdb
# Similar menu commands to fdisk

Scriptable command line tool.

sudo parted /dev/sdb mklabel gpt
sudo parted /dev/sdb mkpart primary 0% 100%