Stay organized with collections Save and categorize content based on your preferences.
This document provides information about how disk clones work and how to create a disk clone. Disk cloning lets you make instantly usable duplicates of existing disks. Create a disk clone in scenarios where you want to create an identical copy of an existing disk that you can instantly attach to a VM, such as the following:
To protect against disaster recovery, back up your disk with standard snapshots instead of using disk clones. To capture disk contents at regular intervals without creating new disks, use instant snapshots because they're more storage-efficient than clones. For additional disk protection options, see Data protection options.
Before you beginSelect the tab for how you plan to use the samples on this page:
ConsoleWhen you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloudInstall the Google Cloud CLI. After installation, initialize the Google Cloud CLI by running the following command:
gcloud init
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update
.To use the Terraform samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
Install the Google Cloud CLI.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update
.
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
For more information, see Set up authentication for a local development environment.
GoTo use the Go samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
Install the Google Cloud CLI.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update
.
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
For more information, see Set up authentication for a local development environment.
JavaTo use the Java samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
Install the Google Cloud CLI.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update
.
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
For more information, see Set up authentication for a local development environment.
PythonTo use the Python samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
Install the Google Cloud CLI.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update
.
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
For more information, see Set up authentication for a local development environment.
RESTTo 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.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
For more information, see Authenticate for using REST in the Google Cloud authentication documentation.
When you clone a disk, you create a new disk that contains all the data on the source disk. You can create a disk clone even if the existing disk is attached to a VM instance.
The disk type of the clone must be the same as that of the source disk. However, you can modify properties on the clone, such as the disk size. You can also delete the source disk without any risk of deleting the clone.
Supported disk typesYou can create disk clones only for the following disk types:
Depending on the type of disk, disk clones have the following restrictions:
General restrictionsThe following restrictions apply to clones of all disk types:
internalError
. However, if you create a disk clone and delete it later, then the deleted disk clone is not included in this limit.Disk clones for Persistent Disk have the following restrictions:
You can't create a Hyperdisk Balanced High Availability disk by cloning a zonal disk. To create a Hyperdisk Balanced High Availability disk from an existing zonal disk, complete the steps in Change a zonal disk to a regional Hyperdisk Balanced High Availability disk.
You can't clone Hyperdisk ML volumes.
If you exceed the cloning frequency limits, the request fails with the following error:
RATE LIMIT: ERROR: (gcloud.compute.disks.create) Could not fetch resource: - Operation rate exceeded for resource RESOURCE. Too frequent operations from the source resource.Note: Error messages are subject to change, and Google recommends that you rely on error message codes instead of error message texts for building automation. Create disk clones
This section explains how you can duplicate an existing disk and create a disk clone.
For detailed steps, depending on the type of disk clone creation, see one of the following sections in this document:
To perform this task, you must have the following permissions:
compute.disks.create
on the projectcompute.disks.useReadOnly
on the source diskYou can create zonal disk clones of an existing disk in the same zone as the source disk by using the Google Cloud console, the Google Cloud CLI, or REST.
ConsoleIn the Google Cloud console, go to the Disks page.
In the list of disks, navigate to the disk that you want to clone.
In the Actions column, click the more_vert menu button and select Clone disk.
In the Clone disk panel that appears, do the following:
To clone a zonal source disk and create a new zonal disk, run the disks create
command and specify the --source-disk
flag:
gcloud compute disks create TARGET_DISK_NAME \ --description="cloned disk" \ --source-disk=projects/PROJECT_ID/zones/ZONE/disks/SOURCE_DISK_NAME
Replace the following:
TARGET_DISK_NAME
: the name for the new disk.PROJECT_ID
: the project ID where you want to clone the disk.ZONE
: the zone of the source and new disk.SOURCE_DISK_NAME
: the name of the source disk.To create a disk clone, use the google_compute_disk
resource.
To learn how to apply or remove a Terraform configuration, see Basic Terraform commands.
Go GoBefore trying this sample, follow the Go setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Go API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java JavaBefore trying this sample, follow the Java setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Java API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python PythonBefore trying this sample, follow the Python setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Python API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
RESTTo clone a zonal source disk and create a new zonal disk, make a POST
request to the compute.disks.insert
method. In the request body, specify the name
and sourceDisk
parameters. The disk clone inherits all omitted properties from the source disk.
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/disks { "name": "TARGET_DISK_NAME" "sourceDisk": "projects/PROJECT_ID/zones/ZONE/disks/SOURCE_DISK_NAME" }
Replace the following:
PROJECT_ID
: the project ID where you want to clone the disk.ZONE
: the zone of the source and new disk.TARGET_DISK_NAME
: the name for the new disk.SOURCE_DISK_NAME
: the name of the source diskYou can create a new regional Persistent Disk disk by cloning an existing zonal Persistent Disk volume. To migrate a zonal disk to a regional disk, Google recommends this option instead of creating a snapshot of the zonal disk and restoring the snapshot to a new regional disk.
ConsoleIn the Google Cloud console, go to the Disks page.
In the list of disks, navigate to the zonal Persistent Disk volume that you want to clone.
In the Actions column, click the more_vert menu button and select Clone disk.
In the Clone disk panel that appears, do the following:
To create a regional disk clone from a zonal disk, run the gcloud compute disks create
command and specify the --region
and --replica-zones
parameters.
gcloud compute disks create TARGET_DISK_NAME \ --description="zonal to regional cloned disk" \ --region=CLONED_REGION \ --source-disk=SOURCE_DISK_NAME \ --source-disk-zone=SOURCE_DISK_ZONE \ --replica-zones=SOURCE_DISK_ZONE,REPLICA_ZONE_2 \ --project=PROJECT_ID
Replace the following:
TARGET_DISK_NAME
: the name for the new regional disk clone.CLONED_REGION
: the region of the source and cloned disks.SOURCE_DISK_NAME
: the name of the zonal disk to clone.SOURCE_DISK_ZONE
: the zone for the source disk. This will also be the first replica zone for the regional disk clone.REPLICA_ZONE_2
: the second replica zone for the new regional disk clone.PROJECT_ID
: the project ID where you want to clone the disk.To create a regional disk clone from a zonal disk, you can optionally create a snapshot of the zonal disk and then clone the snapshot. To do this, use the following resources:
To learn how to apply or remove a Terraform configuration, see Basic Terraform commands.
Go GoBefore trying this sample, follow the Go setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Go API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java JavaBefore trying this sample, follow the Java setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Java API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python PythonBefore trying this sample, follow the Python setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Python API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
RESTTo create a regional disk clone from a zonal disk, make a POST
request to the compute.disks.insert
method and specify the sourceDisk
and replicaZone
parameters.
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/CLONED_REGION/disks { "name": "TARGET_DISK_NAME" "sourceDisk": "projects/PROJECT_ID/zones/SOURCE_DISK_ZONE/disks/SOURCE_DISK_NAME" "replicaZone": "SOURCE_DISK_ZONE,REPLICA_ZONE_2" }
Replace the following:
PROJECT_ID
: the project ID where you want to clone the disk.TARGET_DISK_NAME
: the name for the new regional disk clone.CLONED_REGION
: the region of the source and cloned disks.SOURCE_DISK_NAME
: the name of the zonal disk to clone.SOURCE_DISK_ZONE
: the zone for the source disk. This will also be the first replica zone for the regional disk clone.REPLICA_ZONE_2
: the second replica zone for the new regional disk clone.You can use a customer-supplied encryption key (CSEK) or a customer-managed encryption key to encrypt your disks.
Create disk clones for CSEK-encrypted disksIf you use a CSEK to encrypt your source disk, you must also use the same key to encrypt the clone.
ConsoleIn the Google Cloud console, go to the Disks page.
In the list of zonal persistent disks, find the disk that you want to clone.
In the Actions column, click the more_vert menu button and select Clone disk.
In the Clone disk panel that appears, do the following:
To create a disk clone for a CSEK-encrypted source disk, run the gcloud compute disks create
command and provide the source disk encryption key using the --csek-key-file
flag. If you are using an RSA-wrapped key, use the gcloud beta compute disks create
command.
gcloud compute disks create TARGET_DISK_NAME \ --description="cloned disk" \ --source-disk=projects/PROJECT_ID/zones/ZONE/disks/SOURCE_DISK_NAME \ --csek-key-file example-key-file.json
Replace the following:
TARGET_DISK_NAME
: the name for the new disk.PROJECT_ID
: the project ID where you want to clone the disk.ZONE
: the zone of the source and new disk.SOURCE_DISK_NAME
: the name of the source diskBefore trying this sample, follow the Go setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Go API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java JavaBefore trying this sample, follow the Java setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Java API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python PythonBefore trying this sample, follow the Python setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Python API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
RESTTo create a disk clone for a CSEK-encrypted source disk, make a POST
request to the compute.disks.insert
method and provide the source disk encryption key using the diskEncryptionKey
property. If you are using an RSA-wrapped key, use the beta
version of the method.
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/disks { "name": "TARGET_DISK_NAME" "sourceDisk": "projects/PROJECT_ID/zones/ZONE/disks/SOURCE_DISK_NAME" "diskEncryptionKey": { "rsaEncryptedKey": "ieCx/NcW06PcT7Ep1X6LUTc/hLvUDYyzSZPPVCVPTVEohpeHASqC8uw5TzyO9U+Fka9JFHz0mBibXUInrC/jEk014kCK/NPjYgEMOyssZ4ZINPKxlUh2zn1bV+MCaTICrdmuSBTWlUUiFoDD6PYznLwh8ZNdaheCeZ8ewEXgFQ8V+sDroLaN3Xs3MDTXQEMMoNUXMCZEIpg9Vtp9x2oeQ5lAbtt7bYAAHf5l+gJWw3sUfs0/Glw5fpdjT8Uggrr+RMZezGrltJEF293rvTIjWOEB3z5OHyHwQkvdrPDFcTqsLfh+8Hr8g+mf+7zVPEC8nEbqpdl3GPv3A7AwpFp7MA==" }, }
Replace the following:
PROJECT_ID
: the project ID where you want to clone the disk.ZONE
: the zone of the source and new disk.TARGET_DISK_NAME
: the name for the new disk.SOURCE_DISK_NAME
: the name of the source diskIf you use a CMEK to encrypt your source disk, you must also use the same key to encrypt the clone.
ConsoleCompute Engine automatically encrypts the clone using the source disk encryption key.
gcloudTo create a disk clone for a CMEK-encrypted source disk, run the gcloud compute disks create
command and provide the source disk encryption key using the --kms-key
flag. If you are using an RSA-wrapped key, use the gcloud beta compute disks create
command.
gcloud compute disks create TARGET_DISK_NAME \ --description="cloned disk" \ --source-disk=projects/PROJECT_ID/zones/ZONE/disks/SOURCE_DISK_NAME \ --kms-key projects/KMS_PROJECT_ID/locations/REGION/keyRings/KEY_RING/cryptoKeys/KEY
Replace the following:
TARGET_DISK_NAME
: the name for the new disk.PROJECT_ID
: the project ID where you want to clone the disk.ZONE
: the zone of the source and new disk.SOURCE_DISK_NAME
: the name of the source disk.KMS_PROJECT_ID
: the project ID for the encryption key.REGION
: the region of the encryption key.KEY_RING
: the key ring of the encryption key.KEY
: the name of the encryption key.Before trying this sample, follow the Go setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Go API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java JavaBefore trying this sample, follow the Java setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Java API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python PythonBefore trying this sample, follow the Python setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Python API reference documentation.
To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
RESTTo create a disk clone for a CMEK-encrypted source disk, make a POST
request to the compute.disks.insert
method and provide the source disk encryption key using the kmsKeyName
property. If you are using an RSA-wrapped key, use the beta
version of the method.
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/disks { "name": "TARGET_DISK_NAME" "sourceDisk": "projects/PROJECT_ID/zones/ZONE/disks/SOURCE_DISK_NAME" "diskEncryptionKey": { "kmsKeyName": "projects/KMS_PROJECT_ID/locations/REGION/keyRings/KEY_RING/cryptoKeys/KEY" }, }
Replace the following:
PROJECT_ID
: the project ID where you want to clone the disk.ZONE
: the zone of the source and new disk.TARGET_DISK_NAME
: the name for the new disk.SOURCE_DISK_NAME
: the name of the source disk.KMS_PROJECT_ID
: the project ID for the encryption key.REGION
: the region of the encryption key.KEY_RING
: the key ring of the encryption key.KEY
: the name of the encryption key.Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["Disk cloning creates instantly usable duplicates of existing disks, ideal for staging environments, database backup verification, moving data to new projects, and scaling VMs."],["Disk clones must have the same disk type as the source, can't be in a different zone, and are restricted to specific supported disk types like Persistent Disk and Google Cloud Hyperdisk."],["For disaster recovery, standard snapshots are recommended over disk clones, while instant snapshots are more storage-efficient for regular data capture without creating new disks."],["Creating regional disk clones from zonal disks requires the use of replica zones and should be used instead of using snapshots for disk migrations."],["If the source disk is encrypted using either customer-supplied or customer-managed keys, the clone must be encrypted using the same key."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4