How to enable the UEFI in VirtualBox for a Windows 10 virtual machine running on Linux

This is for those who missed checking the UEFI checkbox in the settings prior to installing Windows 10 in VirtualBox. Do the below at your own risk, take appropriate backup,

First, check and confirm if BIOS Mode is Legacy, which means MBR is the partition and not GPT. To do this, press Windows+R and run:

If it shows BIOS mode as Legacy, then the UEFI check box was not ticked when Windows 10 was installed in a VirtualBox virtual machine. Fortunately, VirtualBox has the option to enable UEFI checkbox, but the MBR partition will not permit this.

To convert the MBR partition to GPT, start up the virtual machine, go to Settings -> Windows & Update -> Recovery.

In Recovery, choose Troubleshoot -> Advanced Options -> Command Prompt
Enter the administrator password and type:
C:\windows\system32>mbr2gpt /convert <enter>

Once this conversion is done, turn off the PC, click on the checkbox for UEFI in VirtualBox settings and run a repair of Windows.