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.
Table of Contents
What is a VPS server?
A Virtual Private Server is an extraordinary kind of technology that utilizes virtualization to transform server hardware into hundreds of private servers.
The web host organization would then be able to run various working networks on a single machine and as though there were many. In fact, they are all isolated and given dedicated resources unlike share plans.
So what is VPS really? Well, in truth it’s just a single shared server that is segmented into various private servers. This makes getting VPS hosting a lot less expensive than getting a whole server for yourself, like a dedicated server.
100% Used Server space can be dangerous
A common misconception when operating VPS servers 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.
How to know when your server is Out of 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:
- Website authorisations stop working;
- On e-commerce sites end users are unable to add products or services to the cart;
- Forms stop working on the website and file uploads aren’t possible;
- No creation of session files due to lack of space;
- Unavailability of the database servers;
- Other services unavailable;
- Receiving error messages like “exceeded disk quota”, “cannot create…”, and “no space allowed” etc.
What takes up all the disk space?
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.
Why prevent the server from running out of 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.
Employing root to reduce disk space on VPS servers
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.
Monitor backup turnover
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:
- Use this option to use external media in WHM > Configure Backups which is available on the server.
- Any other process that backs up your files without storing them locally.
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.
Quick tips to free up even more disk space
1. Have awareness of junk files
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.
2. Remove additional backups
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
3. Delete temporary files in cPanel
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_*
4. Delete cPanel file manager temp files
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_*
5. Get rid of, move, or archive log files
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.
6. Clean up the YUM files
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
7. Delete cPanel update archives
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:
8. Remove pureFTP partials (More Temporary Files)
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
9. Decrease the reserved disk space
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
10. Delete unnecessary accounts
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)
Secure your website/server with SSL encryption
No matter the website you have on a VPS or VDS server, you’ll need to secure it for the web. Popular search engines require this especially for business websites.
What is a SSL certificate?
So, what is a SSL certificate, you ask? Well, SSL certificates triggers the HTTP protocol for safe file transfers online which is integral for communication on the web. SSL means secure sockets layer and it’s a cryptographic protocol used for websites, servers and even emails. And contrary to popular thinking, you still need an SSL certificate over VPS servers. Learn more about SSL encryption and why you need it on you site here.
In the end
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.