Migrate a Persistent Disk volume to a Hyperdisk volume


You can't change a disk type from Persistent Disk to Google Cloud Hyperdisk. You can use snapshots to migrate existing disks to a Hyperdisk volume.

Before you begin

  • If you haven't already, set up authentication. Authentication is the process by which your identity is verified for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine as follows.

    Select the tab for how you plan to use the samples on this page:

    Console

    When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.

    gcloud

    1. Install the Google Cloud CLI, then initialize it by running the following command:

      gcloud init
    2. Set a default region and zone.

    REST

    To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.

      Install the Google Cloud CLI, then initialize it by running the following command:

      gcloud init

Required roles and permissions

To get the permissions that you need to migrate a Persistent Disk to a Hyperdisk, ask your administrator to grant you the following IAM roles on the project:

For more information about granting roles, see Manage access.

These predefined roles contain the permissions required to migrate a Persistent Disk to a Hyperdisk. To see the exact permissions that are required, expand the Required permissions section:

Required permissions

The following permissions are required to migrate a Persistent Disk to a Hyperdisk:

  • To create a snapshot of the Persistent Disk:
    • compute.snapshots.create on the project
    • compute.disks.createSnapshot on the disk
  • To create a Hyperdisk volume: compute.disks.create on the project
  • To attach a disk to a VM:
    • compute.instances.attachDisk on the VM
    • compute.disks.use on the volume that you want to attach to the VM

You might also be able to get these permissions with custom roles or other predefined roles.

Migrating existing disks to a Hyperdisk volume

To migrate an existing disk to Hyperdisk, you create a snapshot of the disk, and then restore the snapshot to a newly created Hyperdisk volume.

Console

  1. Prepare for creating a disk snapshot:

    Important: If you pause your applications before creating a snapshot, resume your workloads only after the snapshot resource reaches the UPLOADING status.

    For more information, see the table in Manually creating application consistent snapshots.

  2. Create a snapshot of your existing disk.

  3. Go to the Disks page.

    Go to Disks
  4. Click Create Disk.
  5. Under Disk Type, select Hyperdisk Extreme, Hyperdisk Throughput, or Hyperdisk Balanced.
  6. Under Source type, select Snapshot, then select the name of the snapshot to restore.
  7. Select the Size of the new disk, in GiB. This number must be equal to or larger than the original source disk for the snapshot.
  8. Change the defaults, depending on the disk type you are migrating to:

    • Hyperdisk Balanced: Change the Provisioned IOPS value and Provisioned Throughput value.
    • Hyperdisk Extreme: Change the Provisioned IOPS value.
    • Hyperdisk Throughput: Change the Provisioned Throughput value.
  9. Click Create to create the Hyperdisk volume.

gcloud

  1. Prepare for creating a disk snapshot:

    Important: If you pause your applications before creating a snapshot, resume your workloads only after the snapshot resource reaches the UPLOADING status.

    For more information, see the table in Manually creating application consistent snapshots.

  2. Create a snapshot of your existing disk.

  3. Use the disks create command to create a Hyperdisk volume from your snapshot.

    Hyperdisk Balanced

      gcloud compute disks create DISK_NAME \
        --size=DISK_SIZE \
        --source-snapshot=SNAPSHOT_NAME \
        --type=hyperdisk-balanced --provisioned-iops=IOPS \
        --provisioned-throughput=THROUGHPUT
      

    Hyperdisk Extreme

      gcloud compute disks create DISK_NAME \
        --size=DISK_SIZE \
        --source-snapshot=SNAPSHOT_NAME \
        --type=hyperdisk-extreme --provisioned-iops=IOPS
      

    Hyperdisk Throughput

      gcloud compute disks create DISK_NAME \
        --size=DISK_SIZE \
        --source-snapshot=SNAPSHOT_NAME \
        --type=hyperdisk-throughput \
        --provisioned-throughput=THROUGHPUT
      

    Replace the following:

    • DISK_NAME: The name of the volume that you are creating.
    • DISK_SIZE: Optional: The capacity, in GiB or TiB, of the volume that you are creating.
    • SNAPSHOT_NAME: The name of the snapshot that you are restoring.
    • IOPS: Optional: For Hyperdisk Balanced and Hyperdisk Extreme, specify the target IOPS performance, as an integer, for the volume you are creating.
    • THROUGHPUT: Optional: For Hyperdisk Balanced and Hyperdisk Throughput, specify the target disk throughput in MiBps as an integer.

You can then attach the disk to a VM.

Attach a disk to a VM

Use these steps to attach a Persistent Disk or Hyperdisk to a VM.

Console

  1. Go to the VM instances page.

    Go to VM instances

  2. Click the name of the VM where you want to restore your non-boot disk.

  3. At the top of the VM details page, click Edit.

  4. Under Additional disks, click Attach existing disk.

  5. Select the name of the new disk made from your snapshot.

  6. Click Done to attach the disk.

  7. At the bottom of the VM details page, click Save to apply your changes to the VM.

gcloud

Use the gcloud compute instances attach-disk command to attach an existing disk to a VM.

gcloud compute instances attach-disk VM_NAME \
    --disk DISK_NAME

Replace the following:

  • VM_NAME: the name of the VM where you are adding the new zonal disk
  • DISK_NAME: the name of the new disk that you are attaching to the VM.

REST

Construct a POST request to the compute.instances.attachDisk method, and include the URL to the zonal disk that you just created:

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/VM_NAME/attachDisk

{
 "source": "/compute/v1/projects/PROJECT_ID/zones/ZONE/disks/DISK_NAME"
}

Replace the following:

  • PROJECT_ID: your project ID
  • ZONE: the zone where your VM and new disk are located
  • VM_NAME: the name of the VM where you are adding the new disk
  • DISK_NAME: the name of the new disk

After you create a new, blank disk and attach it to a VM, you must format and mount the disk to make it available the operating system. If you create a disk from a snapshot, you don't need to format the disk, but you must mount the new disk before it can be used on your VM.

For information on how to format and mount the disk, refer to the following:

What's next