Create and Restore Backup in VPS / Reset VPS / Reinstall OS in VPS / Troubleshooting VPS / Convert VPS to Newly Created VPS

 Introduction





Today we are going to talk about "How to create and restore backup in VPS". Also, you can use this method to convert your VPS to newly created VPS, reset your VPS, reinstall os in your VPS and troubleshooting your VPS. This method works on every cloud provider. If you know, there is built-in method for back up process in oracle cloud. But, if you have "Out of capacity" error, you can't use built-in method. So, my method is the most important for oracle cloud users. Now let's talk about special things in my method.

  • Works on every cloud provider
  • Can create any number of backups
  • There isn't size limit in backup
  • Don't need to install any software
  • Very simple process
  • It takes only less than 5 minutes

There are many other features. You can find them when using the method. First, I will show you that "How to use built-in backup process in oracle cloud and reason for can't use it if you have 'out of capacity' error". Next I will show you that "How to use my method?".

Video



This is the fully guided video for this blog post. This video will help you to understand this better.

Download Zip File


You need to subscribe my YouTube channel to download zip file. Click on "Subscribe YouTube Channel" button below. After clicking it, you will automatically redirect to my YouTube channel. After subscribing my YouTube channel, come back here to download zip file. If you already subscribed my YouTube channel, just click on "Subscribe YouTube Channel" button below and come back here.



Things We Do


Now let's talk about what things we do in this post.

  1. Creating A Backup Using Built-in Backup Process In Oracle Cloud
  2. Restoring A Backup Using Built-in Backup Process In Oracle Cloud
  3. Creating A Backup Using My Method
  4. Restoring A Backup Using My Method

So, let's start our work.

Creating A Backup Using Built-in Backup Process In Oracle Cloud




As I told before, let's see built-in method. First, go to your oracle cloud account. Now click on the three pieces of stripe in top left corner. Now click on "Compute". Now click on "Instances". Now you can see your instances list here. Remember the name of instance that you want to create backup. Now click on the three pieces of stripe. Now click on "Storage". Now click on "Block Volumes". Now click on "Boot Volumes". Now you can see list of "Boot volumes". Now you need to find "Boot volume" that contains name of your instance. For this tutorial, I will choose this "Boot volume". Now click on the three dots. Click on "Create Manual Backup". Type any name in "Name" field. Now you need to choose type of backup. Click on "Backup Type" menu. You can see two backup types. "Full backup" mean it includes all changes since the volume was created. "Incremental backup" mean it includes only the changes since the last backup. So, I choose "Full Backup". Click on "Create Boot Volume Backup" button. Now your backup is being created. Follow these steps to see your "Boot volume backups". Click on "Boot Volume Backups". Now you can see " Boot Volume Backups " here. Previously created backup is being created yet. I created another backups before. Now let's see that " How to restore backup? ".

Restoring A Backup Using Built-in Backup Process In Oracle Cloud




I will choose previously created backup for this. Click on the three dots. Now click on "Restore Boot Volume". Type any name in "Name" field. Use these default settings. Now click on "Restore Boot Volume" Button. Now what's happening is it's creating new "Boot Volume". It doesn't modify current "Boot Volume". It creates new "Boot Volume" instead. So for using this backup, you need to create new instance with this "Boot Volume". This is how "out of capacity" error effects to this process. For finish this process, I will show you "How to create instance using this boot volume". Click on "Create Instance" button. Now you can see "Create Compute Instance" page. You need to fill sections in this page as just you usually do. But, don't change "Image and Shape" section. You can see "Test" as "Image". It means it use our "Boot Volume" as "Image". So, now you can create your instance. I think now you can understand how built in backup process in oracle cloud works. Now Let's go to my method.

Creating A Backup Using My Method




First you need to download text file. This text file contains two bash script files. A lot of oracle cloud users use "Ubuntu" as OS image in VPS. I also use "Ubuntu". So, I tested my method only on "Ubuntu". So if OS image in your VPS isn't "Ubuntu", don't use this method and put comment on video. I will test this method on your OS image and give instructions. Ok now let's see "How to create backup using my method". First you need to login to your VPS. Unzip downloaded zip file. Open "instructions.txt" file in unzipped folder. Copy "root access" command. Go back to VPS and paste copied command and press enter. Now type password if you have added password before and press enter. Now you have full administrative privileges. Now go back to "instructions.txt" file. Now copy "change directory" command. Go back to VPS and paste copied command and press enter. Now you are in "/" directory. The "/" directory in "Ubuntu" is the top-level directory in the file system hierarchy. All other directories and files are located within the "/" directory. Now go to your unzipped folder and you can find file called "creatingbackup.sh". You need to put this file on "/" directory in your VPS. You can see that I have done it. Now go back to "instructions.txt" file and copy "create screen" command. Now go back to your VPS and paste copied command and press enter. Now press space. Screen is a terminal multiplexer. Screen allow the task to run in the background, even if you disconnect from the VPS. Go back to "instructions.txt" file. copy "starting creating backup" command. Go back to your VPS. Paste copied command and press enter. Script is running now. This takes some time. If you interrupt this work, backup will be incomplete. Don't worry about these error messages. You can run this in background because of using "screen". To do it, press "ctrl + a +d". Go to "requirements.txt" file. Copy "reconnect to screen" command. Go back to your VPS. Paste copied command and press enter. If you only have one screen, this command take you to your previous screen. But if you have more than one screen, this command shows list of available screens. So, you need to add name of the screen to that command and press enter. You can see your previously created screen on top of list. Creating backup is completed. It took about 8 minutes. Now I am using "Amd micro" VPS. So, you can do this more faster in "Ampere" VPS. Now you can see that there are two new files. You need to use these two files for restoring backup. You also need ssh private key that you are using now because after you restored this backup, you need to use it for access your VPS. So, you need to put "backup.tar.gz","fileslist.txt" and ssh private key files in safe place. For easy storing them, you can create a zip file putting these three files. Now we can terminate previously created screen because our work is done. Go to "instructions.txt" file and copy "terminate screen" command. Come back to your VPS and paste copied command and press enter. You can see that size of my backup is about 3.5 GB. Size of my storage is 45 GB and usage is 12 GB. Make sure that there is enough space for creating backup. If you created backup in newly created VPS, you can use that backup for converting VPS to newly created VPS, resetting VPS, reinstalling os in VPS and troubleshooting VPS. So, I recommend you to create backup when you newly create VPS. After you store "backup.tar.gz","fileslist.txt" and ssh private key files, You can delete "backup.tar.gz","fileslist.txt" and "creatingbackup.sh" files. Go to "instructions.txt" file. copy "delete files" command. Go back to your VPS and paste copied command and press enter. Ok let's see that "How to restore backup".

Restoring A Backup Using My Method




First login to your VPS. Next go to "instructions.txt" file. Copy "root access" command. Go back to VPS and paste copied command and press enter. Now type password if you have added password before and press enter. Now you have full administrative privileges. Now go back to "instructions.txt" file. Now copy "change directory" command. Go back to VPS and paste copied command and press enter. Now you are in "/" directory. The "/" directory in "Ubuntu" is the top-level directory in the file system hierarchy. All other directories and files are located within the "/" directory. Now go to your unzipped folder and you can find file called "restoringbackup.sh". You need to put this file on "/" directory in your VPS. You also need to put backup files what are "backup.tar.gz" and "fileslist.txt" on "/" directory in your VPS. You can see that I have done it. Now go back to "instructions.txt" file and copy "create screen" command. Now go back to your VPS and paste copied command and press enter. Now press space. Screen is a terminal multiplexer. Screen allow the task to run in the background, even if you disconnect from the VPS. For seeing effectiveness of this script, I will show you current situation in my VPS. Let's see user firewall settings. You can see some ports are opened. Now let's see about softwares. You can see I already installed apache web server. Now let's see about user accounts. You can see that I don't have ubuntu user account. So, let's start script and see what happens to these things. Go back to "instructions.txt" file. Copy "starting restoring backup" command. Go back to your VPS. Paste copied command and press enter. Script is running now. This takes some time. If you interrupt this work, your VPS will be crashed.  This takes some time. After script is successful, your VPS will be automatically rebooted. After reboot is complete, login to your VPS. You need to use ssh private key that you saved with your backup. Now go back to "instructions.txt" file and copy "root access" command. Now go back to your VPS and paste copied command and press enter. Now go back to "instructions.txt" file and copy "updating packages" command. Now go back to your VPS and paste copied command and press enter. This command updates packages in Ubuntu. Backup process is now completed. Let's see how effectiveness of script. You can see user firewall is disabled. Now let's see about Apache web server. You can see it is uninstalled. Let's see about user accounts. You can see "ubuntu" user account. You can see now that this VPS is like a newly created VPS. You can put these backup files in safe place for future restoration processes. After putting them, you can delete them from your VPS. Go back to "instructions.txt" file. Copy "change directory" command. Go back to your VPS. Paste copied command and press enter. Go back to "instructions.txt" file. Copy "delete files" command. Go back to your VPS. Paste copied command and press enter. Backup files were deleted now. I forgot to tell before. There is special feature in this method. It is you can use backup created by other VPS users. I forgot to tell before. There is special feature in this method. It is you can use backup created by other VPS users. Only use backup created by trusted persons because harmful files are can be added to backup. But before using other's backups, VPS that used to create backup and your VPS must be fulfilled these requirements. They are must be hosted on same cloud provider. It means if your VPS is a oracle cloud VPS, other VPS also must be a oracle cloud VPS. They must use same Ubuntu version. Image build version also must be the same. If one of these isn't fulfilled your VPS will be crashed. So, careful about these. If you use backup in newly created VPS, you can use that backup for converting VPS to newly created VPS, resetting VPS, reinstalling os in VPS and troubleshooting VPS. If there isn't space to put backup files in VPS for restoration process, run script only with "fileslist.txt" file. It makes space for "backup.tar.gz" file. So, then put "backup.tar.gz" file and run script again. So, I think now you know everything about this method.

Post a Comment

Previous Post Next Post