Disk space issues cause performance problems, prevent file uploads and can stop your server responding entirely. Monitoring storage usage helps you identify large directories, detect runaway log files and prevent your server running out of space before it becomes critical.
You will use the du command to check directory sizes and the df command to monitor overall disk usage across your server. These tools show you where storage is being consumed and help you maintain healthy disk space levels.
The du (disk usage) command measures how much space directories and their contents consume. You will start with basic usage and add options to make the output more useful.
/path/to/directory with the actual directory path you want to check:du /path/to/directory-h flag to convert kilobytes into megabytes, gigabytes or terabytes automatically:du -h /path/to/directorydu scans by adding the --max-depth option:du -h --max-depth=1 /home/directory/home/directory without descending further. The number after max-depth controls how many levels down to scan.sort to list directories from largest to smallest:du -h --max-depth=1 /home/directory | sort -rh-r flag reverses the sort order and -h tells sort to interpret human-readable sizes correctly. This immediately shows which directories consume the most space.You can now identify storage-heavy directories quickly. Common culprits include abandoned backups, forgotten uploads and log files that have grown without rotation. Once you locate large directories, check file ownership to determine which user or process is responsible.
The df (disk free) command shows disk space usage across all mounted filesystems on your server. This gives you a system-wide view of storage consumption rather than focusing on individual directories.
df-h flag to convert block sizes into megabytes, gigabytes or terabytes:df -hdu -h, making it easier to compare directory sizes against total disk capacity.df -h /dev/sda2/dev/sda2 with the partition you want to examine. This focuses the output on a single filesystem rather than showing all mounted volumes.The df command helps you monitor overall capacity and identify partitions approaching their limits. You can now see at a glance which filesystems need attention.
Two additional df flags provide information beyond basic disk space measurements. These options help diagnose specific storage issues that percentage-based metrics do not reveal.
Inodes store metadata for files and directories. If your system runs out of inodes, you cannot create new files even when disk space remains available. Run the following command to check inode usage:
df -i
The output shows total inodes, used inodes and available inodes for each filesystem. High inode usage typically indicates a large number of small files, such as cache files or email messages.
Different filesystem types have different characteristics and performance profiles. Add the -T flag to see which filesystem format each partition uses:
df -T
The output includes a column showing filesystem types such as ext4, xfs or tmpfs. This information helps when troubleshooting performance issues or planning storage upgrades.
Disk monitoring forms part of broader server resource management. On shared hosting, exceeding storage limits can affect your account performance. VPS users need to understand how disk usage interacts with other resource constraints. Our guide to LVE resource limits explains how CloudLinux allocates CPU, memory and disk I/O alongside storage quotas.
Regular monitoring prevents storage issues before they impact your sites. The Linux Documentation Project maintains comprehensive guides on filesystem administration that cover advanced topics including quota management and filesystem tuning. These resources help you develop a complete understanding of storage management on Linux systems.
You can now monitor disk usage on your Linux server using du and df commands. The du command identifies which directories consume the most space, while df shows overall filesystem capacity and usage. These tools help you maintain healthy storage levels and prevent space-related issues.
Run these commands regularly to track storage trends over time. Set up automated monitoring if your server handles critical workloads. Our VPS management guide covers additional server administration tasks including security hardening, performance tuning and backup strategies.
Get scalable resources with our VPS hosting with root access and optional software.
Get VPS HostingPerfect for websites and small businesses unlimited bandwidth with cPanel hosting.
Get cPanel Hosting