Detach Boot Disk from GCE VM

…衆ロ難τιáo~ 提交于 2020-01-11 08:34:07

问题


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_OPERATION: Hot-remove of the root disk is not supported.

Any suggestions?


回答1:


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




回答2:


You can't hot-remove the root disk of a VM otherwise you'd render it unusable (shutdown assumes you want to start the VM at a later point). Instead, you can delete the VM instance, making sure to preserve the root disk for future use.




回答3:


Detaching boot disks is now supported in Beta (docs). After shutting down instance, try: gcloud beta compute instances detach-disk INSTANCE_NAME --disk DISK_NAME

To re-attach a boot disk to the instance: gcloud beta compute instances attach-disk INSTANCE_NAME --disk DISK_NAME --boot



来源:https://stackoverflow.com/questions/28152577/detach-boot-disk-from-gce-vm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!