Disk Management

01

Check available disk space

bash
df -h

To see all mounted partitions in a readable way:

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

Find what takes up space

Usage per folder in current directory

bash
du -sh /*

Find the largest folders

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

Find the largest files on the system

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

Free up space quickly

Clean up package cache (Debian/Ubuntu)

bash
apt autoremove -y
apt clean
apt autoclean

Clean up package cache (CentOS/AlmaLinux)

bash
dnf autoremove -y
dnf clean all

Delete old logs

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

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

Empty /tmp

bash
rm -rf /tmp/*

Find and remove core dump files

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

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):

bash
df -i

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

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

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:

bash
lsblk

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

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

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

DeluxHost, opgericht in 2023, biedt hoogwaardige hostingoplossingen voor diverse digitale behoeften. Wij bieden gedeelde hosting, VPS en dedicated servers met geavanceerde beveiliging en wereldwijde datacenters.

© DeluxHost, Alle rechten voorbehouden. | BTW-nummer: IT17734661006
Alle systemen operationeel