Creating Customized Boot Disks

This document explains how to create a boot disk for your instance from a public image, a custom image, or a snapshot from a boot disk. When you create your boot disk, limit the size to 2TB to account for the limitations of MBR partitions.

Google Compute Engine automatically creates a boot persistent disk when you create an instance. If you require additional data storage space for your instances, add one or more secondary instance storage options.

You may need to create a standalone boot persistent disk and attach it to an instance later, or resize a boot persistent disk to improve performance and add more room for additional application or operating system files. That information is described in Add or resize a persistent disk.

Before you begin

Creating a standalone boot persistent disk from an image

You can create a standalone boot persistent disk outside of instance creation and attach it to an instance afterwards.

Console

  1. Go to the Create a new disk page.

    Go to the Create a new disk page

  2. Under Source type, select Image. Choose an image from the list.
  3. Create your disk.

gcloud

To create a standalone boot persistent disk, use the gcloud compute disks create command:

gcloud compute disks create example-disk --image example-image

API

To create a new boot persistent disk using the API, use the following URI:

https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-f/disks?sourceImage=IMAGE

Where IMAGE is the URL-encoded, fully-qualified URI of the source image to apply to this persistent disk.

The request body must contain a name for this new persistent disk:

{
  "name": "example-disk"
}

If you created a boot persistent disk that is larger than the image, you might need to repartition the boot persistent disk.

Create a boot persistent disk from a snapshot

After you create a snapshot of a boot persistent disk, you can apply data from that snapshot to new persistent disks. It is only possible to apply data from a snapshot when you first create a persistent disk. You cannot apply a snapshot to an existing persistent disk, or apply a snapshot to persistent disks that belong to a different project than that snapshot.

Console

  1. Go to the Create a new disk page.

    Go to the Create a new disk page

  2. Under Source type, select Snapshot.
  3. Choose a snapshot from the list.
  4. Finish setting the properties for your disk and create it.

gcloud

To apply data from persistent disk snapshot, run the following command:

gcloud compute disks create example-disk --source-snapshot example-snapshot

API

To create a new boot persistent disk with a snapshot, make a POST request to the following URI:

POST https://www.googleapis.com/compute/v1/projects/example-project/zones/us-central1-f/disks

The request body must contain a name for this new persistent disk and the URL to the snapshot to use:

{
  "name": "example-disk",
  "sourceSnapshot": "zones/us-central1-f/snapshots/example-snapshot"
}

What's next

  • The process for resizing a boot persistent disk, and a non-boot persistent disk is the same. You can find that content in: Add or resize a persistent disk.

Send feedback about...

Compute Engine Documentation