Virtual Machines – How to Modify a VM Instance Setting to Boot from BIOS to UEFI

bootcentos8google-compute-engineuefivirtual-machines

I shrank my boot hard disk size on my Google Cloud Compute VM. Something which switched the boot method of the OS installed on it from legacy to UEFI along with the disk boot settings (which triggers UEFI setting must be the same for the instance and the boot disk. error).

How to change the Instance setting in order to match the UEFI setting of the instance given the OS boot method on the disk was migrated too?

Best Answer

This is an old post, but I was able to resolve this issue. All I did was create the new smaller drive from the same public bootable image as the original drive. (in my case Ubuntu 18.04 LTS: ubuntu-1804-bionic-v20210504). Do this is instead of starting from a completely blank disk.

I had the opposite problem as OP, my drive was not UEFI compatible when it needed to be. Provisioning the new drive with a pre-installed OS made it share the old boot settings. I imagine this works the other way around as well. I then mounted the drive onto my VM and cloned my source boot drive to it using weresync with this command (adjust according to your system):

sudo weresync -C -L grub2 -E 15 -g 1 /dev/sda /dev/sdc

I then stopped the server, replaced the large boot drive with the smaller one, and it booted right up. I had to reconfigure my fstab to get my secondary drive to mount properly, but that's it.