A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/compute/docs/disks/create-disk-from-source below:

Duplicate a disk with clones | Compute Engine Documentation

Skip to main content Duplicate a disk with clones

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 begin How disk cloning works

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 types

You can create disk clones only for the following disk types:

Restrictions

Depending on the type of disk, disk clones have the following restrictions:

General restrictions

The following restrictions apply to clones of all disk types:

Restrictions for Persistent Disk clones

Disk clones for Persistent Disk have the following restrictions:

Restrictions for Google Cloud Hyperdisk clones Error messages

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:

Permissions required for this task

To perform this task, you must have the following permissions:

Create a zonal disk clone

You 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.

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

    Go to Disks

  2. In the list of disks, navigate to the disk that you want to clone.

  3. In the Actions column, click the more_vert menu button and select Clone disk.

    In the Clone disk panel that appears, do the following:

    1. In the Name field, specify a name for the cloned disk.
    2. For Location, verify that Single zone is selected.
    3. Under Properties, review other details for the cloned disk.
    4. To finish creating the cloned disk, click Create.
gcloud

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:

Terraform

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 Go

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 Java

Before 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 Python

Before 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.

REST

To 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:

Create a regional disk clone from a zonal disk

You 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.

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

    Go to Disks

  2. In the list of disks, navigate to the zonal Persistent Disk volume that you want to clone.

  3. In the Actions column, click the more_vert menu button and select Clone disk.

    In the Clone disk panel that appears, do the following:

    1. In the Name field, specify a name for the cloned disk.
    2. For Location, select Regional and then select the secondary replica zone for the new regional cloned disk.
    3. Under Properties, review other details for the cloned disk.
    4. To finish creating the cloned disk, click Create.
gcloud

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:

Terraform

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 Go

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 Java

Before 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 Python

Before 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.

REST

To 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:

Create a disk clone of an encrypted source disk

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 disks

If you use a CSEK to encrypt your source disk, you must also use the same key to encrypt the clone.

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

    Go to Disks

  2. In the list of zonal persistent disks, find the disk that you want to clone.

  3. In the Actions column, click the more_vert menu button and select Clone disk.

    In the Clone disk panel that appears, do the following:

    1. In the Name field, specify a name for the cloned disk.
    2. In the Decryption and encryption field, provide the source disk encryption key.
    3. Under Properties, review other details for the cloned disk.
    4. To finish creating the cloned disk, click Create.
gcloud

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:

Go Go

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 Java

Before 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 Python

Before 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.

REST

To 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:

Create disk clones for CMEK-encrypted disks

If you use a CMEK to encrypt your source disk, you must also use the same key to encrypt the clone.

Console

Compute Engine automatically encrypts the clone using the source disk encryption key.

gcloud

To 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:

Go Go

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 Java

Before 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 Python

Before 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.

REST

To 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:

What's next

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