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:
- Create a snapshot of the existing disk.
- Create a new disk of the correct type or within a storage pool (referred to as its placement), using the snapshot as the data source for the disk.
- 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:
- Types of Hyperdisk Storage Pools
- Machine type support and regional availability for Hyperdisk Throughput Storage Pools and Hyperdisk Balanced Storage Pools
- Limitations for creating disks in a Hyperdisk Storage Pool
-
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
-
Install the Google Cloud CLI, then initialize it by running the following command:
gcloud init
- 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:
-
Compute Instance Admin (v1) (
roles/compute.instanceAdmin.v1
) -
To connect to a VM that can run as a service account:
Service Account User (v1) (
roles/iam.serviceAccountUser
)
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
-
Prepare for creating a disk snapshot:
- Review Best practices for Compute Engine disk snapshots to prepare your disk for snapshotting.
- Read Create schedules for disk snapshots to learn about creating a snapshot schedule and attaching it to your disks. Backing up your disks regularly with scheduled snapshots can reduce the risk of unexpected data loss.
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.
-
Create a snapshot of your existing disk.
- Optional: To create a new Hyperdisks in a storage pool, you must create a storage pool, if one doesn't exist.
Go to the Disks page.
Go to Disks- Click + Create Disk.
Under Disk Type, select Hyperdisk Extreme, Hyperdisk Throughput, or Hyperdisk Balanced.
Optional: To use storage pools, select either Hyperdisk Balanced or Hyperdisk Throughput.
- For Disk source type, select Snapshot, then select the name of the snapshot to restore.
- 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.
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.
Optional: To create the new disk in a storage pool:
- In the Storage pool section, select Enable storage pool.
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.
- Click Create to create the new disk.
- After you create the disk, you can attach the disk to any running or stopped compute instance.
gcloud
-
Prepare for creating a disk snapshot:
- Review Best practices for Compute Engine disk snapshots to prepare your disk for snapshotting.
- Read Create schedules for disk snapshots to learn about creating a snapshot schedule and attaching it to your disks. Backing up your disks regularly with scheduled snapshots can reduce the risk of unexpected data loss.
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.
-
Create a snapshot of your existing disk.
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 parameter, 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
orhyperdisk-throughput
. - PROVISIONED_IOPS: Optional: the IOPS to provision for the disk. You can use this parameter only when you create 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.
After you create the disk, you can attach the disk to any running or stopped compute instance.
REST
Construct a
POST
request to create a zonal Hyperdisk by using thedisks.insert
method. Include thename
,sizeGb
,type
, andsourceSnapshot
properties.POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/disks { "name": "DISK_NAME", "sizeGb": "DISK_SIZE", "type": "https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/diskTypes/DISK_TYPE", "sourceSnapshot": "SNAPSHOT_NAME", "provisionedIops": "IOPS_LIMIT", "provisionedThroughput": "THROUGHPUT_LIMIT", "accessMode": "DISK_ACCESS_MODE" }
Replace the following:
PROJECT_ID
: your project IDZONE
: the zone where your compute instance and new disk are locatedDISK_NAME
: the name of the new diskDISK_SIZE
: Optional: The size of the new disk. The value must be a whole number followed by a size unit of GB for gibibytes or TB for tebibytes.DISK_TYPE
: the type of disk. To create a Hyperdisk volume, use one of the following values:hyperdisk-balanced
,hyperdisk-extreme
,hyperdisk-ml
, orhyperdisk-throughput
.IOPS_LIMIT
: Optional: For Hyperdisk Balanced and Hyperdisk Extreme, this is the number of I/O operations per second that the disk can handle.THROUGHPUT_LIMIT
: Optional: For Hyperdisk Balanced, Hyperdisk ML, or Hyperdisk Throughput volumes, this is an integer that represents the throughput, measured in MiB per second, that the disk can handle.DISK_ACCESS_MODE
: how compute instances can access the data on the disk. Supported values are:READ_WRITE_SINGLE
, for read-write access from one instance. This is the default value.READ_WRITE_MANY
, for read-write access from multiple instances.READ_ONLY_MANY
, for read-only access from multiple instances.
You can set the access mode for the following disk types:
- Hyperdisk Balanced
- Hyperdisk ML
- Hyperdisk Balanced High Availability (Preview)
Optional: Use the
compute.disks.get
method to see a description of your disk.After you create the disk, you can attach the disk to any running or stopped compute instance.
Change a zonal disk to a regional Hyperdisk Balanced High Availability disk
To change a zonal disk to a Hyperdisk Balanced High Availability disk, create a snapshot of the zonal disk and use the snapshot as the source when creating the regional disk.
Console
-
Prepare for creating a disk snapshot:
- Review Best practices for Compute Engine disk snapshots to prepare your disk for snapshotting.
- Read Create schedules for disk snapshots to learn about creating a snapshot schedule and attaching it to your disks. Backing up your disks regularly with scheduled snapshots can reduce the risk of unexpected data loss.
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.
-
Create a snapshot of your existing disk.
Go to the Disks page.
Go to Disks- Click + Create Disk.
- Specify a name for the disk.
- In the Location field, choose Regional.
Specify the primary zone for the disk in the Region and Zone fields.
The disk must be in the same region as the compute instance that you plan to attach it to.
- Specify the secondary zone in the Replica zone field.
- For Disk source type, select Snapshot, then select the name of the snapshot to restore.
Under Disk Type, select Hyperdisk Balanced High Availability.
If you don't see the Hyperdisk Balanced High Availability disk type in the list, you might have to choose a region that offers Hyperdisk Balanced High Availability disks.
- 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.
Optional: Change the default Provisioned IOPS and Provisioned throughput values for the new disk:
- Click Create to create the new disk.
- After you create the disk, you can attach the disk to any running or stopped compute instance.
gcloud
-
Prepare for creating a disk snapshot:
- Review Best practices for Compute Engine disk snapshots to prepare your disk for snapshotting.
- Read Create schedules for disk snapshots to learn about creating a snapshot schedule and attaching it to your disks. Backing up your disks regularly with scheduled snapshots can reduce the risk of unexpected data loss.
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.
-
Create a snapshot of your existing disk.
Use the
disks create
command to create a Hyperdisk Balanced High Availability disk from your snapshot.gcloud compute disks create DISK_NAME \ --size=SIZE \ --type=hyperdisk-balanced-high-availability \ --source-snapshot=SNAPSHOT_NAME \ --provisioned-iops=PROVISIONED_IOPS \ --provisioned-throughput=PROVISIONED_THROUGHPUT \ --region=REGION \ --replica-zones=ZONE1,ZONE2
Replace the following:
DISK_NAME
: a unique name for the disk.SIZE
: Optional: the provisioned capacity of the new disk. The size must be greater or equal to the size of the source disk. The value must be a whole number followed by a size unit of GB for gibibyte, or TB for tebibyte.SNAPSHOT_NAME
: The name of the snapshot that you created from the original disk.PROVISIONED_IOPS
: Optional: the IOPS to provision for the disk.PROVISIONED_THROUGHPUT
: Optional: the throughput in megabyte (MB) per second to provision for the disk.REGION
: the region for the regional disk to reside in, for example:europe-west1
ZONE1
,ZONE2
: the zones within the region where the two disk replicas are located, for example:europe-west1-b,europe-west1-c
Terraform
To create a Hyperdisk Balanced High Availability volume, you can use the
google_compute_region_disk
resource, as shown in the following example, but change the disk
type from pd-ssd
to hyperdisk-balanced-high-availability
.
REST
To create a Hyperdisk Balanced High Availability volume, construct a POST
request to the
compute.regionDisks.insert
method.
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/disks { "name": "DISK_NAME", "sourceSnapshot": "SNAPSHOT_NAME", "region": "projects/PROJECT_ID/regions/REGION", "replicaZones": [ "projects/PROJECT_ID/zones/ZONE1", "projects/PROJECT_ID/zones/ZONE2" ], "sizeGb": "DISK_SIZE", "type": "projects/PROJECT_ID/regions/REGION/diskTypes/hyperdisk-balanced-high-availability" }
Replace the following:
PROJECT_ID
: your project IDREGION
: the region for the regional disk to reside in, for example:europe-west1
DISK_NAME
: the name of the new diskSNAPSHOT_NAME
: The name of the snapshot that you created from the original disk.ZONE1
,ZONE2
: the zones where replicas of the new disk should be located, for example:europe-west1-b,europe-west1-c
DISK_SIZE
: the size, in GiB, of the new disk
Make the new disk accessible to your VM instance
After you create the disk, you must attach the disk or attach the regional disk to your compute instance before you can use it.
Because the new disk you created isn't a blank disk, after attaching the disk to an instance, 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
- Learn more about Hyperdisk.
- Learn more about storage pools.
- Learn how to manage Hyperdisk volumes.
- Benchmark the performance of your new Hyperdisk.