Restore a virtual machine (VM) disk from an image disk snapshot that was created through GDC backup and restore procedures.
To get the permissions that you need to restore a snapshot, ask your Project IAM Admin to grant you the following roles:
- Project VM Admin (
project-vm-admin
) - Backup Creator (
backup-creator
) - Project Viewer (
project-viewer
)
Restore a snapshot
Create a new VM from a disk snapshot by using the GDC console or the application programming interface (API).
Console
- Sign in to the GDC console.
- In the navigation menu, click Virtual Machines > Snapshots.
- Select a project.
- In the list of snapshots, find the snapshot to restore and click Restore.
- In the New disk name field, enter the name of the disk to restore the backup in.
- Enter a Restore name for the restore.
- Click Restore.
API
Define a VirtualMachineRestoreRequest
custom resource to initiate the
restore process:
apiVersion: virtualmachine.gdc.goog/v1
kind: VirtualMachineRestoreRequest
metadata:
name: RESTORE_REQUEST_NAME
namespace: PROJECT_NAME
spec:
virtualMachineBackup: VM_BACKUP_NAME
restoreName: RESTORE_NAME
restoredResourceName: RESTORED_RESOURCE_NAME
restoredResourceDescription: RESTORED_RESOURCE_DESCRIPTION
Replace the following:
VM_BACKUP_NAME
: name of theVirtualMachineBackup
to restore from.PROJECT_NAME
: the name of the GDC project.RESTORE_REQUEST_NAME
: name to give the restore request that is being initiated.RESTORE_NAME
: name to give the restore that is being initiated.RESTORED_RESOURCE_NAME
: name to give the restored snapshot.RESTORED_RESOURCE_DESCRIPTION
: description of why the restore is performed.
The result of the restore creates a new disk with the same configuration and disk state as the snapshot, completing the data backup and recovery process.
View a restore
View a restore using the GDC console or kubectl
command-line interface
(CLI).
Console
- Sign in to the GDC console.
- In the navigation menu, click Virtual Machines > Snapshots.
- Select a project.
- Click the Restores tab.
- In the list of restores, click the restore name to view its details.
kubectl
View a restore by listing the restores and viewing their details:
List the existing snapshots:
kubectl get virtualmachinerestores.virtualmachine.gdc.goog -n PROJECT_NAME
Replace
PROJECT_NAME
with the name of the project.In the list, find the restore that you want to view.
View the restore details:
kubectl describe virtualmachinerestore.virtualmachine.gdc.goog RESTORE_NAME -n PROJECT_NAME
Replace the following:
RESTORE_NAME
: the name of the restore.PROJECT_NAME
: the name of the project.
Delete a restore
Delete a restore by using the GDC console or kubectl
command-line interface
(CLI).
Console
- Sign in to the GDC console.
- In the navigation menu, click Backup for Virtual Machines.
- Select a project.
- Click the Restores tab.
- In the list of restores, find the restore to delete and click Delete Restore.
- In the Restore name field, enter the name of the restore to delete.
- Click Delete Restore.
kubectl
View a restore by listing the restores and viewing their details:
List the existing restores:
kubectl get virtualmachinerestores.virtualmachine.gdc.goog -n PROJECT_NAME
Replace
PROJECT_NAME
with the name of the project.In the list, find the restore that you want to delete.
Delete the restore:
kubectl delete virtualmachinerestores.virtualmachine.gdc.goog RESTORE_NAME -n PROJECT_NAME
Replace the following:
RESTORE_NAME
: the name of the restore.PROJECT_NAME
: the name of the project.