Symptoms
From time to time, you may experience an error when trying to view your websites, log in to cPanel, or check your email. Sometimes this is because your server has reached its disk-space limits, and new files can no longer be created or written to.
This article helps you locate where the disk usage or inode usage is on your drive. For help in removing any content, you should always check with your System Administrator so you are not removing critical system files or files needed for your websites.
Procedure
To check the overall disk usage on your server, use the following command:
df -h
The output looks similar to this:
[root@server ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 160G 160G 20K 100% /
The df
command lets you know if you are nearing your disk's limits. However, you should check where all of your disk space or inodes are being consumed.
To track down where the usage is, use the du
command.
The following du
command breaks down the disk usage for each directory in the root filesystem and keeps it easy to read:
[root@server ~]# du -h --max-depth=1 / 2>/dev/null | sort -hr
160G /
100G /backup
42G /home
8.4G /usr
6.8G /var
2.7G /opt
You should also monitor your server's inode usage. If the server reaches 100% inode usage, you won't be able to create new files or directories and will experience the same behavior as if you used up all available disk space.
To check the overall inode usage on your server, use the following command:
df -i
The output looks similar to this:
[root@server ~]# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/vda1 988264 985843 2421 100% /
You can also use du
to view inode usage:
[root@server ~]# du --inodes --max-depth=1 / | sort -hr
985843 /
579631 /home
364933 /home
163487 /usr
17238 /opt
11128 /var
3010 /etc
2429 /root
df
and du
are your best tools to find the disk usage when you only have access via SSH. For more information on how to manage your hard drive space, review this page: