How to convert UEFI disks to BIOS on your Windows server - Plenit
Find out here how to convert UEFI disks to BIOS to avoid execution problems within the Plenit platform.
Machines deployed with UEFI technology are not supported by Plenit, specifically the virtual machines of Azure Gen2 (Second Generation) and the virtual machines of **Hyper-V Get2 **(Second Generation).
When trying to boot a machine of this type, we may possibly encounter an error like the following or very similar:
iPXE: (hrrp://ipxe.org) 00:04.0 CA00 PCI2.10 PMM-0010000100011020 CA00
Press F12 for boot menu.
Boot device: Hard Disk -- success.
Boot device: CD-Rom -- Failure: could not read boot disk
No bootable device.
Powering of in 30 seconds.
NOTE: Also, in Step 5 of this tutorial you can find a guided procedure to solve boot corruption problems on a Microsoft Windows server.
How to convert UEFI disks to BIOS?
Prerequisites or pre-configuration
To successfully complete this tutorial and convert UEFI disks to BIOS the following will be needed:
On the one hand, to be **registered on the Plenit Platform **with an organization and to be registered in it after doing Log-in{target="_blank" rel="noopener"}.
On the other hand, having a Servers subscription created{target="_blank" rel="noopener"}
Have a **Windows server migrated with boot problems **within the subscription.
Have a **working Ubuntu 20 server **within the subscription.
**NOTE: **Before performing the procedure, it is recommended to make a backup of the disk on which we are going to operate, so that it can be recovered in case we make any mistake during the process, since, among other things, it is possible that we make a mistake and delete its contents.
NOTE: *At the end of the procedure, it is advisable to delete the backups we have created and that do not need to be stored, since, although no charge is made for the backups that may be made, the stored disk space is billed. *
Step 0. Prepare the Ubuntu machine
In case you do not have a Ubuntu 20 machine provisioned in the servers subscription, **it must be deployed **so that it can be used for the disk recovery that is causing problems.
Also, the virtual machine must be prepared to be able to access it through a direct SSH connection and thus make it more convenient than working from the console. For this, it will also be necessary to open the SSH port in the firewall of the Plenit servers subscription and to use some program for the connection, such as PuTTY in the case of connecting from a Microsoft Windows computer.
Step 1. Disk preparation
The first thing to do is stop the virtual machine whose boot is not working correctly. To do this, you must access the subscription where the virtual machine that fails to boot is located and go to the specific server that is failing.
Once there, go to the top of the screen and click on "Stop" (1) to stop the machine virtual.

Step 1. We stop the virtual machine that is causing problems so we can disconnect the disks
Once you are sure that the machine has stopped, go to the disks section (2) of the servers subscription, find the disk that belongs to that virtual machine and click on the three dots (3) to **select the "disconnect" option** (4).

Step 1. We disconnect the disk we want to modify so we can work with it
At this point you already have the disk disconnected from the source server and it must be connected to the Ubuntu server 20 that will be used for the boot repair procedure by changing from GPT to BIOS.
To connect this disk to the Ubuntu machine, you must** go to the disks section** (5) of the servers subscription, which is in principle the section where you are at this moment, find the disk that has been disconnected from the virtual machine and click on the three dots (6) to **select the "Connect" option** (7).

Step 1. We connect the disk to the Ubuntu machine for manipulation
When selecting the disk, you are asked to select the server (8) to which it must be connected, so you must select the relevant machine and click on "Continue" (9).

Step 1. We select the server to which the disk will be connected
When the disk is connected to the server, you must go to the servers section,** select the server** and boot the virtual machine (10) to which we have just connected the disk to begin the actual procedure.

Step 1. We start the server on which we are going to work on the disk
After this, we create an inbound rule in the firewall of the server to be able to access remotely via SSH and work more comfortably, instead of connecting from the integrated console in Plenit, since working from the console is somewhat more inconvenient.
To do this, you must **go to the servers **subscription, you must access the server settings of Ubuntu and, at the bottom of the screen, in the "Firewall -- Inbound Rules" section, you must click on "New rule" (11).

Step 1. We create a new inbound rule to connect via SSH in the Plenit firewall
In the new window, the following connection details:
Select network: (12) The network through which the connection will be made must be selected. It will generally be the one already configured.
IP or Network: (13) The IP or network from which the connection can be made. By default it is set to "Any IP" but it is recommended to restrict it, entering the IP or IP range of the client's company, since these connections will not be made from anywhere else, and this minimizes the attack surface.
Protocol and Public Port: (14) This is the port we want to use to connect, it is made up of Protocol (TCP or UDP) in this case TCP and the port number, which in this case is port 22.
Public IP: (15) The public IP of the server to which it will connect through this rule.
Private (IP): (16) The private IP of the server to which it will connect through this rule.
Private Port: (17) This is the port we want to use to connect, on the internal side, in this case only the port number (Port 22).
Once everything is configured, you will have to **click on "Continue" **(18) for the rule to be created.

Step 1. We create a connection rule for SSH in the server firewall by providing the data
After this configuration, you will be able to connect to the GNU/Linux server console through SSH using a connection program such as PuTTY, which is one of the most widely used programs for connecting via SSH (and other protocols) from Windows computers.
**NOTE: **You can download the PuTTY program from the following URL{target="_blank" rel="noopener"}.

Step 1. We use PuTTY to connect to the server on which we are going to perform the procedure
Step 2. Disk modification procedure
The next thing to do is connect via SSH from the machine used for administration, using the tool you have chosen, such as the PuTTY previously suggested.
Once connected, the first thing to do is list the available disks on the server so we can identify the disk we have mounted for repair. Several commands can be used for this, but in our case the command "fdisk -l" must be used (19) which shows all the disks and partitions available on the machine.
When showing the existing disks (20) which will generally have a similar form to:
/etc/xvda1 /etc/xvda2 /etc/xvda3 /etc/xvdb1 /etc/xvdb2 /etc/xvdb3 /etc/xvdb4 /etc/xvdb5
In this case, we see that they all start with "/etc/" this is because the devices and partitions have their configuration file linked to the mounted disk.
Also, we see that afterward, they all share a string, the one made up of "xvdb".
Finally, it can be seen that there is an "a" or a "b" followed by a number. This is because each disk in the system has an assigned letter, ordered alphabetically, thus starting from "a", followed by "b", etc. Also, each disk partition receives a number which will start at "1" and continue increasing.
With what we have just commented, the list of disks and partitions shown above, "/etc/xvda1", "/etc/xvda2" and "/etc/xvda3" will belong to disk "/etc/xvda", while "/etc/xvdb1", "/etc/xvdb2", "/etc/xvdb3", "/etc/xvdb4" and "/etc/xvdb5" will belong to disk "/etc/xvdb". That said, from the list shown to us, we will be interested in disk "b", since the first one (a) is the one running the Ubuntu operating system and the second one (b) is the one mounted for repair, but be careful, this will depend on whether we have more disks mounted on that server

Step 2. We check the disks connected to the server to identify the one that failed
The next thing to do is edit the disk that you want to change (commonly "/etc/xvdb") and to do this you must run the command "gdisk /dev/xvdb" (21).
When this command is run, information about the status of the partition tablewill be returned, indicating its type. In the case at hand, it should be of GPT type so it should show "GPT: Present" (22), which will indicate that it is a GPT-type disk that has no kind of problem.
If a message such as "GPT: Damaged" were shown an additional step must be performed that we explain in step 3. If the case you are dealing with shows this error, go to Step 3 and come back here when you finish doing it.

Step 2. We edit the disk with gdisk and check the partition status
In case the message is "GPT: present" the following options must be written (23) from the "gdisk" menu in the order shown below:
r: Prepares the recovery and transformation options.
g: Converts the partition from GPT to MBR.
s: Prepares the MBR partition.
p: Displays the MBR table.
w: Writes the MBR partition table.
y: We will validate the write and exit the program.

Step 2. We begin to run the gdisk commands to make the change on the disk
With this this part of the procedure will have been finished and you must go to Step 4.
Step 3. Procedure in case you get the message "GPT: Damaged"
IMPORTANT: What is described below should only be performed if the disk shows the message "GPT: Damaged".
**NOTE: **It should be remembered that it is good practice to make a backup of the disk we are working with before carrying out all this procedure.
When running the command "gdisk /dev/xvdb" the error "GPT: Damaged" has been shown so an additional procedure must be carried out.
This consists of when the "gdisk" command returns the prompt the following options must be entered in the order (24) listed here:
p: Print the partition table information.
w: Write the partition table and exit.
y: Confirm writing the partition table.

Step 3. We continue with the gdisk commands to recover the GPT partition
To verify that everything went well, you must** run the command "gdisk /dev/xvdb" again** (25) and check that the message "GPT: present" is displayed instead of the "GPT: damaged" that was shown previously.

Step 3. We check with gdisk that the GPT status is present and not damaged
If everything went well, you can return to the point in Step 2 where we were before moving on to solve the GPT problem.
Step 4. Windows boot repair
At this step, the disk conversion has already been done, but it is still not bootable within Windows. For this reason you must shut down the virtual machines, disconnect the disk from the Ubuntu machine that was used for its recovery and connect it to the Windows machine from which it had previously been disconnected.
NOTE: The process of disconnecting a machine to connect it to another has been reproduced previously, so it is not described again. If the reader has doubts, we refer them to the previously performed procedure.
The next thing to do after reconnecting the disk is insert an ISO image so that it can boot from it, in the same way as if we were working with a physical machine and wanted to perform maintenance or recovery tasks.
To do this procedure, you must go to the administration portal of Plenit, access the servers subscription where the server is located, select the server and, in the server administration or editing window, go to the top of the window, where initially **"No ISO" can be read **(26) and unfold the options to select the ISO (27) corresponding to the server's operating system (for example, Windows Server 2019).

Step 4. We select the ISO to mount on the server so we can launch the recovery options
Once this is done, you must boot the machine. To do this, in the Plenit administration console you must** click on "Power On"** (28), confirming when asked whether you want to power on the server.

Step 4. We start the virtual machine
After this, you must wait a moment while the machine boots and you must launch the console (29).
**NOTE: **We will probably not manage to connect on the first try, since the system is booting, which is why it must be launched as many times as necessary until the boot from the ISO is shown.

Step 4. We launch the remote management console available in the platform
When you manage to open the console you must launch boot from CD/DVD, that is, from the ISO that has been inserted, you must wait until the message "Press any key to boot from CD or DVD..." must press the "Enter" key (30) so that it boots from the image and starts loading the system files.

Step 4. We press Enter so that the image connected to the machine loads
NOTE: It is quite common for the key press not to be caught on the first try, so you may end up seeing the operating system installed on the virtual machine boot. If this happens, the machine should be restarted or powered off and the attempt repeated.
At this point, if everything goes well, the system will begin to load the ISO and decompress the binaries so that it can run the console with which we must perform the procedure, so patience is needed while it loads.

Step 4. We wait while the system image loads
When the "Windows Server operating system setup" windowloads, you must click on "Next" (31), and it is not too important whether it is in one language or another since we will work in command line.

Step 4. We click Next to move to the next menu
In the next window, you must click on "Repair your computer" (32) to enter the system recovery options.

Step 4. We click Repair your computer
After this, a new window will be displayed in which you must select "Troubleshoot" (33).

Step 4. We select troubleshoot in the visual menu
And finally, within the advanced options you must select the "Command Prompt" option (34) which will launch a Windows CMD window that we can now work on.

Step 4. We select Command Prompt among the options offered to us
Now that you have a Windows command prompt console, commonly called "Command" or "CMD", you must run a series of commands (35), which are the same ones used when making a bootable USB disk.
The commands to run are as follows:
diskpart
list disk
*select disk *
list partition
list volume (it will help us identify the volume where Windows is installed)
Where:
"" will be the disk you want to use to boot the system; you cannot choose a data disk.
Once this is done, you must review until you find partition "C:", running the following commands and using the corresponding partition number (36) for the partition being searched.
*select partition *
active
exit
After running the "activate" command, if everything went well, you should receive the "Diskpart marks the current partition as active" message (37).

Step 4. We run diskpart and perform the operation on the disk
Done this, you must make the partition bootable, so you must look for the drive letter where the Windows operating system is located, which may possibly be "D:" since "C:" is used by the recovery system, and on the other hand, you also need to find the drive letter where the ISO has been mounted, which would be the equivalent of the CD/DVD, with "E:" or "F:" being the most common options.
Once the drive letters are clear, you must run the following commands (38):
F:
dir
BCDBOOT D:\Windows
bootrec /fixmbr
Where:
F: is the drive where we have the ISO mapped (the CD/DVD) in our case.
D: is the drive where the virtual machine's Windows operating system is located.
After running the command "bootrec /fixmbr", if everything goes well, you should see the message "the operation completed successfully".
If so, the process will be finished, so you can restart the machine y check that the machine boots without problems.
If, on the other hand, when running the command "BCDBOOT D:\Windows" it returns the message "Error while attempting to copy boot files", it will mean that the command has failed, so you must continue in Step 5.

Step 4. Recovering Windows boot
Step 5. Fixing the boot file copy failure
NOTE: This procedure should only be applied if running the command "BCDBOOT D:\Windows" has failed and returned the error "Error while attempting to copy boot files".
To solve this problem, you only need to** follow the procedure below** without skipping any steps and in the order set out below.
First, you must launch the "diskpart" application (39) to locate the Windows operating system disk and partition:
diskpart
list disk
Once it is clear the disk must be selected (40) to use it:
select disk 0
Next, you must list the partitions y select the one that has Windows installed and mark it as active (41):
list partition
select partition 3
active
exit

Step 5. We execute the first part of the boot recovery
Finally, you must run the repair commands (42) from the ISO drive (CD/DVD):
dir
BCDBOOT D:\Windows
bootrec /fixmbr
Where:
F: is the drive where we have the ISO mapped (the CD/DVD) in our case.
D: is the drive where the virtual machine's Windows operating system is located.

Step 5. We execute the second part of the boot recovery
With this, the boot should now be recovered.
Conclusions
The process described in this tutorial, such as converting UEFI disks to BIOS, makes it possible to convert a Windows UEFI machine coming from Microsoft Azure or a Microsoft Hyper-V so that it can be run on the Plenit architecture.
Likewise, in this same tutorial, you can see how to fix boot corruption of a Microsoft Windows machine.
As can be seen, these are somewhat more complicated processes than usual, but they have been described in a guided way through well-defined steps so that the reader will have no problems.
We hope that with this short guide you will have no problems converting UEFI disks to BIOS and no problems solving possible issues in the boot sector, but if you do, do not hesitate to contact us so we can give you a hand.
Thank you for your trust!
Last updated
Was this helpful?

