Freeing Up Disk Space
There are often situations where you need to perform a disk space check on your Ubuntu server. Perhaps you checked the dashboard widget and saw your disk usage was too high, or you received a warning about a backup failing, and you ended up here.
The Disk Usage command
To quickly hunt down files or folders taking up your disk space, you can make use of the
du command, combined with the
sort command, to examine any directory on your server. Using these two commands, along with a specific series of switches, you will be able to pinpoint files and directories on the server that are taking up disk space.
You can start by running the following command on any SpinupWP managed server.
sudo du -sh /* | sort -hr
This will return a list of the directories and files in the server root directory, along with the size of each item, ordered by size.
19.8G /sites 1.9G /var 1.7G /usr 503M /snap 145M /boot 12M /opt 7.8M /etc 4.0M /cache 3.0M /home 1.6M /root 992K /run 64K /tmp 16K /lost+found 4.0K /srv 4.0K /mnt 4.0K /media
By ordering the results by size, you can see the directories (or files) at the top of the list that are taking up the most space.
Check out our step-by-step guide on how to use these commands to hunt down high disk space usage culprits.