Storage
-
lsblk — block devices
A tree of disks, partitions, and logical volumes — size, filesystem, mountpoint.
3 minlsblklsblk -flsblk -o -
fdisk and parted — partition a disk
fdisk and parted write a partition table (GPT or MBR) and partitions to a disk; parted -s runs without prompts.
7 minlsblkfdisk -lparted -
mkfs — create a filesystem
The mkfs command creates an empty ext4 or xfs filesystem on a partition; the old data on it becomes unreachable.
7 minlsblk -fmkfs.ext4mkfs.ext4 -L -
blkid — filesystem UUID, label and type
The blkid command prints the UUID, label and type of the filesystem on a device — what goes into /etc/fstab.
5 minblkidblkid -sblkid -L -
iostat and pidstat — which disk is busy and which process loads it
iostat shows disk load — requests, latency, %util; pidstat shows CPU, memory and disk usage per process.
8 miniostat -dxsyiostat -xpidstat -dl -
Mounting and fstab
Mounting filesystems: the mount command, persistent mounts in /etc/fstab, UUIDs and options.
7 minlsblk -ffindmntblkid -
Memory and swap: free, available and the page cache
How to read free: used and free memory, the page cache and available; swap, a swap file and vm.swappiness.
11 minfree -hgrep -Eps -eo -
Loop device — a file as a disk
A loop device shows a regular file to the system as a disk: you can partition, format and mount it.
5 mintruncate -slosetup -flosetup -fP -
Disk space: df, du, inode
Where the space and inodes went — df, du, finding large files, pitfalls.
4 mindf -hdf -idu -xh -
Log rotation with logrotate
Keeping logs from filling the disk — rotation, compression, retention, checking configs.
4 minlogrotate -dlogrotate -fcat -
LVM logical volumes
LVM: physical volumes, volume groups and logical volumes (PV → VG → LV), extending and snapshots.
5 minlsblkpvsvgs -
resize2fs / xfs_growfs — growing a filesystem
Grow ext4/xfs after a volume grows — online growth, shrinking only on ext4 offline.
4 minlvextend -Lresize2fsxfs_growfs -d -
Filesystems: ext4, xfs, fsck
Filesystems: creating one with mkfs, labels and UUIDs, fsck checks, choosing between ext4 and xfs.
7 minlsblk -fmkfs.ext4 -Ltune2fs -m -
NFS network filesystem
Network directories over NFS — exporting on the server, mounting on the client, permissions.
4 minexportfs -raexportfs -vshowmount -e -
Software RAID with mdadm
Software RAID on Linux — creating an array, checking status, replacing a disk.
5 mincatmdadm --detailmdadm -
qemu-img — virtual machine disk images
Creating and maintaining qcow2 disks — overlays, conversion, resizing.
6 minqemu-img infoqemu-img createqemu-img convert -
Disk quotas
Limiting space and file counts per user/group — enabling, configuring, reports.
4 minsetquota -uedquota -uedquota -t -
Docker — containers: running, ports, volumes, networks
Docker runs programs in isolated containers started from images and manages their ports, volumes and networks.
23 minsystemctl enabledocker rundocker ps -
Container images — layers, tags, registries and digests
An image is a read-only stack of layers with files and run settings; Docker creates containers from it.
13 mindocker loaddocker imagesdocker image