Server eating up space fast

**Operating system:**Ubuntu
OS version: 20.04.2

When I migrated my websites over a month ago i was only using 113GB now I am about to hit 200GB. I cleaned up any previous Kernals but still the space is dwindling on my 500GB drive.

Any idea what may be eating up my hard drive space? I checked my top clients and they are not increasing their space that much.

@mattvanderhoff,

How about log files? I find log files at times can grow out of control, and having too many copies can also be a problem. This is usually linked with a buggy website which is producing lots of errors.

If you’re “error logs” for website(s) is growing large, it’s time to inspect it and fix the underlying issues.

/var/log/virtualmin

That’s where logs related to websites live – both access and error along with any archived copies based on log rotation rules.

/var/log

That’s generally where most other logs live.

Also if you’re running a WordPress website, be sure to inspect to see if it’s been hacked – many hacks populate the “public_html” and subdirectories with spammy content, your database with bogus content, or both.

Aside from that, it’s just a guessing game as you haven’t really told us a whole lot about your setup and where the files are growing.

Best Regards,
Peter Knowles | TPN Solutions

Affordable, Reliable IT Support – https://tpnassist.com

Thank you for the reply.

I just checked /var/log and total file size of folder is 1GB, well 996MB so do not think that is it.

That is the thing, I am not sure where the growth is coming from. How would I find the folder or files that are having such a cancerous growth?

Thank you in advance.

@mattvanderhoff,

As mentioned, be sure to check the “/home” directory to see if there are any large files as well.

Another common place is “/tmp”.

If you’d like to hire me, we could do a screen sharing session to determine what’s going on.

Normally growth happens in “/home” (naturally or maliciously), “/tmp”, or “/var”.

Most other locations don’t typically grow out of control unless your server has been hacked.

Best Regards,
Peter Knowles | TPN Solutions

How often are you backing up? And are you purging old backups or keeping them all?

@Gomez_Adams

We are backing up every 2 days to a secondary hard drive specifically for backups.

I do not believe we have any local backups on the main drive.

Double check your backup log. Make sure it’s not either erroring out (in which case you might have a bunch of temp files bogging down the system) or that it’s keeping a copy on your main drive.

You can install ncdu and run it at your cli.
It will show you, which amount of filessize each directory contain.
With the Keypress d you can delete files, or see h for help to see an overview of available commands.

I love ncdu, use it very often.

1 Like

The only thing I’ve had issue with “recently” is it not clearing up old kernels… which has resulted in many Gb of pointless old kernels sat around until the disk gets full.

see if you have much in your /lib/modules folder and if so you can try apt autoremove

Find all files larger than 100Mb, reporting their size, and ordering them largest to smallest, whilst throwing away warnings about files that can’t be read due to permissions:
find / -type f -size +100M -exec ls -lh {} \; 2> /dev/null | awk '{ print $NF ": " $5 }' | sort -nrk 2,2

Whenever my drive is getting full and I’m not sure what the source is I open the File Manager, navigate up to the drive’s root, Select All, right-click > Properties > Calculate Selected Size. This will give you the total size of every folder in the root. Open the largest offending directory and repeat until you get all the way down to the ultimate cause. Assuming the issue is coming from a single root cause this generally gets to the bottom of it.