While there are four main types of hosting, shared hosting, Virtual Private server (VPS), Cloud hosting and a dedicated server,…
When it comes to VPS hosting fairly common causes of server crashes are the lack of available free space on the server. Amassing new customers is beneficial to your business, but behind the scenes, it can lead to many issues on the server-side. You can easily begin to run out of disk space on your VPS server due to the server being filled thanks to increasing customers and other server-related functioning. At this point, the only solution you can employ is freeing up disk space on your VPS server. A great way to mitigate this problem is to contact your VPS hosting service provider and ask them to scale your disk space to accommodate the growth of your business.
All VPS Hosting service providers are not equal!
It’s best to use a trusted name in hosting because your VPS hosting service provider should have solutions that grow with your business. At Hosting.uk we have 4 tiers with our virtual server hosting platforms with our largest disk space package coming in at 500 GB.
If your business grows beyond that you will need to know how to troubleshoot disk space issues. In this article, we’ll outline various methods you can use to help you free up disk space on your VPS server. Additionally, we’ll provide you with information about the types of data that takes up the most space, tools you can use to find this data, and how you can clean what’s not needed. Let’s get started.
A common misconception when operating a VPS server is that if uploading new data is not required and the disk space has reached its capacity then having free space is not a necessity. This could not be further from the truth. When a server is at a hundred percent occupancy, it makes it impossible for most of the internal services to function efficiently. This is because there is an inability to create temporary files for the services to function.
When your VPS hosting platform is running out of space it can cause a myriad of errors—everything from MySQL server processing errors to the base-level website scripting being affected.
Overall server functioning is contingent on its services, the sites hosted on it, and its ability to work with the files saved on it.
Therefore, when there is no available space on the server it will be unable to create changes to files, which, is the reason for disrupting the complete and capable operation of the server. For this reason, you need to be sure that there is adequate space on the server so that it can function smoothly and efficiently. Because let’s face it, avoiding this serious problem can only be done through planning in advance (anticipating and monitoring disk space) and remaining aware of the common causes of reduced disk space.
There are various warning signs when your server is running out of disk space. They include but are not limited to the following signs and consequences:
Once you’ve ascertained that the server is running out of free disk space you’ve conquered half of the battle and you’re closer to solving the problem. Next, it is imperative to figure out what files are taking up the most space on the server and clean all the unnecessary files. Additionally, you can once again call your trusted VPS hosting service provided and request to scale your VPS platform for larger disk space.
Like with more scenarios, prevention is better than cure. When it comes to preventing your disk space from being maxed out you need to first have a robust VPS hosting service provider with plans that can scale with your business.
You can start with the first tier and then scale to the highest tier as your business grows to ensure that your server is always working at its optimum. Otherwise, you run the risk of having insufficient space which can cause irreparable damage which can negatively impact your business.
Cleaning up the server of unnecessary files is easier to do when done promptly to avoid things like corrupted InnoDB tables.
When you’re monitoring disk space on a VPS server, you need to check the amount of used space versus available space from the ‘root’ account. Root access is crucial because it is the lone source of accurate information this is because most of the information within cPanel is limited. Regular cPanel users only have limited access to information. Server statistics need to be checked with the root user to avoid receiving misleading information—an excellent example of this happening is available disk space.
A VPS hosting account needs a certain amount of disk space for server files to function efficiently. Server files include the server’s operating system (like Linux, Ubuntu, CentOS, or Debian), as well as other core software. To see if that disk space is used or free, you would have to access the information from the root account. On the same token, if you check from a normal account, even in your WHM (web hosting manager), you won’t be able to tell if you are already out of disk space! The only other indication maybe the error messages we mentioned earlier.
Not sure if you need a VPS is for you? Have a look at this checklist.
There is a common misunderstanding about WHM backups that eventually lead to many disks space errors. For instance, when a cPanel backup is scheduled in WHM, you can save more than one backup. Automatically, WHM creates a new backup followed by deleting the oldest ‘extra’ backup.
The issue arises at the moment between creating the new backup and deleting the old one. During the midpoint, your disk space can easily slip over its usage limit. Which causes an even bigger issue of server errors because of lack of disk space which further prevents the WHM from deleting the old backups taking up space. Subsequently, it becomes quite difficult to gain access to the server to clear out and delete those old backups.
The easiest way to mitigate this issue is to prevent it from happening—creating backups is good practiced but only save as you need them. On the other hand, you can download a backup to a local storage drive of some kind. It is smarter to keep the backups locally on another drive or server. You can utilise the following methods when using another server connected with your hosting server:
Be mindful that cPanel backup files are quite large and take up a lot of storage on the disk. When you schedule your backups, be sure to leave room on the server for an extra backup that preceded the current backup.
All the email users on your server need to be mindful of the number of emails in their inboxes. Most people don’t take the time to empty their email inbox regularly and all of this takes up space on the server. Years later this inbox clutter can balloon into 30-40 GB of junk, therefore it is important to constantly delete email files. Additionally, adding and uploading temporary files while working on your site further takes up space. An excellent way to manage this properly is to delete temporary files as you design your website and continuously clear out the space you need. Once you regularly prevent those pesky junk files from flooding your space your server will remain running efficiently with lots of extra space.
As we mentioned earlier deleting old backups will keep your server disk space free of unnecessary clutter. While many VPS users store their backups on the server-side as opposed to downloading to their local machine, this contributes to the server running out of space fairly quickly. In cPanel to delete backups for all users you have to use the following command:
for user in `/bin/ls -A /var/cpanel/users` ; do rm -fv /home/$user/backup-*$user.tar.gz ; done
While uploading files through file manager cPanel creates a copy of it. It becomes a temporary file, and so it can be removed by using the following command:
rm -fv /home/*/tmp/Cpanel_*
In cPanel the File Manager will create a temp file that might or might not get removed based on the upload. It is best practice to delete all temp files by employing the following command:
rm -fv /home/*/tmp/Cpanel_*
A huge portion of the log files is kept in /var/log directory, on a busy server they tend to be large files. The frequency of rotation and size of these log files can be adjusted by /etc/logrotate.conf file doing this will compress the files making them take up less space on the server. An alternative way to manage large log files is to gzip them by creating cron job to execute it.
Whenever you complete an update yum it creates package cache files on the server taking up precious space. You can easily use the following command to clean the yum files and free up space:
Yum clean all
Normally updates to cPanel and Apache archives leave behind unwanted files that use up disk space on the server. You can easily delete these files and free up useful disk space by using the following command:
If your VPS server runes pureFTP as an FTP daemon, the FTP server will always create temporary files beginning with pureftpd-upload* when you upload files to the server. These files are renamed to the genuine filename once the upload is completed, therefore, leaving these files on the server once the upload is incomplete. Remove these files easily by using the command to delete them and free up disk space:
locate .pureftpd-upload | xargs rm -fv
Let’s say your VPS server has a disk space allowance of 1TB. When you run a DF on the server you may notice there are only 50GB of disk space available when you’ve only used up 900GB. Where did the other 50GB of disk space go? Well, the default setting of Linux reserves 5% of disk space from each partition for the root user, this enables the root user to log in even if the disk is full.
If your drive has a large disk space it is not necessary to allocate the entire 5% of your disk space for reserve, you can decrease this value up to 2500 blocks enabling you to free up more disk space on your server. To do this use the command that follows to reduce the allocated disk space for the root user:
tune2fs -r 2500 /dev/sda1
When you have a bigger church rate you normally have multiple user accounts that are no longer in use. Checking suspended accounts is made easy by:
Check out WHM> List Suspended Accounts or Is/var/cpanel/suspended
If you have a greater churn rate you probably have numerous user accounts that are not in use.
To dismiss or terminate unnecessary accounts:
WHM > Terminate an Account or you can use the command to terminate an account:
/scripts/killacct <user> <y/n> (y/n indicating whether to save the DNS records)
If you’ve gone through all of the above to free up disk space on your VPS server and you still find yourself running out each month or receiving error messages it may be time for you to scale up to a bigger server. Additionally, opting for Managed VPS can help mitigate server errors and keep your server running in tip-top shape. At Hosting.uk we have affordable VPS hosting service provider options for you to choose from to accommodate any size business.