Restoring a VM from a backup of another VM
If a folder contains multiple VMs connected to Cloud Backup, you can restore a VM from a backup of another VM. This is required, for example, if the source VM is down.
Note
The target VM's operating system must match that of the source VM the backup was created from. The boot disk size of the target VM must be at least equal to that of the source VM. The target VM status must be Running
.
To restore a VM from a backup of another VM:
-
In the management console
, select the folder where the backup is located. -
Select Cloud Backup.
-
Go to
Backups. -
Next to the backup to restore the VM from, click
and select Restore VM. -
In the Target VM field, select the VM to restore the backup to or create a new VM with a connection to Cloud Backup. To create a new VM for recovery, click Create:
- On the page that opens, set the parameters of the new VM and click Create VM.
Wait until the VM connects to Cloud Backup. - Return to the VM recovery page.
- To update the list of VMs, click
. - Select the previously created VM.
- On the page that opens, set the parameters of the new VM and click Create VM.
-
To avoid a conflict between the restored and source VMs, select Delete outdated VM.
If this option is not selected, after the recovery the source VM you created the backup from will become outdated. To continue creating backups of this VM, refresh its connection to Cloud Backup.
-
Click Recover.
-
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
-
The folder specified in the CLI profile is used by default. You can specify a different folder using the
--folder-name
or--folder-id
parameter. -
View a description of the CLI command to restore a VM from a backup:
yc backup backups recover --help
-
Get the IDs of the target VM to restore the backup to and the source VM whose backup you want to use:
yc compute instance list
Result:
+----------------------+---------+---------------+---------+--------------+-------------+ | ID | NAME | ZONE ID | STATUS | EXTERNAL IP | INTERNAL IP | +----------------------+---------+---------------+---------+--------------+-------------+ | epdhmn8mdqmt******** | my-vm-1 | ru-central1-b | RUNNING | 51.250.**.** | 192.168.*.* | | epdis3p9paoe******** | my-vm-2 | ru-central1-b | RUNNING | 84.201.**.** | 192.168.*.* | +----------------------+---------+---------------+---------+--------------+-------------+
-
Get the ID of the source VM's backup:
yc backup backups list \ --instance-id <source_VM_ID>
Where
--instance-id
is the ID of the source VM whose backup you want to use.Result:
+--------------------------------------+--------------------------------------+----------------------+--------------------------------------+----------------------+------+------------------+--------+---------------------+ | ID | ARCHIVE ID | COMPUTE INSTANCE ID | RESOURCE ID | POLICY ID | TYPE | DISKS | SIZE | CREATED AT | +--------------------------------------+--------------------------------------+----------------------+--------------------------------------+----------------------+------+------------------+--------+---------------------+ | 9cba836d-869c-41d2-8f25-0dac******** | 8a5b6d59-f7ce-0cb9-6cbf-151c******** | epdhmn8mdqmt******** | 7AF6A532-D1DC-4945-9D0C-E101******** | cdgiqu6ouch3******** | FULL | Disk 1 (13.0 GB) | 1.4 GB | 2023-07-11 05:10:09 | | 05e964ca-6a8f-481a-b83e-44c5******** | 8a5b6d59-f7ce-0cb9-6cbf-151c******** | epdhmn8mdqmt******** | 7AF6A532-D1DC-4945-9D0C-E101******** | cdgiqu6ouch3******** | FULL | Disk 1 (15.0 GB) | 1.4 GB | 2023-07-11 05:00:07 | +--------------------------------------+--------------------------------------+----------------------+--------------------------------------+----------------------+------+------------------+--------+---------------------+
-
Restore the VM from the backup:
yc backup backups recover \ --source-backup-id <backup_ID> \ --destination-instance-id <target_VM_ID>
Where:
--source-backup-id
: Backup ID.--destination-instance-id
: ID of the target VM to restore the backup to.
Result:
...1s...6s...11s ... 9m4s...9m9s...done (9m9s)
For more information about the command, see the CLI reference.
After the recovery the source VM you created the backup from will become outdated. To avoid conflicts between the two VMs when making backups, delete the outdated VM or refresh its connection to Cloud Backup:
To restore a VM from a backup of another VM, use the startRecovery REST API method for the Backup resource or the BackupService/StartRecovery gRPC API call.