Detach Boot Disk from GCE VM

后端 未结 3 1555
长发绾君心
长发绾君心 2021-01-18 12:06

I am trying to detach the Boot Disk from a GCE VM. As the VM is stopped so it should allow me to detach it but it\'s returning this error

UNSUPPORTED_OPERATI         


        
3条回答
  •  遇见更好的自我
    2021-01-18 12:53

    Updated answer

    As of 24 Jan 2019, GCE added the ability to detach and reattach boot disks from stopped VMs in GA.


    Original answer (correct prior to 24 Jan 2019)

    If you detach the boot disk from a stopped VM, there's no way to restart the VM back up, so that operation does not make sense.

    Thus, you would need to disable the option "auto-delete boot disk" and delete the VM:

    To set the auto delete state of a persistent disk in gcloud compute, use the gcloud compute instances set-disk-auto-delete command:

    gcloud compute instances set-disk-auto-delete INSTANCE \
    
        [--auto-delete | --no-auto-delete] --disk DISK --zone ZONE
    

    Alternatively, you can also change this setting on the VM details page from the Developers Console by clicking on the VM instance name, and then unchecking this option:

    ☐ Delete boot disk when instance is deleted

提交回复
热议问题