17 August, 2023
Creating a Windows bootable image for Google Cloud
A technical guide on how to create a custom Windows bootable image for use on Google Cloud.
This guide is a more technical version of "Installing Windows 10 on Google Cloud". I won't provide extremely detailed instructions, as this is intended for those with experience working in virtual machine environments on Linux/Windows.
In general, to create a Windows bootable image for Google Cloud, you need to follow these steps:
- Create a VMDK on your personal machine and install Windows on it (note that at the time of writing, Windows 11 is not yet compatible with Google Cloud)
- Create a Google Cloud Storage bucket and upload the VMDK file to it
- Import the VMDK file from Google Cloud Storage into compute > images. This import process will automatically install the necessary drivers into the VMDK file
- Download the imported image (or create a VM on Google Cloud directly from the created image)
Creating a VMDK and installing Windows
You can use VMware, VirtualBox, or virt-manager as per your preference. Personally, I use virt-manager as it's readily available on Fedora.
Note a few things when creating the VMDK and virtual machine:
- Use BIOS boot, not UEFI
- The VMDK should have a minimum capacity of 25GB
- For VMware and VirtualBox, do not split the VMDK into multiple smaller files
- For virt-manager, as it doesn't support VMDK, you can create a qcow2 and then convert it to VMDK using the following command:
qemu-img convert -f qcow2 -O vmdk /var/lib/libvirt/images/your_file.qcow2 ./your_file.vmdk
- It's advisable to enable RDP and OpenSSH services after installation.
Creating a Google Cloud Storage bucket and uploading the VMDK file
Go to the following link to create a new bucket: https://console.cloud.google.com/storage/browser
Note: Choose a zone that matches the zone where you want to create the VM (e.g., you can choose Singapore for proximity)
After uploading, you should see your file here:
Importing the VMDK file from Google Cloud Storage
You need to go here: https://console.cloud.google.com/compute/images
Then select the name, VMDK file, and OS:
The import process will take about 20-30 minutes.
Using the imported image
After the import process is complete, you'll see your imported image in the image list on Google Cloud.
You can download the image to your machine by exporting it (search Google: export google cloud compute image to vmdk)
To convert the VMDK to raw.gz as in the "Installing Windows 10 on Google Cloud" guide, you can use the command line:
qemu-img convert -f vmdk -O raw ./win10ggcloud.vmdk win10ggcloud.raw && pigz win10ggcloud.raw
Converting to .raw.gz helps reduce the file size (for easier sharing) and makes it easier to reinstall from Linux (using the dd command).
Alternatively, you can create a new VM directly from this image.
Note: Using the default Windows 10 image requires a sole-tenant node. To avoid this, when creating, click on "Equivalent code", then enter this code through Cloud Shell