Disk volumes cheatsheet
Inspection
| Command | Description |
|---|---|
df -hT | Filesystem usage and types (human-readable) |
df -i | Inode usage per filesystem |
du -sh /path/* | Directory sizes one level deep |
du -xhd1 /var | Stay on one filesystem, human sizes |
lsblk -f | Block devices, FS type, UUID, mount points |
blkid | UUID and filesystem labels |
findmnt | Active mounts (tree or table) |
mount | column -t | Currently mounted filesystems |
Mount & unmount
| Command | Description |
|---|---|
mount /dev/sdb1 /mnt/data | Mount a partition |
mount UUID=xxx /mnt/data | Mount by UUID |
umount /mnt/data | Unmount (not busy) |
mount -o remount,rw / | Remount root read-write |
mount -a | Mount everything in fstab (test after edits) |
Partitions & formatting
| Command | Description |
|---|---|
fdisk -l | List partition tables |
parted /dev/sdb print | Partition info (GPT/MBR) |
mkfs.ext4 /dev/sdb1 | Create ext4 filesystem |
mkfs.xfs /dev/mapper/vg-lv | Create xfs filesystem |
fsck -f /dev/sdb1 | Check/repair (unmounted FS only) |
LVM
| Command | Description |
|---|---|
pvs / vgs / lvs | Physical / volume / logical volume summary |
pvdisplay / vgdisplay / lvdisplay | Detailed LVM info |
pvcreate /dev/sdb | Initialize disk for LVM |
vgextend myvg /dev/sdb | Add PV to volume group |
lvextend -L +10G /dev/myvg/mylv | Grow logical volume by 10G |
lvextend -l +100%FREE /dev/myvg/mylv | Use all free space in VG |
resize2fs /dev/myvg/mylv | Grow ext4 to fill LV |
xfs_growfs /mount/point | Grow xfs (mount point, not device) |
Finding what uses space
| Command | Description |
|---|---|
ncdu / | Interactive disk usage browser |
lsof +L1 | Deleted files still held open |
find /var -xdev -type f -size +100M | Large files on one filesystem |
journalctl --disk-usage | systemd journal size |
Example /etc/fstab line
# device mount type options dump pass
UUID=abc-123-def /data ext4 defaults,nofail 0 2
/dev/mapper/vg-lv /var xfs defaults 0 0
Cloud disk resize (typical flow)
# 1. Grow volume in cloud console, then on the VM:
lsblk # confirm larger disk
growpart /dev/nvme0n1 1 # grow partition (cloud-utils)
pvresize /dev/nvme0n1p1 # if LVM on partition
lvextend -l +100%FREE /dev/vg/lv
resize2fs /dev/vg/lv # ext4 — or xfs_growfs /mount
Pro tips
- Always use
UUID=in fstab —/dev/sdXnames can change across reboots - Run
mount -aafter editing fstab before rebooting - Check inode usage with
df -iwhendf -hshows free space but writes fail - Grow the LV before the filesystem — order matters
Practice scenarios
Hands-on Disk volumes scenarios on live Linux VMs: disk volumes