mbr2gpt, diskpart, bcdedit

Disk change: MBR to GPT

OpenCore need booting with UEFI enable disk. if your disk is createds as MBR, you need to convert it to GPT. Backup your mbr and other parttions first before you make any changes on your partition; you are risking your data.

 # on Windows Recovery disk
  > diskpart
  diskpart> list disk
  disk 0   238GB 138GB free  
  disk 1    14gb   0gb free
  diskpart> select disk 0
  diskpart> list part
  partition 1 50mb  1024kb offset     # <- backup!
  partition 2 100GB 1075MB offset     # please note there is 1GB space preceding for EFI.
 # on Ubuntu
  # full MBR backup (boot code + partition Table
  $ sudo dd if=/dev/sda of=./mbr.img bs=512 count=1
  # boot code only (excluding the partition table
  $ sudo dd if=/dev/sda of=./bootcode.img bs=446 count=1
  # backup partition 1 of 50mb
  sudo dd if=/dev/sda1 of=devsda1.img
  1. you need a free space to convert. if your disk is fully assigned, you need to shrink the windows partition first with minitool partition wizard. see here
  2. boot with windows recovery disk.
  3. mbr2gpt tends to have an error: cannot find OS partition(s) for disk 0. but it will make a success after these commands.
    X:\diskpart
    diskpart> select disk 0
    diskpart> select partition 2   # you don't need to delete 50mb partition 1.
    diskpart> active
    diskpart> assign letter=W
    diskpart> exit
    
    X:\> bcdboot W:\Windows /s W: /f BIOS
    X:\> mbr2gpt /validate /disk:0 /allowFullOS
        validation completed successfuly.
    X:\> mbr2gpt /convert /disk:0 /allowFullOS
        Trying to shrink the OS partition      # probably you need to type Enter.
        Creating the EFI system partition
        Installing the new boot files.
        Performing the layout conversion.
        Migrating default boot entry.
        Fixing drive letter mapping.
        Conversion completed successfuly.
        Update WinRE config file.
        Before the new system can boot properly you need to switch the firmware to boot to UEFI mode!
    
        X:\> diskpart
        diskpart> select disk 0
        diskpart> list part
        partition 1 50mb 1024kb offset
        partition 2 99GB 1075mb offset
        partition 3 100mb 100gb offset    # <- this should be EFI. 100mb is too small for OpenCore. need to expand. or more precisely partition 1 should be deleted and expanded as 1gb and moves partition 3 to partition 1 (1GB size).
    
  4. check the windows boot in UEFI boot mode. (change it in BIOS).
  5. Use minitool to expand the partition1: 50mb to 1050mb.
  6. Ubuntu gparted: copy partition3 to partition 1. set flags: boot and efi. It shrinks 100mb. (maybe expand it first and then copy would work.)
  7. Use minitool to expand the partition1: 50mb to 1050mb. assign drive letter D to EFI partition.

Go back to Computer

20260814