The storage stack
Linux storage is layered. A physical disk exposes block devices. A partition table divides a disk. Partitions or logical volumes contain filesystems or swap. Filesystems are mounted into the directory tree.
Commands such as lsblk, blkid, df, du, mount, and find answer different questions at different layers.
Disks, partitions, and block storage
A block device is storage addressed in blocks rather than named files. Disks often appear as /dev/sda, /dev/nvme0n1, or /dev/vda. Partitions appear as names under those disks, such as /dev/sda1 or /dev/nvme0n1p2.
Do not rely on device names staying the same across hardware changes. UUIDs and labels are safer for persistent mounts.
ext4, btrfs, and xfs
A filesystem defines how files and directories are stored inside a partition or volume. The best choice depends on your distribution defaults, backup approach, snapshot needs, and recovery comfort.
| Filesystem | Strength | Typical use |
|---|---|---|
| ext4 | Mature, simple, reliable default | General-purpose Linux systems |
| btrfs | Snapshots, checksums, subvolumes | Desktops with rollback, advanced storage features |
| xfs | Strong performance for large filesystems | Servers, large storage volumes |
Swap
Swap is disk-backed memory support. It can prevent immediate out-of-memory failures and may be required for hibernation. It is slower than RAM, so heavy swapping usually means the system needs less workload or more memory.
Modern distributions may use swap partitions, swap files, zram, or a combination. The concept is the same: provide memory pressure relief outside normal RAM.
Filesystem checks and disk usage analysis
Use df when the question is which filesystem is full. Use du when the question is which directory consumes space. Use lsblk and blkid when the question is what disks, partitions, filesystems, and UUIDs exist.
df -hdu -h -d 1 /var 2>/dev/null | sort -hlsblk -fSSD vs HDD, MBR vs GPT
SSDs are faster and have no spinning platters. HDDs are slower but still common for inexpensive large storage. Linux works with both, but SSDs benefit from proper discard/TRIM handling, usually configured by the distribution.
MBR is the older partition table format with limitations. GPT is the modern default, especially for UEFI systems and large disks.
Practical storage management tips
- Keep backups before partitioning or filesystem repair.
- Use lsblk -f before mounting or formatting so you identify the correct device.
- Prefer UUIDs in /etc/fstab for persistent mounts.
- Do not run filesystem repair tools on mounted writable filesystems unless documentation says it is safe.
- Investigate disk-full problems before deleting broadly; logs, caches, containers, and snapshots are common causes.