Kaidolex
Kaidolex

Reputation: 23

How can I access boot disk from google cloud instance

My google cloud instance got a problem and it's preventing me to access the ssh. I would like to access the boot disk image from gcloud shell to download my files. How can I do that?

Thanks in advance

Upvotes: 1

Views: 1315

Answers (2)

Srividya
Srividya

Reputation: 2323

If you need to recover data from your existing boot disk of the problematic VM instance, you can detach the boot disk and then attach that disk as a secondary disk on a new instance so that you can have access to the data.

  1. Detach the boot disk from the existing VM instance by running the following command.

    gcloud compute instances detach-disk [INSTANCE_NAME] --disk=my-disk
    
  2. Create a new VM and attach the old VM's boot disk as secondary disk by running the following command.

    gcloud compute instances create [NEW_VM_NAME] --disk name=BOOT_DISK_NAME,boot=yes,auto-delete=no
    
  3. Connect to your new VM using SSH:

      gcloud compute ssh [NEW_VM_NAME]
    

Refer to the documentation that describes common errors that you may run into, when connecting to virtual machine (VM) instances using SSH, also ways to resolve errors for diagnosing failed SSH connections.

Upvotes: 1

guillaume blaquiere
guillaume blaquiere

Reputation: 75800

Create a new VM with a brand new disk. Add the problematic boot disk as additional disk. Start your new VM, log into it, and browse the additional disk to get your files.

Upvotes: 1

Related Questions