LESSON · 1 OF 6

Disks, partitions, and mount points

Disks, partitions, and mount points

A Linux machine's storage stacks up in layers:

  • A physical disk (or virtual disk on a VM) is the raw hardware. Examples: /dev/sda, /dev/nvme0n1, /dev/vda.
  • A disk is carved into partitions. /dev/sda1 is the first partition of /dev/sda.
  • Each partition holds a filesystem (ext4, xfs, btrfs, etc). The filesystem is what actually understands "files" and "folders".
  • The filesystem is mounted onto a folder in the tree. That folder is called a mount point. /, /home, /var are common ones.

When you write to /var/log/app.log, Linux checks which filesystem holds /var, sends the write to that filesystem, which stores it on its underlying partition on the disk.

lsblk: see the whole stack

bash
lsblk

Prints every block device the kernel knows about, as a tree:

NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda       8:0    0  100G  0 disk
├─sda1    8:1    0   99G  0 part /
└─sda2    8:2    0    1G  0 part [SWAP]

Reading it:

  • sda is the disk, 100 GB.
  • sda1 is the main partition, 99 GB, mounted at /.
  • sda2 is a small partition holding swap.

lsblk is your first stop when you want to know what storage exists before worrying about how full it is.

Your own output will vary. A small cloud VM often shows a single device like vda with just one partition (or none), not the tidy multi-partition tree above. That's normal.

/etc/fstab, briefly

fstab tells Linux what to mount where at boot:

/dev/sda1  /       ext4  defaults  0 1

You'll edit it rarely. A broken /etc/fstab can prevent the machine from booting cleanly, so never touch it without checking your work twice.

Spin up a fresh environment and practice live.
linux-devops-basic · fresh machine · ready in under a minute