If you enabled Backups from the DO control panel they are not stored on your droplet, so they are not eating up your diskspace.
/var directory is often used to store log files and most of them can be found in
/var/log which is most likely where your diskspace is being used up.
As the root user you will have access to all of the directories on your droplet. I would recommend you do the following:
user$ sudo su -
root# cd /var
root# du -hcs * | grep G
The first part
sudo su - is basically going to log you in as root and take on all of the environment variables of your root user. Because you are currently logged in as a regular user and then using sudo you can get some “Permission denied” errors when traversing directories, this is because of how the sudo command routes everything along with echo. To avoid that you can just become the root user using
sudo su -
Then go to your /var directory and enter the
du -hcs * command, this will output the filesizes of everything in that directory. Then you send that output to
grep using the pipe
| command and the “G” is literally searching for a capital G, which is going to be short for GB in human readable format which is the
-h flag that you sent to
At this point you should see something along the following:
root# du -hcs * | grep G
Now you know which directories are taking up the most space so you can go through them and browse around. Note that when you find the specific files that are taking up the space do not delete them using
rm. If you do that you may not free up diskspace. This is because the way files are stored on linux is through links. When all of the links to the file are gone then the file is removed. However, if the space is taken up by a log file and it is currently open and being written to when you issue the
rm command you will simply remove the link inside the directory to the file, however the file will remain open by the process that is currently running and still writing data to it.
Instead, to clear out a log file without deleting it you can do the following:
root# cat /dev/null > /var/log/logfile
This will basically clear out all of the data in the file, return the diskspace back to the system, and won’t require you to delete the file either. If it’s a regular file that isn’t currently open and being written to you can delete it with
rm and not worry about using
After you’ve cleaned out the log file you can find the process that was writing to it, review your configuration and setup log rotation which will reduce the diskspace used and keep it to a contained amount, or you can disable logging and then restart the process and not have to worry about it going forward.
If you run into any issues let me know and we can review further after you have more details on where the diskspace is actually being used.
Hope this helps your troubleshooting.