Modify the settings for a Google Cloud Hyperdisk volume


You can modify the properties of your Google Cloud Hyperdisk volumes to meet your workload's needs. For example, you can reduce or increase the provisioned IOPS or throughput to reduce costs or increase performance, respectively. You can specify how VMs access the data on a Hyperdisk ML volume by setting the volume's access mode.

This page discusses how to modify the capacity, performance, and other settings of Hyperdisk volumes.

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

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

Required roles and permissions

To get the permission that you need to modify a Hyperdisk, ask your administrator to grant you the following IAM roles on the project:

For more information about granting roles, see Manage access.

This predefined role contains the compute.disks.update permission, which is required to modify a Hyperdisk.

You might also be able to get this permission with custom roles or other predefined roles.

Overview of modifying Hyperdisk

You can dynamically change the access mode, size, and performance characteristics of Hyperdisk volumes.

Supported size and performance changes for Hyperdisk volumes

The following table summarizes the supported capacity and performance changes for each Hyperdisk type.

Hyperdisk type Customizable throughput Customizable IOPS Shareable between VMs
Hyperdisk Balanced Yes Yes No
Hyperdisk Extreme No Yes No
Hyperdisk ML Yes No Yes
Hyperdisk Throughput Yes No No

The values you use when creating or modifying a Hyperdisk volume must fall within the range of maximum and minimum values described in Hyperdisk limits per disk.

If you're modifying the size of a Hyperdisk volume that's attached to a VM, then the new values can't exceed the Hyperdisk limits per VM.

The provisioned IOPS and throughput for a Hyperdisk volume must follow the rules outlined in About IOPS and throughput provisioning for Hyperdisk.

Capacity changes

You can resize a Hyperdisk volume only to increase its size. You can't reduce the capacity of a Hyperdisk volume. If you want to decrease the size of a Hyperdisk volume, you must create a smaller volume, migrate data from the original volume to the smaller volume, and delete the original volume.

You can resize a Hyperdisk volume even if it is attached to a running VM.

You can resize a Hyperdisk Throughput volume once every 6 hours. For all other Hyperdisk types, you can change the provisioned capacity once every 4 hours.

For the best results, complete the following steps when changing the capacity of a Hyperdisk volume:

  1. Increase the size of the volume.
  2. Backup the disk.
  3. Resize the disk partitions.

Performance changes

After you change the provisioned IOPS or throughput, it can take up to 15 minutes for the changes to take effect. Changes to Hyperdisk ML volumes can take up to 20 minutes to take effect.

You can dynamically change the provisioned IOPS or throughput once every 4 hours for all Hyperdisk types except Hyperdisk ML. You can change the provisioned throughput of a Hyperdisk ML volume once every 6 hours.

Changing the provisioned IOPS or throughput for a Hyperdisk volume does not delete or modify disk data.

If you attempt to modify a Hyperdisk volume more than once within the specified limits, you will receive an error message like Cannot update provisioned throughput due to being rate limited.

Access mode

To share a Hyperdisk ML volume between multiple VMs, you must set the volume's access mode to read-only. After you set the access mode to read-only, you can't re-enable write access. Changing the access mode to read-only is only supported for Hyperdisk ML volumes.

To set a disk's access mode, see Set the access mode.

Restrictions

  • For Hyperdisk ML volumes, you can only set the access mode to read-only. You can't set the access mode back to read-write after you set it to read-only.
  • You can't set the access mode for Hyperdisk Throughput, Hyperdisk Balanced, and Hyperdisk Extreme volumes.
  • To set a disk's access mode, it must be detached from all VMs.

Set the access mode of a Hyperdisk ML volume to read-only

You can set the access mode for a Hyperdisk ML volume from read-write mode to read-only mode. After you set the access mode to read-only, you can't re-enable read-write access.

You can set the access mode with the Google Cloud console, the Google Cloud CLI, or REST.

Console

  1. In the Google Cloud console, go to the Disks page.

    Go to Disks

  2. In the list of disks in your project, click the name of the Hyperdisk volume for which you want to change the capacity or provisioned performance.

  3. On the disk details page, click Edit.

  4. In the Access mode field, select the access mode you want. To enable read-only mode, select Multiple VMs read only.

  5. To apply your changes, click Save.

gcloud

Run the disks update command and specify the access mode with the --access-mode flag.

gcloud compute disks update DISK_NAME  \
   --access-mode=DISK_ACCESS_MODE

Replace the following:

  • DISK_NAME: the name of the Hyperdisk volume that you are modifying.
  • DISK_ACCESS_MODE: how VMs can access the data on the disk. Supported values are:
    • READ-ONLY-MANY, for read-only access from multiple VMs.
    • READ-WRITE-SINGLE, for read-write access from 1 VM.

REST

Construct a POST request to the compute.disks.update method. In the request body, set the access mode with the "accessMode" parameter.

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/disks/DISK_NAME/update
{
   "accessMode": "DISK_ACCESS_MODE"
}

Replace the following:

  • PROJECT_ID: your project ID.
  • ZONE: the zone where your Hyperdisk volume is located.
  • DISK_NAME: the name of the Hyperdisk volume to modify.
  • DISK_ACCESS_MODE: how VMs can access the data on the disk. Supported values are:
    • READ_ONLY_MANY, for read-only access from multiple VMs.
    • READ_WRITE_SINGLE, for read-write access from 1 VM.

Change the size or provisioned performance of a Hyperdisk volume

You can increase the volume size and change the provisioned IOPS or throughput for a Hyperdisk volume with the following time limits:

  • Increase the disk size:

    • For Hyperdisk Throughput: Once every 6 hours
    • For all other Hyperdisk types: once every 4 hours
  • Modify the provisioned IOPS or throughput:

    • For Hyperdisk ML: Once every 6 hours
    • For all other Hyperdisk types: once every 4 hours

If you attempt to change the disk before the four hours have expired, you will receive an error message like Cannot update provisioned throughput due to being rate limited.

You can change the provisioned size and performance for a Hyperdisk volume with the Google Cloud console, gcloud CLI, or REST.

Console

  1. In the Google Cloud console, go to the Disks page.

    Go to Disks

  2. In the list of disks in your project, click the name of the Hyperdisk volume for which you want to change the capacity or provisioned performance.

  3. On the disk details page, click Edit.

    1. In the Size field, enter the new size for your disk. The disk size must be in the range of supported values.
    2. For Hyperdisk Extreme and Hyperdisk Balanced: In the Provisioned IOPS field, enter the new IOPS value for your volume.
    3. For Hyperdisk Throughput, Hyperdisk ML, and Hyperdisk Balanced: In the Provisioned throughput field, enter the new throughput value for your volume.
  4. Click Save to apply your changes to the disk.

gcloud

Use the disks update command and specify the --size, --provisioned-iops, or --provisioned-throughput flags.

gcloud compute disks update DISK_NAME  \
    --size=DISK_SIZE  \
    --provisioned-iops=IOPS_LIMIT  \
    --provisioned-throughput=THROUGHPUT_LIMIT

Replace the following:

  • DISK_NAME: the name of the Hyperdisk volume that you are modifying.
  • DISK_SIZE: Optional: The new size of the disk. The value must be a whole number followed by a size unit of GB for gibibyte, or TB for tebibyte. The disk size must be in the range of supported values.
  • IOPS_LIMIT: Optional: The IOPS configuration for Hyperdisk Extreme and Hyperdisk Balanced volumes. The value must be in the range of supported values.
  • THROUGHPUT_LIMIT: Optional: The throughput configuration for the Hyperdisk Throughput, Hyperdisk ML, or Hyperdisk Balanced volume, specified as an integer that represents the throughput measured in MiB per second. The value must be in the range of supported values.

REST

Construct a POST request to the compute.disks.update method. In the request body, specify the sizeGb, provisionedIops or provisionedThroughput parameters.

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/disks/DISK_NAME/update
{
   "sizeGb": "DISK_SIZE,
   "provisionedIops": "IOPS_LIMIT",
   "provisionedThroughput": "THROUGHPUT_LIMIT"
}

Replace the following:

  • PROJECT_ID: your project ID.
  • ZONE: the zone where your Hyperdisk volume is located.
  • DISK_NAME: the name of the Hyperdisk volume to modify.
  • DISK_SIZE: Optional: The new size of the disk. The value must be a whole number followed by a size unit of GB for gibibyte, or TB for tebibyte. The disk size must be in the range of supported values.
  • IOPS_LIMIT: Optional: The IOPS configuration for the Hyperdisk Extreme or Hyperdisk Balanced volume. The value must be in the range of supported values.
  • THROUGHPUT_LIMIT: Optional: The throughput configuration for the Hyperdisk Balanced, Hyperdisk ML, or Hyperdisk Throughput volume, specified as an integer that represents the throughput measured in MiB per second. The value must be in the range of supported values.

Back up the Hyperdisk volume

Resizing a disk doesn't delete or modify disk data, but as a best practice, always backup your disk by creating a snapshot before you make any changes to the file system or partitions.

Resize the file system and partitions

After increasing the size of your Hyperdisk volume, you might need to resize its file system and partitions. For more information, see Resize the file system and partitions in the Persistent Disk documentation.

What's next