Migrating Backups with VestaCP
In the world of IT, we are always taught to frequently backup, backup, and backup! This is an important routine we must carry out regularly in case of a mission critical event. One particular issue you’ll encounter when trying to restore a backup, is that it might not go the way you planned it. For a prime example: here at Nexgi, I was tasked with backing up one of our web servers and moving it to a nice, new, clean virtual machine I had set up on our personal cloud. So I gladly backed up the machine we had running, migrated the data to a new server, and followed the official VestaCP docs on how to migrate a backup. It turns out, it’s not as easy as it should be. In this blog I will simplify the process of migrating backups to a new machine.
The Setup Environment
Server 1 (Old Server):
- Old deployment of Ubuntu 16.04 LTS Server. (192.168.1.2)
- Latest Deployment of VestaCP.
- Backup data of Server 1.
Server 2 (New Server):
- Freshly deployed Ubuntu 16.04.2 LTS Server. (192.168.1.3)
- Latest Deployment of VestaCP.
- Fresh Server with VestaCP Installed. (This is important)
Programs You’ll Need
- Putty or Any SSH Client
In this tutorial I’ll be covering one method to backup data, but in reality there are multiple approaches. I personally find this way to be the easiest, so if you’re trying to get this done quickly I’d stick with this approach.
- Fire up your good old web browser and login to your Vesta control panel on your old server where you want to retrieve your backup. In this case, I will enter in the following: https://192.168.1.2:8083. Once you’re in the control panel, you’ll want to go to the backup section on the far right.
- Now that you’re in the backup section, you’ll want to generate the newest possible backup to ensure you’ve captured the latest changes that may have been made to the server. This can be done by clicking on the green plus button on the left of the screen.
- Now that that you have the latest backup, you can download it though the web browser by hovering over the backup you want and clicking the download option.
- Now that you have a backup on your desktop, you need to fire up WinSCP and Punch in the credentials to access server 2. In this scenario, my new host is 192.168.1.3 my username: admin and the password: letmein.
- Now that we are in server 2 and are viewing directories, just drag and drop your downloaded backup into server 2’s :/# /home/admin/ directory. When this is finished exit out of WinSCP.
- After the file has been moved to server 2 you’ll need to ssh into the new host (192.168.1.3) .
- Now up your privileges to root with :/# sudo su.
- Move to the /home/admin/ directory and use the following command to move the file :/# cp /home/admin/this_is_your_backup.tar /backup.
- If this command yields a “directory does not exist,” just make it with :/# mkdir /backup and run the previous command again.
- If the file successfully moves to /backup you can delete this_is_your_backup.tar with :/# rm /home/admin/this_is_your_backup.tar.
- The last step is to restore your backup. What you’ll want to do is make sure you move into /backup and run the following command. :/# /usr/local/vesta/bin/v-restore-user admin this_is_your_backup.tar.
- This now should be restoring the backup.
I know this may seem super dumbed-down, but it’s intent is for anyone – including novices – to be able to complete the task. I hope this helps, because when I was following the official docs I ran into a lot of stupid issues which took longer than they should have to iron out. If you have additional questions feel free to email me at [email protected] Cheers!!!