Change the disk type


This document discusses how to perform certain tasks on a disk. To perform any of the following tasks, you must create a new disk. You can't make the following changes to a disk.

  • Change a disk's type, for example, change a Hyperdisk Throughput volume to a Hyperdisk Balanced volume.
  • Change the disk's encryption type, for example, modify a disk's encryption from using Google-generated keys to customer-managed encryption keys (CMEK).
  • Move a disk into or out of a Hyperdisk Storage Pool.

Follow these steps to perform any of the previously mentioned tasks:

  1. Create a snapshot of the existing disk.
  2. Create a new disk of the correct type or placement, using the snapshot as the data source for the disk.
  3. After verifying the new disk, you can delete the original disk.

Before you begin

  • If you want to place the new Hyperdisk volumes in a storage pool, review the documentation for storage pools, especially:

  • If you haven't already, then 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 by selecting one of the following options:

    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

    For more information, see Authenticate for using REST in the Google Cloud authentication documentation.

Required roles and permissions

To get the permissions that you need to change the disk type, ask your administrator to grant you the following IAM roles on the project:

For more information about granting roles, see Manage access to projects, folders, and organizations.

These predefined roles contain the permissions required to change the disk type. To see the exact permissions that are required, expand the Required permissions section:

Required permissions

The following permissions are required to change the disk type:

  • To create a snapshot of the disk:
    • compute.snapshots.create on the project
    • compute.disks.createSnapshot on the disk
  • To create a new disk: compute.disks.create on the project
  • To create a disk in a storage pool:
    • compute.storagePools.use on the project
    • 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
  • To delete a disk: compute.disks.delete on the project

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

Change the type or placement of a disk

To migrate a Persistent Disk volume to Hyperdisk, or to recreate a disk in or out of a storage pool, you create a snapshot of the disk, and then use the snapshot when creating a new disk.

When creating a new Hyperdisk volume, you can create it as a standalone disk, or you can create the disk in a storage pool, if one exists.

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. Optional: To create a new Hyperdisks in a storage pool, you must create a storage pool, if one doesn't exist.
  4. Go to the Disks page.

    Go to Disks
  5. Click + Create Disk.
  6. Under Disk Type, select Hyperdisk Extreme, Hyperdisk Throughput, or Hyperdisk Balanced.

    Optional: To use storage pools, select either Hyperdisk Balanced or Hyperdisk Throughput.

  7. For Disk source type, select Snapshot, then select the name of the snapshot to restore.
  8. Specify the Size of the new disk, in GiB. This number must be equal to or larger than the original source disk for the snapshot.
  9. Optional: Change the defaults, if you are changing the disk type:

    • 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.
  10. Optional: To create the new disk in a storage pool:

    1. In the Storage pool section, select Enable storage pool.
    2. Choose the name of the storage pool to create the disk in.

      Only storage pools that exist in the selected zone appear in the list.

  11. Click Create to create the new disk.

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.

    gcloud compute disks create DISK_NAME \
     --zone=ZONE \
     --storage-pool=STORAGE_POOL_NAME \
     --size=SIZE \
     --source-snapshot=SNAPSHOT_NAME \
     --type=DISK_TYPE \
     --provisioned-iops=PROVISIONED_IOPS \
     --provisioned-throughput=PROVISIONED_THROUGHPUT
    

    Replace the following:

    • DISK_NAME: a unique name for the disk. You can provide a list of disk names specified by spaces to create multiple disks with the same attributes.
    • ZONE: the zone where you want to create the disk. If you want to create the disk in a storage pool, you must specify the zone where the storage pool is located. Specify this value in region-zone format, for example us-central1-a.
    • STORAGE_POOL_NAME: Optional: the name of the storage pool to create the disk in. If you don't include this flag, then a standalone Hyperdisk is created.
    • SIZE: Optional: the provisioned capacity of the new disk. The size must be greater or equal to the size of the source Persistent Disk. The value must be a whole number followed by a size unit of GB for gibibyte, or TB for tebibyte. If no size is specified, 100 GB is used as the default value.
    • SNAPSHOT_NAME: The name of the snapshot that you created from the original disk.
    • DISK_TYPE: the type of disk to create. If creating a disk in a storage pool, then this value must match the type of the Hyperdisk Storage Pool, either hyperdisk-balanced or hyperdisk-throughput.
    • PROVISIONED_IOPS: Optional: the IOPS to provision for the disk. You can use this flag only when creating a Hyperdisk Balanced or Hyperdisk Extreme disk.
    • PROVISIONED_THROUGHPUT: Optional: for Hyperdisk Balanced and Hyperdisk Throughput disks, the throughput in megabyte (MB) per second to provision for the disk. The value must be a positive integer.

Make the new disk accessible to your VM instance

After you create the disk, you must attach the disk to a VM before you can use it.

Because the new disk you created isn't a blank disk, after attaching the disk to a VM, you only need to mount the disk to make it available the operating system.

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

Remove the original disk

After verifying the new disk, you can:

What's next