Hi Everyone,
Ok so here is a little tutorial which I think will save a big headache for lots of you, and I wish I had an article just like this when I had the problem a while back.
So if your running a CentOS distro, or similar, because this applies to a lot of distributions of linux and your running a MYSQL database, or something else, and every thing is running fine, and your cpu loads are low, but you have quite a big database. Say a few million records taking up a few GB of space – then all of a sudden, your cpu spikes, showing in TOP as 200% or more. Everything goes to to hell and the server keeps crashing. Well its likely because your var partition ran out of space.
Linux Distro: CentOS and others.
Symtom: CPU Spikes madly for no apparent reason, frequent crashes.
Problem: Your var partition is only 4GB by default.
Solution: Make it bigger by extending.
First of all, make sure this is the problem.
1. Open up a terminal and SSH in to your server.
2. Run df -h. See if your var partition is using 100%. If so you’ve confirmed your out of space and need to extend it. Also stop mysql running with service mysqld stop (or similar depending on your configuration).
3. If your running CentOS here is how:
Run these commands in order:
lvextend -L +10G /dev/mapper/vg00-var
lvs
mount
xfs_growfs /var
Run df -h again to see if you are still using 100% of var, you shouldn’t be. This extends it by 10gb, but I recommend doing way more than this if you have the hard drive space to spare.
Conclusion
So I have no idea why a lot of images are coming with a default 4gb of space. Seems stupid when you tend to have a lot of space to spare, especially when var is the default location for mysql storage on most distros. As for why its using up tons of CPU and going nuts. Its likely that the server gets into some sort of loop trying to write log files, database files, swap memory, generally trying to use the hard drive when there is little or no space available. I honestly don’t know why it causes it to go so mad, but at least you know how to fix it. I’m sure someone with more Linux knowledge than me can comment below and tell us why it does. I’d be interested to know. Plus feel free to ask for any help or suggestions, or alternations to this tutorial in the comments. I’ll be happy to amend it.
Thanks,
Alan



