Understanding and managing disk space

Check the free disk space on a Linux VPS, find out what is taking up the most room, and safely reclaim space.

Updated

Checking overall disk space

df -h

Shows the used and available space for each mounted partition in a readable format (GB rather than raw blocks). The line for / (root) is generally the one to watch on a typical VPS with a single partition.

Finding out what is taking up room

To explore a specific directory and see what weighs the most inside it:

du -h --max-depth=1 /path/to/directory | sort -rh

This command lists the size of each direct subdirectory, sorted from heaviest to lightest — handy for working your way down to the source of a full disk.

Logs growing too fast

System logs are generally handled by logrotate, which archives and deletes them automatically according to a retention policy. An application-specific log (a database, a game server), on the other hand, can grow indefinitely if it has no rotation of its own configured — check its configuration if its log directory is unusually heavy.

Cleaning the APT cache

On Debian/Ubuntu, packages downloaded by APT stay in cache after installation:

sudo apt clean

This frees the space taken by those already-installed .deb files, with no risk, since they can be downloaded again if needed.

A full disk: the consequences

Resizing the disk

If cleaning no longer helps in the long run, moving up to a plan with more storage remains the most reliable answer — in that case a support ticket or a plan change from Artaun Hosting increases the allocated space without a full reinstall of the VPS.

Can’t find your answer?

The team answers tickets seven days a week, and the Discord is open to everyone.