This article is intended for Linux server administrators who need to analyse disk space usage on a VPS. If your server is hosted with and managed by Maxer, please contact our support team and we can check this for you. Do not attempt these steps if you are unsure.

In most cases, a large amount of your VPS disk space is taken up by the operating system, installed software, and log files. Other common contributors include backups, restore files, and temporary data stored in /tmp.

The following steps explain how to identify where your disk space is being used.


Step 1: Check overall disk usage

Run the following command to see a summary of all mounted filesystems:

df -h

This will show you the total size, used space, available space, and mount point for each partition.


Step 2: Find the largest directories

To see which top-level directories are taking up the most space, run:

du -h --max-depth=1 / | sort -hr | head -10

This displays the 10 largest directories under / in human-readable format.
You can replace / with another path (for example /var) to drill down further.


Step 3: Use interactive tools (recommended)

Instead of manual du commands, it’s often easier to use an interactive tool:

  • ncdu – a simple, ncurses-based tool for browsing disk usage. Install and run it with:

     
    yum install ncdu      # CentOS / RHEL
    apt install ncdu      # Debian / Ubuntu
    ncdu /

    Use the arrow keys to navigate and explore large directories.

  • gdu – a faster, modern alternative written in Go. On many distributions it can be installed from the package manager:

    apt install gdu # Debian / Ubuntu
    yum install gdu # CentOS / RHEL (if available)
    gdu /

These tools make it easier to quickly identify large files and directories without building long shell commands.


Step 4: Check specific directories

Some directories are more likely to grow quickly on a VPS. Common places to check include:

  • /var/log → log files (especially on cPanel servers, Apache/Nginx, Exim, etc.)

  • /var/lib/mysql → MySQL or MariaDB databases

  • /home → user data and website files

  • /backup or custom backup directories

  • /tmp → temporary files and cached data


Step 5: Take action

Once you’ve identified large files or directories:

  • Remove old or unnecessary backups

  • Rotate and compress logs properly

  • Clean /tmp if safe to do so

  • Optimise or archive old databases

  • Consider expanding your VPS storage if legitimate usage is filling the disk


✅ By using df, du, or interactive tools like ncdu/gdu, you can quickly identify what’s consuming disk space and take action before it impacts performance.

Updated by SP on 02/10/2025

Was this answer helpful? 235 Users Found This Useful (261 Votes)