Restore a VM from a snapshot
This guide shows you how to restore a virtual machine (VM) from a snapshot by replacing its boot disk. The VM retains its name, IP addresses, security groups, and other configuration.
Prerequisites
Section titled “Prerequisites”- evroc CLI installed and configured
- An existing VM with a snapshot of its boot disk — see create and use snapshots
- The names of any data disks attached to the VM (if applicable)
Stop the VM
Section titled “Stop the VM”Before changing the boot disk, stop the VM:
evroc compute virtualmachine update myvm --running=falseSee Update a Virtual Machine in the API reference.
Create a new disk from the snapshot
Section titled “Create a new disk from the snapshot”Create a new disk from the snapshot you want to restore from:
evroc compute disk create restored-boot-disk \ --snapshot=my-snapshot \ --zone=aIf you don’t specify a size, the disk uses the snapshot’s restoreSize. If you do specify a size, it must be greater than or equal to the restoreSize.
See Create a Disk in the API reference.
Update the VM to use the restored disk
Section titled “Update the VM to use the restored disk”Update the VM to replace the boot disk with the newly created disk.
If your VM has only a boot disk (no additional data disks):
evroc compute virtualmachine update myvm \ --disk=restored-boot-disk \ --boot-from=trueIf your VM has data disks in addition to the boot disk, include them all when you update. The --disk and --boot-from flags are paired by position — specify the boot disk first, followed by each data disk with --boot-from=false:
evroc compute virtualmachine update myvm \ --disk=restored-boot-disk \ --boot-from=true \ --disk=my-data-disk \ --boot-from=falseImportant: Updating disks without the
--appendflag replaces the entire disk list. Omitting a data disk detaches it from the VM.
See Update a Virtual Machine in the API reference.
Start the VM
Section titled “Start the VM”Start the VM:
evroc compute virtualmachine update myvm --running=trueVerify the restoration
Section titled “Verify the restoration”Check that the VM is running:
evroc compute virtualmachine get myvmThe VM is ready when the Ready status is True and VirtualMachineStatus is Running.
The VM should retain its old private IP address.
Delete the old boot disk
Section titled “Delete the old boot disk”Once the VM is updated, the old boot disk is no longer attached. Delete it if you no longer need it:
evroc compute disk delete my-old-boot-diskWarning: Deleting a disk is permanent and can’t be undone. Make sure the new disk is working correctly before deleting the old one.
See Delete a Disk in the API reference.
Next steps
Section titled “Next steps”- Manage VM lifecycle — start, stop, update, and delete VMs
- Create and use snapshots — back up disks and provision new disks from snapshots
- Access a VM via SSH