How to Check Server Disk Usage in Linux (df, du, and ncdu Explained)

Monitoring disk usage is one of the most important routine tasks in Linux server administration. A server running out of disk space can cause serious problems including application failures, database corruption, failed backups, and logging issues.

System administrators regularly monitor storage consumption to prevent service interruptions and to identify directories or files consuming unexpected space.

In this guide, we will explain the most practical Linux tools used to analyze disk usage on servers:

  • df (filesystem overview)
  • du (directory size analysis)
  • ncdu (interactive disk usage viewer)

These tools are available on almost every Linux server and are widely used by system administrators managing hosting infrastructure.


Why Monitoring Disk Usage Is Important on Servers

Disk space exhaustion can break multiple services simultaneously. When storage reaches 100%, several things can occur:

โ€ข Databases fail to write new data

โ€ข Applications cannot create temporary files

โ€ข Log files stop writing

โ€ข Backup jobs fail

โ€ข Package updates may stop working

For servers hosting websites or applications, these problems can quickly lead to downtime.

Regular monitoring helps administrators detect abnormal growth in log files, backups, or application data before it becomes critical.

Recommended Reading:

Fixing Common MySQL Server Problems in Hosting Environments


Checking Overall Disk Usage with df

The df command shows the usage of mounted filesystems. It provides a quick overview of how much disk space is available on each partition.

Basic command:

df -h

Explanation of options:

  • -hย displays values in human-readable format (GB, MB)

Typical output looks like this:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        80G   42G   34G  56% /
tmpfs           3.9G     0  3.9G   0% /dev/shm

Key columns:

โ€ข Filesystem โ€“ storage device or partition

โ€ข Size โ€“ total disk capacity

โ€ข Used โ€“ used space

โ€ข Avail โ€“ available space

โ€ข Use% โ€“ percentage used

โ€ข Mounted on โ€“ mount point

Administrators often run df -h first when troubleshooting storage issues because it immediately shows which partition is filling up.


Finding Large Directories with du

While df shows overall filesystem usage, it does not show which directories consume the space.

The du command helps identify directories that are using large amounts of storage.

Example command:

du -sh *

Explanation:

  • -sย shows a summary for each directory
  • -hย outputs sizes in human-readable format

Example output:

1.2G logs
3.5G backups
120M cache

This allows administrators to quickly identify the directories consuming the most space.

To analyze a specific directory such as /var, run:

cd /var

du -sh *

This method is commonly used to investigate growing log directories or backup folders.


Finding the Largest Files on a Server

Sometimes individual files grow very large. Log files, database dumps, or backup archives can consume significant storage.

To locate the largest files on a system:

du -ah / | sort -rh | head -20

Explanation:

  • du -ahย lists all files and directories
  • sort -rhย sorts results by size
  • head -20ย shows the 20 largest items

This technique helps identify unexpected storage usage caused by large files.

Note: Running this command on the root filesystem can take time on large servers.


Using ncdu for Interactive Disk Analysis

ncdu (NCurses Disk Usage) is a powerful interactive disk analyzer widely used by Linux administrators.

Unlike du, it provides a visual interface directly in the terminal.

Install ncdu on Debian/Ubuntu systems:

apt install ncdu

On CentOS or AlmaLinux:

yum install ncdu

Run the tool:

ncdu /

After scanning the filesystem, ncdu displays directories sorted by size.

Features include:

โ€ข interactive navigation

โ€ข quick identification of large folders

โ€ข ability to delete files directly from the interface

Because of its speed and usability, many administrators prefer ncdu for diagnosing disk space issues.


Common Causes of Disk Space Problems

Several common issues cause storage consumption to grow rapidly on servers.

Log Files

Application logs can grow indefinitely if log rotation is not configured.

Typical locations:

/var/log

Backup Archives

Frequent backups stored locally can quickly consume storage.

Example directories:

/backups
/home

Cache Directories

Web applications sometimes accumulate cache files that must be cleared periodically.

Docker Images and Containers

Docker environments can accumulate unused images and containers over time.


Best Practices for Disk Management

To maintain healthy server storage, administrators typically follow several best practices.

โ€ข Monitor disk usage regularly

โ€ข Configure log rotation

โ€ข Store backups on remote storage

โ€ข remove unused files periodically

โ€ข track application data growth

In hosting environments, storage monitoring becomes even more important when multiple services run on the same machine.


When Disk Usage Becomes a Hosting Limitation

If storage usage continues to grow, upgrading infrastructure may become necessary.

Virtual servers have fixed disk allocations, so expanding storage capacity may require moving to larger plans or dedicated infrastructure.

Depending on workload requirements, users may consider:

โ€ข upgrading to a larger VPS plan

โ€ข deploying scalable cloud servers

โ€ข migrating to dedicated hardware for heavy workloads

Understanding disk usage patterns helps administrators choose the right hosting infrastructure before performance problems occur.

You can explore our servers here:

Offshore Streaming Servers

Offshore Dedicated Servers

Offshore Cloud Servers

Offshore VPS Servers


Final Thoughts

Disk monitoring is a fundamental skill for Linux system administrators. Tools such as df, du, and ncdu make it possible to quickly understand how storage is being used and where problems might occur.

By regularly checking disk usage and identifying large directories or files early, administrators can prevent outages and maintain stable server performance.

For anyone managing Linux servers, mastering these simple commands is an essential part of day-to-day system administration.

Share:

Facebook
Twitter
Pinterest
LinkedIn