Is there a way via the Google Console to detach a disk from a stopped instance ? (its SSD Persistent if it makes any difference)
I have created an instance via the Console, done some configuation on it, and stopped it. I have done this on an f1-micro machine whilst testing.
I was hoping to do some further testing on a higher spec instance, and was expecting to be able to just change this (assuming its in a stopped state).
However, I can't see any option to do this, as it says the disk is still attached to the stopped instance.
Is there any way to detach and use the existing disk on a new instance, or do I have to delete the instance every time ? Ideally I'm looking to do this via the Console, but gcloud commands may be ok.
Or is it best to take a Snapshot, and start a new instance from that, or something else?
Hot-remove of the root disk is currently not supported for Google Compute Engine instances. As such, you have the following workarounds, which you also have mentioned in your question.
I would recommend the second workaround because you always will have a backup of your disk, in if anything goes wrong (e.g. boot disk deleted by mistake etc). Both of these workarounds can be accomplished through developer console or gcloud.
I think the issue you were running into is that you were trying to detach the boot disk of your instance, and at the time, that was unsupported.
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 another: gcloud beta compute instances attach-disk INSTANCE_NAME --disk DISK_NAME --boot
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With