Back up disks

This page describes how to back up your VM disks in the form of snapshots in Google Distributed Cloud (GDC) air-gapped.

Back up your disks regularly to ensure that your snapshot data is relatively current, and to reduce the risk of unexpected data loss when carrying out data backup and recovery operations. Create snapshots to periodically back up data from your persistent disks.

Before you begin

To back up disks, you must have the following:

  • A single VM backup repository for disk snapshots.
  • A VM backup plan.
  • The necessary identity and access roles:

    • Project VirtualMachine Admin: manages VMs in the project namespace. Ask your Project IAM Admin to grant you the Project VirtualMachine Admin (project-vm-admin) role.
    • Backup Creator: creates manual backups and restores. Ask your Project IAM Admin to grant you the Backup Creator (backup-creator) role.
    • Project Viewer: has read-only access to all resources within project namespaces. Ask your Project IAM Admin to grant you the Project Viewer (project-viewer) role.

Create a snapshot

Create a snapshot using either the GDC console or the API.

Console

  1. Sign in to the GDC console.
  2. In the navigation menu, click Virtual Machines > Snapshots.
  3. Select a project.
  4. Click Create snapshot.
  5. In the Source disk field, select the disk that you want to create the snapshot from.
  6. Enter the Snapshot name.
  7. Click Create.

API

Issue a VirtualMachineBackupRequest to initiate a snapshot:

apiVersion: virtualmachine.gdc.goog/v1
kind: VirtualMachineBackupRequest
metadata:
  name: BACKUP_REQUEST_NAME
  namespace: PROJECT_NAME
spec:
  virtualMachineBackupPlanTemplate: VM_BACKUP_PLAN
  virtualMachineDisk: VM_DISK
  virtualMachineBackupName: VM_BACKUP_NAME

Replace the following:

  • BACKUP_REQUEST_NAME: the name to give the backup request that is being initiated.
  • PROJECT_NAME: the name of the GDC project.
  • VM_BACKUP_PLAN: the name of the VirtualMachineBackupPlanTemplate to use for configuration of the snapshot.
  • VM_DISK: the name of the disk to snapshot.
  • VM_BACKUP_NAME: the name of the snapshot to create.

View snapshots

View snapshots and their details by using the Google Cloud console or kubectl.

Console

  1. Sign in to the GDC console.
  2. In the navigation menu, click Virtual Machines > Snapshots.
  3. Select a project.
  4. In the list of snapshots, click the snapshot name to view its details.

kubectl

View a snapshot by listing the snapshots and viewing their details.

  1. List the existing snapshots:

    kubectl get virtualmachinebackups.virtualmachine.gdc.goog -n PROJECT_NAME
    

    Replace PROJECT_NAME with the name of the project.

  2. In the list, find the snapshot that you want to view.

  3. View the snapshot details:

    kubectl describe virtualmachinebackup.virtualmachine.gdc.goog VM_BACKUP_NAME -n PROJECT_NAME
    

    Replace the following:

    • VM_BACKUP_NAME: the name of the snapshot.
    • PROJECT_NAME: the name of the project.

Delete a snapshot

Delete snapshots by using the Google Cloud console or kubectl. Disks created from snapshots are not affected when the underlying snapshot is deleted.

Console

  1. Sign in to the GDC console.
  2. In the navigation menu, click Virtual Machines > Snapshots.
  3. Select a project.
  4. In the list of snapshots, find the snapshot to delete and click Delete.
  5. Click Confirm.

kubectl

Delete a snapshot using kubectl.

  1. List the existing snapshots:

    kubectl get virtualmachinebackups.virtualmachine.gdc.goog -n PROJECT_NAME
    

    Replace PROJECT_NAME with the name of the project.

  2. In the list, find the snapshot that you want to delete.

  3. Issue a VirtualMachineDeleteBackupRequest to delete the snapshot:

    apiVersion: virtualmachine.gdc.goog/v1
    kind: VirtualMachineDeleteBackupRequest
    metadata:
      name: DELETE_BACKUP_REQUEST_NAME
      namespace: PROJECT_NAME
    spec:
      virtualMachineBackupRef:
        name: VM_BACKUP_NAME
    

    Replace the following:

    • DELETE_BACKUP_REQUEST_NAME: name to give the delete backup request that is being initiated.
    • VM_BACKUP_NAME: the name of the snapshot to delete.
    • PROJECT_NAME: the name of the project.

What's next