How can I switch to a new backup server and keep existing backups and templates?
OnApp 5.x and earlier
There are two possible ways of switching to a new backup server and keeping existing backups and templates.
- Firstly, add the new backup server according to the instructions at https://docs.onapp.com.
- Go to Control Panel > Settings > Backup Servers and disable the old backup server so that new backups are not created on it.
- Quick manual backup data migration should be performed by using the rsync utility, which offers the ability to preserve hard links by enabling the -H option. This option should be enabled if you are copying incremental backups.
- Before starting the data transfer, go to Control Panel > Settings > Configuration > Backups/Templates and set the Backup Processes Total number allowed parameter to 0 to prevent new backup task processing during the data transfer.
- Wait for all running backup tasks to finish or cancel them.
- Check if the direct SSH login from the old backup server to the new one is possible. SSH Key-Based authentication is recommended. Depending on the link speed, the transfer can take about 40 hours for 1 TB of Data. Therefore, it is recommended to start the copying procedure in the screen session.
- Next, login as root to the old backup server and start backups data transfer by issuing the following command:
rsync -a -z -H -v --numeric-ids /backupstorage/* NewBackupServerIP:/backupstorage
- As soon as all the data has been copied, update the backup server ID for the templates and backups, using MySQL:
select id, label from backup_servers;
The command above displays the IDs of the existing backup servers.
- Next, change all backups and templates assignments to the new backup server by issuing the following command:
update templates set backup_server_id=2 where backup_server_id=1;
update backups set backup_server_id=2 where backup_server_id=1;
The IDs above are only the examples, so please fill in the correct backup_server_id in your command line.
- To start the new backup tasks processing, set the Backup Processes Total number allowed parameter to value greater than 0. Check whether the new backup tasks have started on the new BS server.
Alternatively, you can try automatic backup migration. If you are using this method, there is no need to stop backup tasks processing and remove/update backup entries in OnApp DB:
- Copy template files to the new BS by issuing the following command:
rsync -a -v /backupstorage/templates NewBackupServerIP:/backupstorage
rsync -z -a -v /backupstorage/backups/templates NewBackupServerIP:/backupstorage/backups
- To avoid using the old BS, disable it in OnApp Settings and set the capacity to 1GB for the old Backup Server to emulate the "no free space left" issue for new backups. All newly created backups should migrate to the new BS. The old backups will be removed automatically, after the new ones are created. After the period of backup rotation, the old BS can be removed from the cloud.