Backing up your server data or your VPS hosting is not as hard as you may think. And it is a necessary thing to do. This article will get explain how you can back up and restore data on VPS hosting, or a VPS server to local backup storage.
What Is a Backup Server?
If you have a website or a web server that you use to run programs on, or a remote computer that you use as a remote desktop to do some critical work, there is always a risk of losing your data. You may lose the website content that you have worked so hard to produce or gather, you may lose the settings and configurations that you had done so meticulously, or you may lose actual data stored on the server. For whatever reason that it can happen, whether a cyber attack or hack, losing access, corruption in your website or data, wiping your storage by mistake, or any other way, it is a nightmare. However, you can prevent that nightmare from coming true.
That is what backup severs are for; if you backup your critical data to a backup server, a backup VPS, a cloud backup, or local backup storage regularly, you can save yourself from all that headache. This is a task that can be automated or scheduled.
What is storage VPS?
A VPS or Virtual Private Server is a minimal emulation of a server in the way that an actual server is broken down into dedicated portions which act and run as independent virtual machines.
There are many VPS hosting solutions out there, but you can also use a VPS as remote backup storage for your critical files and data on your main server or VPS hosting. This is called a Storage VPS.
First Step: Find Out Your Current Backup Plan
Try to find out an answer to these questions:
- Is your VPS or Dedicated server backed up?
- Does the backup include only a portion of your files, or are all the files included?
- Is the backup local (i.e. on the same machine) or do you have a secure remote backup elsewhere?
There are various choices and configurations included in making a proper and secure backup, but a managed VPS or hosting can relieve you from some of the hassles.
We will go through some factors that can help decide what to do.
The two main reasons that you may need your backup data are:
- File Restoration: You need to restore a file or folder that has been corrupted or deleted due to an attack, an error, or an honest mistake.
- Full Server/Data Recovery: You need to restore your whole server or data to a previous working restore point before the disaster.
Types of Backup
Whether you have a VPS or another hosting system like a dedicated server, there are two common types of backups: full and incremental.
1- Full backups
Full backups are typically taken daily and backup the entire data on the server. Although you can restore single files or folders, they are mainly intended for full server recovery or restore operations.
Advantage: All of the data on the server is backed up and is stored in one place.
Drawback: It takes a while every time to back up all the data.
2- Incremental Backup
Incremental backups update changes to the files and system into the backup. Since the size of each operation is smaller, you can schedule it to execute more regularly.
Advantage: These types of backups take less time and are easier because there’s less information to back up every time.
Drawback: There are multiple restore points; therefore, when you need a larger recovery or restoration operation, the information you need may be spread across several restore points.
How can I back up and restore data on VPS?
First, you need to make sure you have enough space for your backup and for the backing up operation. For example, if you want to backup VPS to local storage, you need to make sure that you will be left enough space for your machine to continue working smoothly. If you want to compress the backup so that it takes less space, you will need enough space for the uncompressed copy as well as the compressed backup. If you want to store the compressed version remotely, you should remember that every time you take a backup, the older compressed version won’t be deleted until the new version is completely relocated.
When configuring and choosing the type of backup you want to make, your entire server is backed up by default, but if you choose the incremental method, every time it will only back up the files and folders that have changed since last time. Therefore, for restoring your entire data or server you may need to go through several restore points in the backup.
How to Configure Local Backups on a cPanel Dedicated Server or VPS
Here we will show a step-by-step guide for how to back up a dedicated server or back up VPS to a local backup file, in WHM.
Step 1 : Login as the root user
Log into WHM as the root user. You should be able to do this by entering https://your.server.hostname/whm in your browser.
Step 2 : Click on the hamburger icon
Now that you are logged into the WHM, if you can not see the sidebar, click on this 🍔 and you should be able to see it now (the hamburger icon is made of three short horizontal lines).
Step 3 : Select Backup Configuration
Type in “Backup” in the search box. Then click on the Backup Configuration in the sidebar menu option.
Step 4 : Enable Backups checkbox
The Backup Configuration options will appear in the main part of the WHM window. Then checkmark the Enable Backups checkbox if it is not checked. This way, when you have stored these configurations, the next time the backup process is run, the data will be backed up in the way you have specified.
Step 5 : Choose back
Next, You can choose whether your backup would be compressed, uncompressed, or incremental.
- Compressed backup: your files and folders will be compressed into a file named gzip-compressed .tar file. It’s slower but takes up less space.
- Uncompressed backup: your files and folders are simply copied as they are. It’s faster but takes up more space.
- Incremental: every time only the changes are backed up.
Step 6 : Access cPanel to check the available disk space
Next, you can choose if you need cPanel to check the available disk space before attempting to back up. This will make sure that your backup system does not accidentally take all the available disk space.
Step 7 : Set the timeout limit
The next stage is where you can set the timeout limit for successfully backing up the data. It is entered in seconds.
Step 8 : set a restoration timeout limit
The next stage is for the event when you actually are trying to restore files from backup to your main system. You can set a restoration timeout limit in seconds before cPanel gives up on restoring a single file and continues to the next file.
Step 9 : Backup Schedule.
Now, this is important. Here you can select days of the week when the daily backup process will be run.
Step 10 : Select backups number
Finally, you can select how many backups on each backup-day should the cPanel make and their Retention. Retention means how many backups will be kept for safekeeping. If you choose, for example, 5 daily backups with a retention of 2, cPanel will keep the two most recent successful backups for each day, and delete the older ones to free up space.
Step 11 : Chpoose weekly backups
The weekly Backup schedule is just like the previous stage, but, Well, weekly.
Step 12 : Select both options
Next will be your monthly back options, which are two: on the first day of every new month, or on the 15th, and of course, you can select both.
Step 13 : Select back ups files
Which files to back up? Now once again, an important stage.
The first choice you can make is to back up the User Accounts. You can choose to do so, or select specific user accounts to be included in the backup. There are a few more options under that, including:
1- Back up suspended accounts;
2- Back up Access Logs.
Step 14 : Back up Bandwidth data
1- Use Local DNS (you can leave it unchecked)
2- And then, check the Backup System Files section.
Step 15 : Database
The next part is the Databases, here you can choose how cPanel will try to back up your Databases, in three ways:
1- Per Account Only
2- Entire MySQL Directory
3- For every account and entire MySQL folders and directories (the best option)
At the very last steps of these configurations, you are able to adjust the location of the backups. By default, this is /backup – and if you have a second hard drive for backups with its mount point there, then you won’t need to change anything and the system will back up to the secondary hard drive.
How do I restart the Windows backup service?
If you have a Windows Backup Service process stuck and you need to restart it, first stop the current backup job. You need to sign in as an admin user and run the command prompt (admin). In the prompt console, stop the current backup job using this command:
wbadmin stop job
another way for stopping the Windows Backup Service is through the desktop. For that method, follow these steps:
Step 1 : Open Server manager
Click Start in the lower-left corner of the computer. Type Server Manager in the search box and then open it.
Step 2 : Click Mange
Click on the Manage button.
Step 3 : Remove roles.
Click Remove Roles and Features.
Step 4 : Click Next
Click Next to select a server you want to remove roles and features from.
Step 5 : Uncheck Backup option box
Uncheck the Windows Server Backup option box. Then press Next.
Step 6 : Click Remove
Click Remove to turn off Windows Server Backup service.
For starting the Windows Backup Service again, you can follow these same steps and add the feature again.
For starting the Windows Backup Service through cmd (command prompt), do the following:
Step 1. Sign in as Administrator
Step 2. Run Command Prompt (admin)
Step 3. Run this command:
wbadmin enable backup
Visit Microsoft’s wbadmin enable backup documentation page to see how to define backup parameters through that command.
How to configure and Back up VPS to Google Drive
Google is by no exaggeration one of the best things that the human being has created. Not only you can use it to store your daily and routine data like sheets, docs, pdf and… You can also back up vps on google drive, how cool is that? So follow the below steps to do so:
Step 1 : Login as a root user
Log in to WHM as a root user.
Step 2 : Additional Destinations section
Go to Home > Backup > Backup Configuration, then scroll down to the Additional Destinations section.
Step 3 : Select Google Drive.
In the Destination Type dropdown menu, select Google Drive.
Step 4 : Create a new destination
4) Then, click on Create a new destination.
Step 5 : Enter a name
Enter your desired destination name.
Step 6 : Select backups location
Enter the desired folder where you wish to store backups.
Step 7 : Client ID
Enter your client ID and client secret.
Step 8 : Generate Credentials
Click Generate Credentials to generate the credentials file. A new tab will appear for you to authorize access to your Google Drive data.
Step 9 : Timeout duration
Enter your desired Timeout duration.
Step 10 : Save changes
Click the button Save Destination.
Also Read: 5 Ways to secure Windows VPS
What is the best way to backup files on VPS?
There are best practices as to how to backup files on your VPS. I will go through them very shortly:
1. Decide What Needs to Be Backed Up and Where
This may seem simple, but where do you keep your backups matters in several ways. The space it takes, the time it takes for a successful backup, and how easy it is to find your backup and restore your files.
For instance, if you are doing full server backups only, having at least one full copy stored locally or a server image on your, can save time when you need to restore a single file.
2. Decide on Your Backup Solutions
Your backups can be stored locally, remotely, or a combination of the two.
Depending on your operating system, there are built-in tools and commands to copy and store files locally. As long as your server is not rendered unreachable, you can restore those files easily.
Both Linux and Windows have options for setting up and maintaining local backups.
Remote backups are an invaluable tool for disaster recovery. In the unfortunate event that your server becomes unresponsive crashes, remote backups allow you to restore from a recent restore point and minimize data loss.
3. Automate Backups Wherever Possible
Most hosting control panels, such as Interworx, Plesk, and cPanel, have an automatic backup system that allows for easy setup and management of backups for your VPS. If there is an automated process for your backups, use it!
4. Diversify Your Backup Locations
If you choose to have VPS backups stored locally and remotely by your host provider, using tools like Secure File Transfer Protocol (SFTP) to keep remote copies at another location gives you a lot more security. There is no such thing as too much safety.
5. Test Server Backups Before You Need Them
Without regular testing, you could still be at risk if the backup is not configured the right way or is not working properly. Testing makes sure that the methods you have chosen work best for your project and environment.
If you are an owner of an online business and your entire business depends on your website and its health, then it would be wise to have a backing up plan for your data every now and then.
I know all of the backup processes might seem like a headache and all, but imagine the situation that you have come across a real deal problem in your website and the only thing that can save the day for you is a backup file.
So, leave all the bad emotions about the backup process behind and follow the steps mentioned in this article to back up and restore data on VPS. And be sure that doing it has fewer headaches than not doing it.