Server Management

Disk Management

How to check disk space, find large files and free up disk space

Check available disk space

df -h

To see all mounted partitions in a readable way:

df -h --output=source,size,used,avail,pcent,target | grep -v tmpfs

Find what takes up space

Usage per folder in current directory

du -sh /*

Find the largest folders

du -h / --max-depth=2 2>/dev/null | sort -rh | head -20

Find the largest files on the system

find / -type f -size +100M -exec ls -lh {} \; 2>/dev/null | sort -k5 -rh | head -20

Free up space quickly

Clean up package cache (Debian/Ubuntu)

apt autoremove -y
apt clean
apt autoclean

Clean up package cache (CentOS/AlmaLinux)

dnf autoremove -y
dnf clean all

Delete old logs

# Delete logs older than 7 days
journalctl --vacuum-time=7d

# Limit logs to max 500MB
journalctl --vacuum-size=500M

Empty /tmp

rm -rf /tmp/*

Find and remove core dump files

find / -name "core" -type f -delete 2>/dev/null

Check for exhausted inodes

Sometimes the disk appears "full" even though df -h shows available space. The problem might be exhausted inodes (too many small files):

df -i

If a partition is at 100% inodes, you need to delete files (often temporary files or PHP sessions):

# Find the folder with the most files
find / -xdev -printf '%h\n' 2>/dev/null | sort | uniq -c | sort -k 1 -n | tail -20

Expand the disk

If you upgraded your plan and the disk was extended, you may need to manually expand the partition.

Filesystem expansion is a delicate operation. Always make a backup or snapshot before proceeding. If you're unsure, contact support.

Check if there is unallocated space:

lsblk

If the partition is smaller than the disk, expand with:

# For ext4 filesystem
growpart /dev/vda 1
resize2fs /dev/vda1

# For xfs filesystem
growpart /dev/vda 1
xfs_growfs /

On this page