Part II · Your system
14. Disk
hub
Everything about storage devices: what's plugged in, how full it is, how it's mounted.
On your machine
$ atfq disk nvme0n1 476.9 GiB SSD · Samsung SSD 980 PRO 500GB nvme0n1p1 512.0 MiB vfat /boot/efi 256.0 MiB free (50%) nvme0n1p2 476.4 GiB btrfs / (+2) 120.0 GiB free (30%) nvme0n1p10 1.0 MiB sda 30.0 GiB rotational · removable · USB DISK 3.0 (whole disk) exfat /media/usb zram0 8.0 GiB SSD · swap 2 loop or empty devices not shown nvme0n1 Samsung SSD 980 PRO 500GB: NVMe flash, 476.9 GiB · scheduler none · 8 hardware queues · volatile write cache · TRIM sda USB DISK 3.0: USB drive, 30.0 GiB · scheduler mq-deadline · no volatile write cache
An example: Alice's laptop, one of the test machines. In your terminal, this block shows your own machine, read live.
Commands
lsblk- tree of disks and partitions
df -h- free space per mounted filesystem
du -sh * | sort -h- size of each item here, biggest last 28.9
findmnt- mount points and their options
find / -xdev -type f -size +1G 2>/dev/null- files over 1 GiB on the root filesystem 28.1
iostat -x 1- live disk activity (package sysstat)
sudo smartctl -a /dev/sda- disk health (package smartmontools)
Paths
/dev/disk/by-uuid/- stable names for disks and partitions
/sys/block/DEV/queue/- I/O scheduler, rotational flag
/etc/fstab- what gets mounted at boot
Also about this
- 4.1Hard drives, SSDs and NVMeA hard drive (HDD) reads magnetic platters with a moving head: fine at long sequential reads, slow at jumping around (a few milliseconds per seek, about a hundred random reads per second).
- 4.2Inside an SSD: flash, TRIM and wearFlash can't overwrite in place: it writes pages of a few KiB, but only erases whole blocks of many pages. The SSD's controller writes new data elsewhere and cleans up old blocks in the background.
- 4.4IOPS, throughput and latency: how fast is a disk?Three numbers describe a disk: latency (time for one request), IOPS (requests per second) and throughput (bytes per second). Throughput = IOPS × request size.
- 13.2/tmp vs /var/tmp/tmp: short-lived scratch files. Often in RAM (tmpfs) and emptied at every boot.
- 13.4Links, inodes and "disk full"An inode is a file's record: owner, rights, size, where the data is. The name is stored in the folder, not in the inode.
- 28.1findfind walks a folder and everything under it, and prints each path that matches your tests.