How to back up and Restore data on VPS

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 a dedicated server to a 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 your website content that you have worked so hard to produce or gather, you may lose your 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 a 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 a 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 hassle.

We will go through some factors that can help decide what to do.

Backup Use-Cases

The two main reason that you may need your backup data, are:

  1. 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.
  2. 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.

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 date 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.

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 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 do I backup my entire server?

First, you need to make sure you have enough space for your backup and for the backing up operation. For example, if you are backing up locally to the same machine, 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 back up. 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 fully transferred.

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 changes since last time. Therefore, for restoring your entire data or server you may need to go through several restore points in the back up.

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 dedicated server or back up VPS to a local backup file, in WHM.

  1. Log into WHM as root. You can usually do this by entering https://your.server.hostname/whm in your browser.
  2. Once in WHM, if the sidebar isn’t visible, click the hamburger icon to show it (the hamburger icon is made of three short horizontal lines).
  3. Type “Backup” in the sidebar search box and then click on the Backup Configuration sidebar menu option.
  4. The Backup Configuration options will appear in the main part of the WHM window. Make sure that Enable Backups check box is checked. This way, after you save these options, the next time the backup process is run, the system will back up data the way you are going to specify below. It is typically overnight in local server time.
  5. Next, You can choose whether your back up would be compressed, uncompressed, or incremental.
    1. Compressed backup: your files and folders will be compressed into a single gzip compressed .tar file. It’s slower but takes up less space.
    2. Uncompressed backup: your files and folders are simply copied as they are. It’s faster but takes up more space.
    3. Incremental: every time only the changes are backed up.
  6. Next, you can select whether you want 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.
  7. Next stage is where you can set the timeout limit for successfully backing up the data. It is entered in seconds.
  8. 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 files and continues to the next file.
  9. Backup Schedule. Now this is important. Here you can select days of the week when the daily backup process will be run.
  10. 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.
  11. Weekly Backup schedule is just like the previous stage, but, Well, weekly.
  12. 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.
  13. Which files to back up? Now once again, an important stage.
    1. Your first option is whether to back up User Accounts. You can select 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
  • Back up Bandwidth data
  1. Use Local DNS (most people can leave this unchecked)
  1. The last option in the Files section is Back up System Files which should be definitely checked.
  1. 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. Per Account and Entire MySQL Directory (the best option)
  2. In the final section of the main backup configuration options, you can configure the local server location where backups are made and/or stored. 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 backup to the secondary hard drive.

How do I restart 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 desktop. For that method, follow these steps:

Step 1. Click Start in the lower left corner of the computer. Type Server Manager in the search box and then open it.

Step 2. Click Manage.

Step 3. Click Remove Roles and Features.

Step 4. Click Next to select a server you want to remove roles and features.

Step 5. Uncheck Windows Server Backup option box. Then press Next.

Step 6. 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 folloing:

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

1) Log in to WHM as a root user.

2) Go to Home > Backup > Backup Configuration, then scroll down to the Additional Destinations section.

3) In the Destination Type dropdown menu, select Google Drive.

4) Then click Create new destination.

5) Enter your desired destination name.

6) Enter the desired folder where you wish to store backups.

7) Enter your client ID and client secret.

8) Click Generate Credentials to generate the credentials file. A new tab will appear for you to authorize access to your Google Drive data.

9) Enter your desired Timeout duration.

10) Click the button Save Destination.

 

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, how easy you can 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 from 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.

0
0
0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x