A RetroSearch Logo

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

Search Query:

Showing content from https://developers.google.com/compute/docs/disks/detach-reattach-boot-disk below:

Detaching and reattaching boot disks | Compute Engine Documentation

Detaching and reattaching boot disks

Stay organized with collections Save and categorize content based on your preferences.

You can detach boot disks from your VM instance and attach new boot disks. This feature simplifies the process of repairing boot disks by letting you mount them to another VM instance without deleting your original instance. Additionally, you can replace the boot disks for an instance rather than having to recreate the entire VM instance.

If a VM instance does not have a boot disk, attempting to start the instance generates an error. However, you can still edit other instance properties.

Before you begin Permissions required for this task

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

Restrictions Detach a boot disk

Before detaching the boot disk from the VM instance, you must stop the instance. You don't need to unmount the disk.

Console
  1. Go to the VM instances page.

    Go to VM instances

  2. If prompted, select your project and click Continue.
  3. Click the instance for which you want to detach the boot disk.
  4. Click stop Stop to stop the VM. If there is no Stop option, click more_vert More actions > stop Stop.
  5. Click Edit.
  6. Scroll down to the Boot Disk section and click X next to the boot disk that you want to detach.
  7. Click Save.
gcloud

Use the gcloud compute instances detach-disk command to detach the boot disk from the instance:

gcloud compute instances detach-disk INSTANCE_NAME \
    --disk=DISK_NAME

Replace the following:

REST

Construct a POST request to detach the disk:

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/detachDisk?deviceName=DISK_NAME

Replace the following:

Reattach a boot disk

Any disk can be reattached as a boot disk to an instance as long as the instance does not already have a boot disk attached and the boot disk is in the same zone as the VM instance. If you customize a boot disk, you must ensure that the boot disk boots properly after it is attached.

Both the existing disk and the new disk must either be UEFI-compatible or not. To create a UEFI-compatible disk, use the gcloud compute disk create command with the --guest-os-features flag set to UEFI_COMPATIBLE.

Console
  1. Go to the VM instances page.

    Go to VM instances

  2. If prompted, select your project and click Continue.
  3. Click the instance for which you want to attach the boot disk.
  4. If the VM is running, click stop Stop to stop the VM. If there is no Stop option, click more_vert More actions > stop Stop.
  5. Click Edit.
  6. Go to the Boot Disk section.
  7. Click Add item.
  8. Select a boot disk from the drop-down menu.
  9. Click Save.
gcloud

Use the gcloud compute instances attach-disk command to attach or reattach a boot disk to a VM instance. Include the --boot flag to indicate that the disk is used as the boot disk for the instance. If this flag is absent, the disk is attached as a non-boot data disk.

gcloud compute instances attach-disk INSTANCE_NAME \
    --disk=DISK_NAME \
    --boot

Replace the following:

REST

Construct a POST request to attach the disk. Include the optional "boot": true parameter to indicate that this disk is the boot disk. If this parameter is absent, the disk is attached as a non-boot data disk.

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/attachDisk
{
 "boot": true,
 "source": "zones/ZONE/disks/DISK_NAME"
}

Replace the following:

After you attach the disk to your VM instance, restart the instance.

Update a boot disk for an instance

You can use only the Google Cloud console to update the boot disk for a VM in one step. Specifically, you can detach an existing boot disk and attach a new boot disk as one action.

This feature is not available through the gcloud CLI or REST.

  1. Go to the VM instances page.

    Go to VM instances

  2. If prompted, select your project and click Continue.
  3. Click the instance for which you want to attach the boot disk.
  4. If the VM is running, click stop Stop to stop the VM. If there is no Stop option, click more_vert More actions > stop Stop.
  5. Click Edit at the top of the page.
  6. Scroll down to the Boot Disk section.
  7. Click X next to the current boot disk.
  8. Click Add item.
  9. Select a boot disk from the drop-down menu.
  10. Click Save.

The Google Cloud console proceeds to detach your existing boot disk and attach the new boot disk that you specified. When this process is complete, restart the VM instance.

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."],[[["You can detach and attach boot disks to VM instances, which is useful for repairing boot disks or replacing them without recreating the entire VM."],["Detaching or attaching a boot disk can only be done when the VM instance is stopped, and each VM can only have one boot disk at a time."],["To detach a boot disk, you can use the Google Cloud console, `gcloud` CLI, or REST API, and the process involves stopping the instance, and then detaching the disk."],["To attach a boot disk, ensure the disk and instance are in the same zone, and utilize the Google Cloud console, `gcloud` CLI, or REST API, making sure to specify that it is the boot disk when using the CLI or API."],["The Google Cloud console allows for updating a boot disk in one step by detaching an existing one and attaching a new one, a feature not supported by `gcloud` or REST."]]],[]]


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