Exporting a VM Image from Google Cloud to local

20,611 views
Skip to first unread message

Narasimhan N

unread,
Mar 2, 2016, 10:51:04 AM3/2/16
to gce-discussion
We know there are docs available to add a custom VM from local to Google cloud.

Can we export a VM we built on Google to our desktops ? So that we can use it later ?

Any documentation / links is appreciated.

Thanks,

Kamran (Google Cloud Support)

unread,
Mar 2, 2016, 11:38:17 PM3/2/16
to gce-discussion

This article describes how to create an image from your VM's root disk and export it to Google Cloud Storage or you can directly download it to your remote computer.

Sincerely,

Juan fernandez

unread,
Apr 6, 2017, 10:15:01 AM4/6/17
to gce-discussion
Hi Kamran,

 I have followed the instructions you mention (specifically in https://cloud.google.com/compute/docs/images/export-image) to export successfully a raw disk, converted it to virtual disk with VirtualBox utilities (VBoxManage) and configured as a local vm. Unfortunately both in virtualbox or vmware player the vm does not boot (it hangs up with a black screen and no significant error message).

I have tried to recreate the grub boot loader as per https://www.centos.org/docs/5/html/5.1/Installation_Guide/s2-rescuemode-boot-reinstall-bootloader.html but the result is the same.

Is it possible to export a simple (just one disk) Linux vm from GCP altogether or is it somehow restricted due to specific GCP settings?

Thx in advance.

Carlos (Cloud Platform Support)

unread,
Apr 6, 2017, 4:47:35 PM4/6/17
to gce-discussion
The steps that you have followed are the recommended ones. The specific requirements to run an image in GCE are listed here. In this list I do not see anything specifically tied to GCE. Nevertheless, you might want to compare the list with Virtual Box image requirements. You might also want to use Virtual Box debugging tools, to understand what could be causing the issue. 

Juan fernandez

unread,
Apr 10, 2017, 3:05:49 AM4/10/17
to gce-discussion
Thanks Carlos. If anyone has successfully exported a VM to a local env from GCP I would like to know in order to understand the specific settings used... I'd really appreciate any help on this.

Rocky Borrego

unread,
Dec 6, 2017, 12:26:29 PM12/6/17
to gce-discussion
Just checkin in to see if anyone has successfully done this?  That is, take an existing GGE VM, download it locally, and run it in VirtualBox on local machine.

These are the steps I have take:
  1. Create a disk.raw file using DD, tar it up and copy to a Cloud Storage bucket.  (https://cloud.google.com/compute/docs/images/export-image)
  2. From there, I am able to download the tar file or even create another GCE Image using that archive.
  3. I download the tar file, extract it, and convert the disk.raw to a VDI disk file using 'VBoxManage convertdd disk.raw mydisk.vdi --format VDI' (https://blog.sleeplessbeastie.eu/2012/04/29/virtualbox-convert-raw-image-to-vdi-and-otherwise/)
  4. Now I create a new machine in VirtualBox and point to the existing disk (mydisk.vdi)
  5. But when I try to boot, it gets as far as 'Loading initial ramdisk...' and it just gets stuck there.

Any suggestions would be greatly appreciated.

 

Magnus Åberg

unread,
Mar 9, 2018, 7:42:18 PM3/9/18
to gce-discussion
I was able to come thru the the freeze of 'Loading initial ramdisk' by following this guide https://help.ubuntu.com/community/LiveCdRecovery#Update_Failure for ubuntu, I since I was using Ubuntu as OS.
I had to append the nameservers below in /etc/resolv.conf
nameserver 208.67.222.222
nameserver 208.67.220.220
after the sudo chroot /mnt command
Reboot and remove the live CD, wait a few seconds when the 'Loading initial ramdisk' is up, then you should see the 'Localhost Login:' prompt.

Γιάννης Φτάρας

unread,
Nov 2, 2019, 11:27:06 AM11/2/19
to gce-discussion
For those who are having issues with "Loading initial ramdisk..." you need to select the correct operating system your VM runs from the VirtualBox settings.

I have another issue though... Where can I find the localhost credentials to login to the VM? Root with empty password does not work and neither any other default credentials that I can think of.

Md Mustafizur Rahman Sonchoy

unread,
Nov 3, 2019, 5:50:54 PM11/3/19
to gce-discussion

Axel HAUGUEL

unread,
May 24, 2020, 2:09:55 PM5/24/20
to gce-discussion
Hello,

Do you have find a solution ? I research a solution too.

Thanks

TekWiz

unread,
Jun 6, 2021, 10:29:34 AM6/6/21
to gce-discussion
Well I was able to convert the disk image (Windows Server 2012 R2) to VMDK, which turned a 7 GB image to 15 GB. I made a bucket, moved it to the bucket and then was able to download it from storage. Took quite a while, I guess it's throttled. Then I was able to mount it using VMWare workstation (but not running VMWare as an admin, when I tried that it would fail) and was able to see the files, but was not able to access the user directory with "no permissions set") All I wanted was to get some files off of it since I had previously accidentally locked myself out by messing with the internal Windows firewall! But ultimately I used POWER ISO to read the VMDK image and was easily able to copy whatever I wanted from the user directory with no issues! Hope this is informative! Good luck!
Reply all
Reply to author
Forward
0 new messages