Linux Tutorial / Understand Disks, Partitions, and File Systems
A disk is a block-storage device, a partition is a defined region of a device, and a file system organizes files and directories. Mounting attaches a file system to the directory tree; devices, partitions, file systems, and mount points are different layers.
This lesson distinguishes block devices, partitions, and file systems. Mounts and storage usage connects a file system to a directory and verifies its actual source.
System configuration exercises use a conventional Ubuntu 26.04 LTS or Rocky Linux 9 VM as the reference environment. Containers, WSL, and other releases can differ in service and package configuration. Prepare console recovery and record your versions using the virtual machine setup lesson.
Read storage as several separate layers
| Layer | What to inspect | Typical tools |
|---|---|---|
| Block device | Capacity, type, parent relationships | lsblk |
| Partition or logical volume | Defined region or logical storage allocation | lsblk, partition or LVM tools |
| File system | Format such as ext4 or XFS and its UUID | lsblk -f, blkid |
| Mount | Path and access options | findmnt, df |
A common layout is disk → partition → file system → mount point, but real systems may use logical volume management (LVM), encryption, or software RAID between those layers. A file system can also occupy a whole device. An absence of partitions does not establish that a device is empty.
Inspect device names alongside their actual use
lsblk -o NAME,TYPE,SIZE,FSTYPE,UUID,MOUNTPOINTS
findmnt -T /
df -hT /
Names such as sda, vda, and nvme0n1 reflect device type and discovery order. An NVMe partition commonly appears as nvme0n1p1. Never identify the system disk or a new disk by name alone: compare size, mounts, and provider volume identity. On older lsblk versions, use MOUNTPOINT if MOUNTPOINTS is unsupported.
lsblk shows device relationships, findmnt -T / identifies the mount covering the root path, and df reports file-system usage. Reserved space, metadata, units, and storage layers can explain apparent differences. A device missing from df is not necessarily unused.
Separate the partition table from the file-system format
GUID Partition Table (GPT) and Master Boot Record (MBR) describe partition layouts; ext4 and XFS are file-system formats. A partition on a GPT disk can contain ext4. Replacing a partition table can destroy access to existing data. This lesson does not create or change a partition table on a real disk.
ext4 and XFS use different administration and repair tools, and their resizing capabilities and offline requirements differ. Choose based on distribution support, maintenance requirements, and recovery procedures. Do not force a tool intended for a different file system onto existing data.
Create a file system inside a disposable image
The following commands create a temporary directory under your home and a 128 MiB image. mkfs.ext4 is normally provided by e2fsprogs. Formatting initializes the target, so never replace this path with a real /dev/... device. Check that the target is a regular file first.
lab=$(mktemp -d "$HOME/linux-storage-lab.XXXXXX")
truncate -s 128M "$lab/disk.img"
test -f "$lab/disk.img" && test ! -b "$lab/disk.img" && mkfs.ext4 -F "$lab/disk.img"
file "$lab/disk.img"
dumpe2fs -h "$lab/disk.img" 2>/dev/null | head -n 15
printf "lab=%s\n" "$lab"
Expect file to identify an ext-family file system and dumpe2fs to show metadata such as UUID and block counts. The file system exists inside the image but is not mounted yet, so it is not accessible as an ordinary directory. Image size and usable internal space are not identical.
Verify the result and remove only lab data
The objective is to distinguish storage layers, not memorize a formatting command. This image contains ext4 directly without a partition table. Keep the printed path if you will continue with mounting. Otherwise, inspect the temporary directory and remove only those lab files using your file manager.
For real storage changes, first obtain a restorable backup, verify device identity, and inspect mounts, swap, LVM, and RAID membership. When the state is unclear, preserve evidence and plan recovery before formatting or rewriting partitions.




