问题
I created a snapshot of a VM instance via cloud console. I would like to know how I can restore an instance using a snapshot. The documentation for compute engine is not very helpful. The instance runs on Ubuntu. Thanks.
回答1:
To restore an instance from a snapshot without deleting/re-creating the instance:
Shut down the instance and detach the boot disk:
gcloud beta compute instances detach-disk INSTANCE_NAME --disk BOOT_DISK_NAME
Create a new disk from the snapshot:
gcloud compute disks create DISK_NAME --source-snapshot SNAPSHOT_NAME
Attach the disk created from step 2 as the boot disk:
gcloud beta compute instances attach-disk INSTANCE_NAME --disk DISK_NAME --boot
Restoring the instance without deleting/re-creating the instance means that after restore, the instance will keep its IP address and other properties like tags, labels, etc.
回答2:
Try using:
gcloud compute disks \
create <NEW_INSTANCE_NAME> \
--source-snapshot <SNAPSHOT_NAME> \
--type pd-ssd \
--zone <ZONE>
You could find useful instruction here.
回答3:
In Console, you can go to VM Instances from Compute Engine tab. There you click on '+Create Instance' and there in section of boot-disk, you can navigate to 'snapshots' tab and select the snapshot you took.
Like this from console, you can Restore your instance.
Let me know, if this doesn't work for you!
来源:https://stackoverflow.com/questions/42476941/how-to-restore-instance-using-snapshot-in-google-compute-engine