Restoring a VM from a backup
Note
You cannot restore a VM backup to a BareMetal server, nor restore a BareMetal server backup to a VM.
BareMetal is at the Preview stage.
To avoid errors when recovering from a backup, start by comparing the parameters of the disks and partitions of the backup against those of the VM or Yandex BareMetal server. For more information, see Viewing the parameters of disks and partitions in a backup.
To learn how to restore a BareMetal server from a backup, see Restoring a server from backup.
Tip
- In the management console
, select the folder where the backup is located. - Select Cloud Backup.
- Go to the
Backups tab. - Next to the backup to restore the VM from, click
and select Restore VM. - In the Target VM field, select the VM you created the backup from. In the list, this VM is marked as
(current)
. - 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.
-
See the description of the CLI command to restore a VM from a backup:
yc backup backups recover --help
-
Get the ID of the appropriate backup:
yc backup backups list
Result:
+--------------------------------------+--------------------------------------+----------------------+--------------------------------------+----------------------+------+------------------+--------+---------------------+ | ID | ARCHIVE ID | COMPUTE INSTANCE ID | RESOURCE ID | POLICY ID | TYPE | DISKS | SIZE | CREATED AT | +--------------------------------------+--------------------------------------+----------------------+--------------------------------------+----------------------+------+------------------+--------+---------------------+ | ab55286e-795f-44dc-90af-b718******** | ef3e8144-fb65-6a59-5ec1-3162******** | jklp0o9i8012******** | 2465BE59-5687-4539-9589-DF7E******** | abc7n3wln123******** | FULL | Disk 1 (15.0 GB) | 1.5 GB | 2023-07-07 16:00:15 | | cd50e147-7dfa-449f-816b-67f8******** | gh06b195-c095-1234-7809-0700******** | mnoa5s6d8345******** | 135C519D-B5A3-4781-8DFA-40B3******** | deflqbiwc456******** | FULL | Disk 1 (15.0 GB) | 1.6 GB | 2023-07-03 10:00:10 | +--------------------------------------+--------------------------------------+----------------------+--------------------------------------+----------------------+------+------------------+--------+---------------------+
-
Get the ID of the VM to restore:
yc compute instance list
Result:
+----------------------+---------+---------------+---------+--------------+-------------+ | ID | NAME | ZONE ID | STATUS | EXTERNAL IP | INTERNAL IP | +----------------------+---------+---------------+---------+--------------+-------------+ | jklp0o9i8012******** | my-vm-1 | ru-central1-b | RUNNING | 51.250.**.** | 192.168.*.* | | mnoa5s6d8345******** | my-vm-2 | ru-central1-b | RUNNING | 84.201.**.** | 192.168.*.* | +----------------------+---------+---------------+---------+--------------+-------------+
-
Restore the VM from the backup:
yc backup backups recover \ --source-backup-id <backup_ID> \ --destination-instance-id <VM_ID>
Where:
--source-backup-id
: ID of the backup to restore the VM from.--destination-instance-id
: ID of the VM to restore the backup to.
Result:
...1s...6s...11s ... 9m4s...9m9s...done (9m9s)
For more information about the command, see the CLI reference.
To restore a VM from a backup, use the startRecovery REST API method for the Backup resource or the BackupService/StartRecovery gRPC API call.