Restoring virtual machines from backups
During the restore process, a new virtual machine is deployed and the existing VM is not overwritten. You can restore a VM from a backup of a boot volume only.
Prerequisites
- A volume backup is created automatically, as described in Creating backup plans, or manually, as described in Creating and deleting backups manually.
To restore a virtual machine
Admin panel
- On the Compute > Backup > Recovery points tab, click the recovery point from which you want to restore a VM.
- On the right pane, click Restore virtual machine.
-
In the Restore virtual machine window, the boot volume will be defined automatically and will be restored from the selected recovery point. Specify all other VM parameters, as described in Creating virtual machines.
- Click Deploy.
The new virtual machine will appear on the Compute > Virtual machines > Virtual machines screen.
Command-line interface
Use the following command:
vinfra service compute server create [--description <description>] [--metadata <metadata>] [--user-data <user-data>] [--key-name <key-name>] [--config-drive] [--count <count>] [--ha-enabled {true,false}] [--placements <placements>] [--allow-live-resize] [--uefi] --network id|<id=id[,key=value,…]> --volume <source=source [,key=value,…]> --flavor <flavor> <server-name>
--description <description>
-
Virtual machine description
A description should not contain any personally identifiable information or sensitive business data.
--metadata <metadata>
- Virtual machine metadata
--user-data <user-data>
- User data file
--key-name <key-name>
- Key pair to inject
--config-drive
- Use an ephemeral drive
--count <count>
- If count is specified and greater than 1, the
name
argument is treated as a naming pattern. --ha-enabled {true,false}
- Enable or disable HA for the virtual machine.
--placements <placements>
- Names or IDs of placements to add the virtual machine to.
--allow-live-resize
- Allow online resize for the virtual machine.
--uefi
- Allow UEFI boot for the virtual machine. This option can be used for VMs created from ISO images.
--network id|<id=id[,key=value,…]>
-
Create a virtual machine with a specified network. Specify this option multiple times to create multiple networks.
id
: attach network interface to a specified network (ID or name)- comma-separated
key=value
pairs with keys (optional):mac
: MAC address for network interfacefixed-ip
: fixed IP address orNone
to automatically allocate an IP address. This option can be used multiple times.spoofing-protection-enable
: enable spoofing protection for network interfacespoofing-protection-disable
: disable spoofing protection for network interfacesecurity-group
: security group ID or name. This option can be used multiple times.no-security-group
: do not use a security group
--volume <source=backup,id=<id>[,storage-policy=<storage-policy>]>
-
Restore a virtual machine from a backup. Specify this option multiple times to create multiple volumes.
source
: thebackup
source type- comma-separated
key=value
pairs with keys:id
: backup IDstorage-policy
: block device storage policy (optional)
--flavor <flavor>
- Flavor ID or name
<server-name>
- A new name for the virtual machine
For example, to restore the virtual machine myvm
from the backup with the ID c04ac70b-a436-4271-be1e-b7a93189b44f
and the flavor tiny
, connect it to the virtual network private
with the fixed IP address 192.168.128.200, run:
# vinfra service compute server create myvm --network id=private,fixed-ip=192.168.128.200 \ --volume source=backup,id=c04ac70b-a436-4271-be1e-b7a93189b44f,size=1 --flavor tiny