Create a new Persistent Disk volume

Linux Windows

You can either create a blank Persistent Disk volume, orcreate a disk from a data source.You can use Persistent Disk as a boot disk for a virtual machine (VM)instance, or as a data disk that you attach to a VM.

This document explains how to create a blank, non-boot zonal Persistent Disk volumeand attach it to your VM.

For other types of disk creation and addition, see the following:

Before you begin

Restrictions

  • During VM creation, you can attach up to 127 secondary non-bootzonal Persistent Disk volumes.
  • You can have a total attached capacity of 257 TB per VM. For informationabout how to ensure maximum performance with large volumes, seeLogical volume size.

Adding a non-boot disk to your VM

Create and attach a non-boot zonal disk by using theGoogle Cloud console,theGoogle Cloud CLI, orREST.

Persistent Disk type variables

The following table lists the reference values of each Persistent Disktype. When you create a Persistent Disk volume with the Google Cloud CLI,REST, or the Cloud Client Libraries for Compute Engine,indicate the Persistent Disk type you want to create by providing its correspondingvalue from the table.

If you create a disk in the Google Cloud console, the defaultdisk type ispd-balanced. If youcreate a disk using the gcloud CLI orREST, the default disk type ispd-standard.

Disk typeReference name
Balanced Persistent Diskpd-balanced
Performance (SSD) Persistent Diskpd-ssd
Standard Persistent Diskpd-standard
Extreme Persistent Diskpd-extreme

You should specify a custom device name when attaching the disk to a VM.The name you specify is used to generate asymlink for the disk in the guest OS,making identification easier.

Caution: If you add a custom device name to a disk after you attach the diskto a VM, Compute Engine temporarily detaches the disk from the VM, whichmight disrupt your workloads.

Permissions required for this task

To perform this task, you must have the followingpermissions:

  • compute.disks.create on the project before you can create a new disk
  • compute.instances.attachDisk on the VM
  • compute.disks.use permission on the disk to attach

Console

  1. Go to theVM instances page.

    Go to the VM instances page

  2. Click the name of the VM where you want to add a disk.

  3. On the details page, clickEdit.

  4. UnderAdditional disks, clickAdd new disk.

  5. Specify a name for the disk, configure the disk's properties,and selectBlank as theSource type.

  6. Optional: Under the headingDevice name, select the optionUse a custom device name. The name you enter is used to generatea symlink for the disk, which makes disk identification easier.

  7. ClickDone to complete the disk's configuration.

  8. ClickSave to apply your changes to the VM and add the newdisk.

gcloud

  1. In the Google Cloud console, activate Cloud Shell.

    Activate Cloud Shell

    At the bottom of the Google Cloud console, aCloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.

  2. Use thegcloud compute disks create commandto create the zonal Persistent Disk volume.

    gcloud compute disks createDISK_NAME \  --sizeDISK_SIZE \  --typeDISK_TYPE

    Replace the following:

    • DISK_NAME: the name of the new disk.
    • DISK_SIZE: the size, in gigabytes, of thenew disk. Acceptable sizes range, in 1 GB increments, from 10 GB to65,536 GB inclusive.
    • DISK_TYPE: full or partial URL for thetypeof the Persistent Disk volume.For example,https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/diskTypes/pd-ssd.
  3. After you create the disk, attach it to any running or stopped VM.Use thegcloud compute instances attach-disk command:

    gcloud compute instances attach-diskVM_NAME \  --diskDISK_NAME --device-name=DEVICE_NAME

    Replace the following:

    • VM_NAME: the name of the VM whereyou are adding the new zonal Persistent Disk volume
    • DISK_NAME: the name of the new disk that youare attaching to the VM.
    • DEVICE_NAME: Optional: a name that the guestOS uses to identify the disk.
  4. Use thegcloud compute disks describe commandto see a description of your disk.

Terraform

To create a disk, use thegoogle_compute_disk resource.

# Using pd-standard because it's the default for Compute Engineresource "google_compute_disk" "default" {  name = "disk-data"  type = "pd-standard"  zone = "us-west1-a"  size = "5"}

To attach the disk to a VM, use thegoogle_compute_instance resource.

resource "google_compute_instance" "test_node" {  name         = "test-node"  machine_type = "f1-micro"  zone         = "us-west1-a"  boot_disk {    initialize_params {      image = "debian-cloud/debian-11"    }  }  attached_disk {    source      = google_compute_disk.default.id    device_name = google_compute_disk.default.name  }  network_interface {    network = "default"    access_config {      # Ephemeral IP    }  }  # Ignore changes for persistent disk attachments  lifecycle {    ignore_changes = [attached_disk]  }}

To learn how to apply or remove a Terraform configuration, seeBasic Terraform commands.

REST

  1. Construct aPOST request to create a zonal Persistent Diskby using thedisks.insert method.Include thename,sizeGb, andtype properties. To create thisdisk as an empty and unformatted non-boot disk, don't specify asource image or a source snapshot.

    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/disks{ "name": "DISK_NAME", "sizeGb": "DISK_SIZE", "type": "DISK_TYPE"}

    Replace the following:

    • PROJECT_ID: your project ID.
    • ZONE: the zone where your VM and newdisk are located.
    • DISK_NAME: the name of the new disk.
    • DISK_SIZE: the size, in gigabytes, of thenew disk. Acceptable sizes range, in 1 GB increments, from 10 GB to65,536 GB inclusive.
    • DISK_TYPE: full or partial URL for thetype of Persistent Disk.For example,https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/diskTypes/pd-ssd.
  2. Construct a POST request to thecompute.instances.attachDiskmethod, and include the URL to the zonal Persistent Disk volume that youjust created:

    POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/VM_NAME/attachDisk{ "source": "/compute/v1/projects/PROJECT_ID/zones/ZONE/disks/DISK_NAME", "deviceName":DEVICE_NAME}

    Replace the following:

    • PROJECT_ID: your project ID
    • ZONE: the zone where your VM and newdisk are located
    • VM_NAME: the name of the VM whereyou are adding the new Persistent Disk volume
    • DISK_NAME: the name of the new disk
    • DEVICE_NAME: Optional: a name that the guestOS uses to identify the disk.

After you create the new disk and attach it to a VM, you must format and mountthe disk, so that the operating system can use the available storage space.

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-15 UTC.