Managing storage
Check disk usage, find what's filling the disk, clean safely and grow partitions after an upgrade.
1 min read Some details need confirmation
On this page
Check usage#
bash
df -h # space per filesystem
df -i # inodes (many tiny files can fill these)Find what's using space#
bash
sudo du -xh / --max-depth=1 2>/dev/null | sort -hOr install ncdu for an interactive view:
bash
sudo apt install -y ncdu
sudo ncdu -x /Common space hogs and safe cleanups#
bash
sudo journalctl --vacuum-size=200M # trim systemd logs
sudo apt autoremove -y && sudo apt clean
docker system df # see Docker usage
docker system prune # removes stopped containers and unused images (read the prompt!)Also check application logs in /var/log, old backups, and core dumps.
After upgrading to a bigger disk#
The disk may grow but the partition and filesystem might not. On a typical ext4 root:
bash
lsblk # identify the disk and partition, e.g. vda and vda1
sudo apt install -y cloud-guest-utils
sudo growpart /dev/vda 1
sudo resize2fs /dev/vda1Was this page helpful?
