Introduction
Managing disk usage is crucial for any system administrator. This article shows how to check a server's disk usage from the command line.
Procedure
- Access the command line as the 'root' user via SSH or "Terminal" in WHM.
- Use the df command to show the disk usage of each file system.
[root@server -]cPs# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 18G 23G 45% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 33M 1.9G 2% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/loop0 477M 2.5M 449M 1%
/tmp tmpfs 379M 0 379M 0% /run/user/1000 - Use the du command to show the disk usage of the server.
Please note, virtual filesystems, such as /proc/and /sys, and bind mounts, such as /home/virtfs, need to be excluded from du since they do not take up space on the disk.[root@server -]cPs# du -hxd1 / --exclude=/proc --exclude=/sys --exclude=/home/virtfs
59M /etc
1.4G /root
1.9G /var
11G /usr
371M /boot
1.5G /home
0 /media
0 /mnt
710M /opt
0 /srv
1.4G /backup
18G / - You can then check individual directories by specifing the path in the du command. The following example is checking the /home directory.
[root@server -]cPs# du -hs /home --exclude=/home/virtfs
252K /home