How to Clone a Drive to Disimilar Hardware From Bios to Uefi

Table of Contents

FYI

Use this as an overview for how to clone a drive. The methods I used for some of the steps can be simplified by using the right tools.

Overview

I had a clone an old Dell Machine to a new Dell Optiplex SFF 7010. The problem was the new computer had an NVME drive with storage controller drivers that weren't even in the Windows 11 installation media. On top of that, the original computer was Windows 10 but was BIOS only, meaning it wouldn't boot at all on the UEFI only machine.

These are the steps it took to clone the drive to a new machine.

  1. Clone the drive to the internal NVME using Clonezilla (UEFI version)
  2. Repartition the drive to create a 512MB-1GB EFI partition at the first sector
  3. Boot into the Windows 11 installer and loading the drivers to detect the cloned drive
  4. Use the Command Prompt to rebuild the EFI files onto the EFI partition
  5. Still in the recovery prompt, load the drivers into the windows installation using the command prompt and an external flash drive

Cloning the Drive

Use Clonezilla to do a Disk to Disk clone with the source drive plugged into a hard drive bay. If you have a 2.5" drive you can get away with a straight USB to SATA adapter.

Downloading the Drivers

Download the drivers from the manufaturer support website. Dell distributes them as exe files, so you'll have to run the exe files and then select the option to extract the files to a directory. For other manufaturers, you may have to use 7ZIP to extract the EXE files and copy the driver files to a USB drive for later.

Whenever you boot into the windows recovery environment to run commands, you have to load the driver for your storage controller. Click on "Custom Installation" and "Load Driver" to load the storage driver from your flash drive.

Converting the drive to GPT

After the drive is cloned you can either use the MBR2GPT.exe command line utility to convert the partition table type or use a third party tool like Aoemi (proprietary freeware).

I tried troubleshooting the MBR2GPT a while, but would always get this error message when attempting the conversion: mbr2gpt cannot find room for efi. I gave up and used the freeware instead which took 0 time to convert it. I had to remove the NVME drive from the computer then plug it into my workstation using another NVME to USB adapter. After that, I opened Aoemi, right clicked the drive, then clicked "Convert to GPT".

Creating the EFI Partition

Either through Aoemi or GPARTED, create a 1GB FAT32 partition on the first sector of the drive. It should be your first partition.

Then boot into windows recovery and use bcdboot to rebuild the EFI files based on the cloned windows installation

diskpart
list disk
select disk 2 (selecting the cloned drive)
list part
select part 1 (this is the 1GB efi partition)
format fs=fat32 quick
assign letter=z: (mounting the EFI partition)
list vol (double checking the volume of the OS drive...it was E)
exit

bcdboot E:\Windows /s Z: /f ALL  (restoring efi files)

Loading the drivers

While still booted into the recovery disk, I loaded the drivers from the USB flash drive to the windows image

dism /Image:E:\ /Add-Drivers:D:\ /Recurse

After that, you should be able to boot into Windows in UEFI mode!