2

I have an Ubuntu server VPS with DigitalOcean. This Ubuntu server contains a very simple web server and website setup, and not much else. However, whenever I create an image of the droplet (using the DigitalOcean control panel) the size is always increasing. The last image is 13GB, up from 9GB a few weeks ago... 7GB ... 5GB... just a few months ago.

So the disk space is getting eaten up, and I'm not sure why.

The /var/ directory where the website and other related assets are, including all the log files, is only using 1.3GB. So apparently this is not the source of the problem.

  1. how can i determine what is eating up this disk space? Yes, I known I can use du, etc., but the problem is I don't know what would normally and legitimately be taking up a lot of space and what wouldn't. I want to see where this expansion in disk usage is occurring so I can then investigate to see if I can purge old/unnecessary files.

  2. can you tell me what directories/files on an ubuntu server typically need pruning over time to prevent wasted disk space like I am experiencing?

  3. I have enabled automatic system security updates. Could this be contributing to the problem? How would I check this? Can I clean out old files? Where would they be?

  • Now do sudo apt autoremove, then check the space left. Space consumption should be in /var or /boot. Do you clean after every security update? – George Udosen Apr 10 '17 at 15:19
  • /boot looks relatively small. Here is what du -sh /* returns: 9.6M /bin 694M /boot 4.0K /dev 7.8M /etc 520K /home 4.6G /lib 4.0K /lib64 16K /lost+found 8.0K /media 4.0K /mnt 15M /opt 0 /proc 59M /root 380K /run 12M /sbin 4.0K /srv 2.1G /swapfile 0 /sys 4.0K /tmp 3.4G /usr 1.6G /var So it seems the culprits are /lib + /usr (and of course /swapfile, but i was expecting that one). – penname Apr 10 '17 at 15:27
  • "Do you clean after every security update?" No. The automatic security updates were enabled using the instructions found here: howtogeek.com/204796/… I don't believe this does any cleaning... – penname Apr 10 '17 at 15:33
  • TO nail the culprit try the answer by Rinzwind and take note of folders growing abnormally! – George Udosen Apr 10 '17 at 15:35
3

First, how can i determine what is eating up this disk space?

find . -type f  -exec du -h {} + | sort -r -h > /tmp/files.txt

to list files ordered by size.

but the problem is I don't know what would normally and legitimately be taking up a lot of space and what wouldn't.

Neither do we. What you can do is create a list of all files with the command above and compare it to the same list next week. Find the files that got bigger or the new files (diff is a good tool for that).

Second, can you tell me what directories/files on an ubuntu server typically need pruning over time to prevent wasted disk space like I am experiencing?

  • did you install software? Ubuntu keeps a cache of packages. But generally this will not be the issue: a server has its software and when working should not have new software installed. Only updates and those are small (the mostly replace the existing software).

Third, I have enabled automatic system security updates. Could this be contributing to the problem? How would I check this? Can I clean out old files? Where would they be?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.