Solved Tutorial: Upgrade MBR boot disk to EFI boot disk

DmitryKo

New Member
Messages
12
Location
55º38'33'' N, 37º28'37'' E
Tutorial: In-place upgrade MBR boot disk to EFI boot disk

I've just finished an in-place upgrade of Windows 7 to 8.1u1 (with a intermediate step of upgrading W7 to W8).

The system was installed was on a SSD with MBR partitions and I wanted to convert to GPT disk and initialize secure EFI boot, but Windows setup and DiskPart only allow this operation on a clean unformatted disk, and a few threads in the forum advise that this is the only option:

http://www.eightforums.com/installation-setup/13400-cannot-boot-uefi-install.html
http://www.eightforums.com/installation-setup/27963-efi-uefi-partition-deleted.html
http://www.eightforums.com/installa...ion-missing-files-repair-disk-won-t-boot.html
http://www.eightforums.com/performa...have-luck-imaging-8-uefi-gpt-secure-boot.html
etc.

Fortunately I have found Microsoft KB articles that detail the process of manually making/restoring an EFI boot partition.

There is a 3rd party disk partitioning utility that allows you to convert MBR disks to GPT disk and resize partitions to make room for EFI boot, WinRE and MSR partitions.


So I thought this would be useful if someone would review the process and maybe the admin will eventually make a full step-by-step tutorial out of this thread.

This guide can also be used to manually restore EFI system boot partition in case of failure.
 
Last edited:

My Computer

System One

  • OS
    Windows 8.1
    Computer type
    PC/Desktop
    CPU
    Core i5-2500K
    Motherboard
    ASRock Z68 Extreme4 Gen3
    Memory
    16 GB Kingston HyperX Genesis KHX1600C9D3
    Graphics Card(s)
    MSI R9 290X GAMING 4G
    Monitor(s) Displays
    Samsung S27A950D
    Screen Resolution
    1920x1080
    Hard Drives
    Samsung 840 Pro 256 GB
    WD Caviar Black 4 TB
    WD Caviar Green 3 TB
    PSU
    Thermaltake Toughpower Grand 850
    Case
    Thermaltake V9 BlacX Edition
    Cooling
    Thermaltake BigTyp 120
    Keyboard
    Microsoft Natural Ergonomic Keyboard 4000
    Mouse
    A4 X7 XL-755BK
How to convert bootable MBR system disk to a UEFI bootable disk without losing your data in Windows 8/8.1
OR

Repair UEFI system boot partition (only perform steps 1, 5.ii, 6-7).



You need to have a working Windows installation on a bootable MBR disk which has two partitions - a 100 MB system MBR partition (id=27) and a primary Windows partition with intact C:\Windows.


In order to boot Windows in UEFI mode, you will have to convert your disk to GUID Partition Table (GPT) format, create (or re-create) the necessary system partitions, copy EFI Windows Boot Manager code to the System partition and create BCD store. Your Windows partition will be left intact and all your programs, files and settings will remain.




0. Create a System Image Backup

Control Panel, File History, System Image Backup​


Select a hard disk to store the backup. It should be a basic disk (NOT a dynamic disk) and should have enough free space to hold your entire C: partition.


The backup should only be required if something goes very wrong with partition resize in step 3 - for example, if you accidentally wipe your main partition, or if a power surge interferes with non-destructive resize operation, in which case you should boot Windows Recovery Environment (WinRE) and restore your partitions.


Note that if you decide to wipe the disk and run a clean install using Windows Setup media, this backup will NOT allow you to restore your files afterwards, since the size of the new partition will not match. You can only restore the full system partition as it was at the time of the backup.
 

My Computer

System One

  • OS
    Windows 8.1
    Computer type
    PC/Desktop
    CPU
    Core i5-2500K
    Motherboard
    ASRock Z68 Extreme4 Gen3
    Memory
    16 GB Kingston HyperX Genesis KHX1600C9D3
    Graphics Card(s)
    MSI R9 290X GAMING 4G
    Monitor(s) Displays
    Samsung S27A950D
    Screen Resolution
    1920x1080
    Hard Drives
    Samsung 840 Pro 256 GB
    WD Caviar Black 4 TB
    WD Caviar Green 3 TB
    PSU
    Thermaltake Toughpower Grand 850
    Case
    Thermaltake V9 BlacX Edition
    Cooling
    Thermaltake BigTyp 120
    Keyboard
    Microsoft Natural Ergonomic Keyboard 4000
    Mouse
    A4 X7 XL-755BK
1. Prepare a bootable USB Recovery Media (WinRE)


Control Panel, File History, Recovery​


Attach a USB stick with capacity of 512 MBytes or more. All contents on the USB media will be erased without warning.


If you cannot boot to your Windows installation, you need a second working Windows 8/8.1 PC where you can make such USB Recovery media.


Alternately, you can download Windows 8.1 setup ISO file from Microsoft, http://www.eightforums.com/tutorials/18309-windows-8-windows-8-1-iso-download-create.html
then make a bootable UEFI setup media from which you can run the recovery environment: http://www.eightforums.com/tutorials/15458-uefi-bootable-usb-flash-drive-create-windows.html


You can also copy the files from your installation DVD media, your Windows Recovery partition, or download the ISO media from a torrent (look for MSDN media for "Windows 8.1 with Update").


You may try to boot from ISO DVD media then select Recovery at the Setup screen, but it would be much faster to use bootable USB disk. Plus, you can modify your WinRE WIM image to include the response file provided in step 5 on your USB Recovery Media; more details at
Customize Windows RE)
 

My Computer

System One

  • OS
    Windows 8.1
    Computer type
    PC/Desktop
    CPU
    Core i5-2500K
    Motherboard
    ASRock Z68 Extreme4 Gen3
    Memory
    16 GB Kingston HyperX Genesis KHX1600C9D3
    Graphics Card(s)
    MSI R9 290X GAMING 4G
    Monitor(s) Displays
    Samsung S27A950D
    Screen Resolution
    1920x1080
    Hard Drives
    Samsung 840 Pro 256 GB
    WD Caviar Black 4 TB
    WD Caviar Green 3 TB
    PSU
    Thermaltake Toughpower Grand 850
    Case
    Thermaltake V9 BlacX Edition
    Cooling
    Thermaltake BigTyp 120
    Keyboard
    Microsoft Natural Ergonomic Keyboard 4000
    Mouse
    A4 X7 XL-755BK
2. Prepare Partition Wizard Bootable CD


You need to convert your system disk to GPT and resize the Windows partition to make room for system partitions. You cannot convert the system disk while the system is running, so you need an offline disk partitioning tool.


Unfortunately built-in Windows DiskPart utility can only convert empty disks with no volumes and it cannot expand volumes at the beginning of the disk, so you need a third-party tool which supports non-destructive partition more/resize and can convert a MBR disk to a GPT disk.


You can download MiniTool Partition Mizard Bootable CD from
Partition Wizard Bootable CD allows user to manage partition directly with partition manager bootable CD.


Burn the ISO image to a Mini CD-RW or prepare a bootable USB media if you wish, though you would only need to run this tool once.
 

My Computer

System One

  • OS
    Windows 8.1
    Computer type
    PC/Desktop
    CPU
    Core i5-2500K
    Motherboard
    ASRock Z68 Extreme4 Gen3
    Memory
    16 GB Kingston HyperX Genesis KHX1600C9D3
    Graphics Card(s)
    MSI R9 290X GAMING 4G
    Monitor(s) Displays
    Samsung S27A950D
    Screen Resolution
    1920x1080
    Hard Drives
    Samsung 840 Pro 256 GB
    WD Caviar Black 4 TB
    WD Caviar Green 3 TB
    PSU
    Thermaltake Toughpower Grand 850
    Case
    Thermaltake V9 BlacX Edition
    Cooling
    Thermaltake BigTyp 120
    Keyboard
    Microsoft Natural Ergonomic Keyboard 4000
    Mouse
    A4 X7 XL-755BK
3. Resize the primary Windows partition


Boot from Partition Wizard media and run the Partition Wizard.


Delete the 100 MB system partition (be careful not to delete your primary Windows partition here!). If you still have a 350 Mbyte Vista/7 recovery partition at the end of the disk, you can delete it too.


Then resize your primary Windows partition (drive C:) to have at least 529 MBytes of unallocated space before the start. This space is needed to hold Win RE, EFI boot and MSR partitions which take 1 + 300 + 100 + 128 MBytes.


NB: if by any chance your bootable disk is a hard disk drive with native 4K sectors (a.k.a. Advanced Format 4Kn), and not Advanced Format 512e (i.e. emulation of 512 byte sectors) which is the abundant format for currently available 3 and 4 TB hard disks (as of 2014), then your EFI partition has to be 260 Mbytes (because of FAT32 minimum size limit of 65535 clusters), and so you need to reserve at least 689 Mbytes.


Finally, convert your bootable hard disk from MBR to GPT partition type (even though UEFI specification allows booting from MBR disks, the practice is not consistent and GPT format offers some advantages anyway).


Click "Apply" to commit the changes and wait for the Partition Wizard to finish.
 
Last edited:

My Computer

System One

  • OS
    Windows 8.1
    Computer type
    PC/Desktop
    CPU
    Core i5-2500K
    Motherboard
    ASRock Z68 Extreme4 Gen3
    Memory
    16 GB Kingston HyperX Genesis KHX1600C9D3
    Graphics Card(s)
    MSI R9 290X GAMING 4G
    Monitor(s) Displays
    Samsung S27A950D
    Screen Resolution
    1920x1080
    Hard Drives
    Samsung 840 Pro 256 GB
    WD Caviar Black 4 TB
    WD Caviar Green 3 TB
    PSU
    Thermaltake Toughpower Grand 850
    Case
    Thermaltake V9 BlacX Edition
    Cooling
    Thermaltake BigTyp 120
    Keyboard
    Microsoft Natural Ergonomic Keyboard 4000
    Mouse
    A4 X7 XL-755BK
4. Boot to Windows Recovery media


Restart again and boot the USB Recovery Media prepared in step 1.

Select

Diagnose, Advanced, Command Prompt​


If you are recovering your existing system boot partition, you will be asked for your password, and your command prompt will read C:\

If you have no valid BCD store yet, you will boot into WinRE command prompt which will read X:\ and your drive C: will also be available. I will use X:\ to indicate WinRE command prompt.
 

My Computer

System One

  • OS
    Windows 8.1
    Computer type
    PC/Desktop
    CPU
    Core i5-2500K
    Motherboard
    ASRock Z68 Extreme4 Gen3
    Memory
    16 GB Kingston HyperX Genesis KHX1600C9D3
    Graphics Card(s)
    MSI R9 290X GAMING 4G
    Monitor(s) Displays
    Samsung S27A950D
    Screen Resolution
    1920x1080
    Hard Drives
    Samsung 840 Pro 256 GB
    WD Caviar Black 4 TB
    WD Caviar Green 3 TB
    PSU
    Thermaltake Toughpower Grand 850
    Case
    Thermaltake V9 BlacX Edition
    Cooling
    Thermaltake BigTyp 120
    Keyboard
    Microsoft Natural Ergonomic Keyboard 4000
    Mouse
    A4 X7 XL-755BK
5. Create the three system partitions


First you have to identify your bootable disk drive, which should now have at least 529 MBytes (or 689 Mbytes for 4Kn disks) of unallocated space at the start followed by your primary Windows partition, and select it:
X:\ DiskPart
DISKPART> list disk
DISKPART> select disk 0​


Substitute 0 for the disk number of your actual Windows boot disk if it's different. Your boot disk can be connected to any SATA port, so it can have any disk number, and you can even install multiple versions of Windows on separate data partitions.



Only one single disk in the system should have a EFI system partition where a Windows Boot Manager and Boot Configuration Data (BCD) store (and/or any other boot managers and their data) reside within the \EFI folder. UEFI boot managers for other operating systems are not covered here.


Enter the following commands in the command prompt to prepare the partitions (if you are typing, you can ignore comments which are denoted by the rem command):


Code:
rem == bootpart.txt   ==
rem * i) Windows RE (Recovery Environment) partition *
create partition primary size=300 offset=1024
format quick fs=ntfs label="Windows RE Tools"
set id=de94bba4-06d1-4d40-a16a-bfd50179d6ac
gpt attributes=0x8000000000000001
assign letter=R
rem
rem * ii) EFI System partition (ESP) *
create partition efi size=100 offset=308224
rem    ** size=260 for Advanced Format 4Kn drives  ** 
format quick fs=fat32 label=System
assign letter=S
rem
rem * iii) Microsoft Reserved (MSR) partition *
create partition msr size=128 offset=410624
rem    ** offset=574464 for Advanced Format 4Kn drives  ** 
rem == bootpart.txt   ==


There are quite a few weird alphanumeric constants to type, so you will probably need to print out this list. Alternately you can save these commands in a .TXT file - either on your drive C:, on another USB stick, or integrate to your Recovery USB boot media as outlined in step 1, - then run the script in the response file with
DiskPart /S X:\bootpart.txt​


NB. Advanced Format 4Kn disks require a 260 MB system partition as outlined above in step 3.


GPT attributes for the Recovery Environment partition are set to "platform required" and "no drive letter" - this prohibit any changes from within Disk Management snap-in and Windows Explorer.


You can also set the partition id and GPT attributes at step 8 and skip it here.


Note that the offset parameter (specified in kilobytes here) is needed if you have large unallocated space somewhere on the disk, like overprovisioning for a SSD drive, or a deleted recovery partition. DiskPart tends to use the largest available unallocated block, so it might use other free space and not the space at the start of the disk that you preserved in step 3. If you have no reserved free space, the offset parameter can be probably omitted.


More info:
Configure UEFI/GPT-Based Hard Drive Partitions
Sample: Configure UEFI/GPT-Based Hard Drive Partitions by Using Windows PE and DiskPart
 
Last edited:

My Computer

System One

  • OS
    Windows 8.1
    Computer type
    PC/Desktop
    CPU
    Core i5-2500K
    Motherboard
    ASRock Z68 Extreme4 Gen3
    Memory
    16 GB Kingston HyperX Genesis KHX1600C9D3
    Graphics Card(s)
    MSI R9 290X GAMING 4G
    Monitor(s) Displays
    Samsung S27A950D
    Screen Resolution
    1920x1080
    Hard Drives
    Samsung 840 Pro 256 GB
    WD Caviar Black 4 TB
    WD Caviar Green 3 TB
    PSU
    Thermaltake Toughpower Grand 850
    Case
    Thermaltake V9 BlacX Edition
    Cooling
    Thermaltake BigTyp 120
    Keyboard
    Microsoft Natural Ergonomic Keyboard 4000
    Mouse
    A4 X7 XL-755BK
6. Verify the partitions


Your four partitions on the boot disk should look exactly like this now:


Code:
DISKPART> list partition

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    Recovery           300 MB  1024 KB
  Partition 2    System             100 MB   301 MB
* Partition 3    Reserved           128 MB   401 MB
  Partition 4    Primary            XXX GB   529 MB


Asterisk (*) denotes currently selected partition. Select the EFI system partition and verify its attributes:


Code:
DISKPART> select partition 2
DISKPART> detail partition


Partition 2
Type    : c12a7328-f81f-11d2-ba4b-00a0c93ec93b
Hidden  : Yes
Required: No
Attrib  : 0X8000000000000000
Offset in Bytes: 315621376

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
* Volume 4     S  SYSTEM       FAT32  Partition     100 MB  Healthy    System


If something is missing, you will have to delete the system partition

DISKPART> delete partition override​


and re-create it again as specified in step 5.ii.

Exit DiskPart and return to command prompt:

DISKPART> exit
X:\​
 
Last edited:

My Computer

System One

  • OS
    Windows 8.1
    Computer type
    PC/Desktop
    CPU
    Core i5-2500K
    Motherboard
    ASRock Z68 Extreme4 Gen3
    Memory
    16 GB Kingston HyperX Genesis KHX1600C9D3
    Graphics Card(s)
    MSI R9 290X GAMING 4G
    Monitor(s) Displays
    Samsung S27A950D
    Screen Resolution
    1920x1080
    Hard Drives
    Samsung 840 Pro 256 GB
    WD Caviar Black 4 TB
    WD Caviar Green 3 TB
    PSU
    Thermaltake Toughpower Grand 850
    Case
    Thermaltake V9 BlacX Edition
    Cooling
    Thermaltake BigTyp 120
    Keyboard
    Microsoft Natural Ergonomic Keyboard 4000
    Mouse
    A4 X7 XL-755BK
7. Make system partition bootable


Run BCDBoot tool to rebuild a new BCD store, copy EFI Boot Manager and OS loader files to drive S: and configure Windows Boot Manager settings in the UEFI BIOS. If you are repairing the ESP partition, you might want to make a backup copy of the existing BCD store first:
X:\ xcopy S:\EFI\Microsoft\Boot\BCD S:\EFI\Microsoft\Boot\BCD.copy01.
X:\ BCDBoot C:\Windows /l en-US /s S: /f ALL​


To list available boot locales, run
X:\ dir /ad S:\EFI\Microsoft\Boot​


You can then run BCDBoot command again but this time substitute "en-US" with your preferred locale to be displayed at boot time.


You can also copy WinRE image now, as outlined in step 8 below.


Close the command prompt window or type "exit", then click Continue to boot Windows 8/8.1 and leave Windows Recovery Environment.


You should have a fully working bootable Windows 8/8.1 installation by now.

More info:
BCDboot Command-Line Options
 
Last edited:

My Computer

System One

  • OS
    Windows 8.1
    Computer type
    PC/Desktop
    CPU
    Core i5-2500K
    Motherboard
    ASRock Z68 Extreme4 Gen3
    Memory
    16 GB Kingston HyperX Genesis KHX1600C9D3
    Graphics Card(s)
    MSI R9 290X GAMING 4G
    Monitor(s) Displays
    Samsung S27A950D
    Screen Resolution
    1920x1080
    Hard Drives
    Samsung 840 Pro 256 GB
    WD Caviar Black 4 TB
    WD Caviar Green 3 TB
    PSU
    Thermaltake Toughpower Grand 850
    Case
    Thermaltake V9 BlacX Edition
    Cooling
    Thermaltake BigTyp 120
    Keyboard
    Microsoft Natural Ergonomic Keyboard 4000
    Mouse
    A4 X7 XL-755BK
8. Finalize WinRE partition


Boot Windows and open command prompt (cmd.exe) in administrator mode: press Win key to open Start scren, type CMD, then right click Command Prompt and select Run as Administrator.


In the first command prompt windows, run DiskPart to assign a drive letter to the WinRE partition on your boot disk (using the disk number obtained on step 5):
C:\ DiskPart
DISKPART> select disk 0
DISKPART> select partition 1
DISKPART> assign letter=R​


Open the second command prompt window to copy the system WinRE image to the WinRE partition, if not done already,
md R:\Recovery\WindowsRE
xcopy /h C:\Windows\System32\Recovery\Winre.wim R:\Recovery\WindowsRE​


and enable WinRE image:
reagentc /setreimage /path R:\Recovery\WindowsRE /target C:\Windows
reagentc /enable​


Return to the first "Administrator:Command prompt - DiskPart" window to remove the drive letter assignment:
DISKPART> remove
DISKPART> exit​


More info:
System image backup fails after you upgrade to Windows 8.1 or Windows Server 2012 R2
REAgentC Command-Line Options
 
Last edited:

My Computer

System One

  • OS
    Windows 8.1
    Computer type
    PC/Desktop
    CPU
    Core i5-2500K
    Motherboard
    ASRock Z68 Extreme4 Gen3
    Memory
    16 GB Kingston HyperX Genesis KHX1600C9D3
    Graphics Card(s)
    MSI R9 290X GAMING 4G
    Monitor(s) Displays
    Samsung S27A950D
    Screen Resolution
    1920x1080
    Hard Drives
    Samsung 840 Pro 256 GB
    WD Caviar Black 4 TB
    WD Caviar Green 3 TB
    PSU
    Thermaltake Toughpower Grand 850
    Case
    Thermaltake V9 BlacX Edition
    Cooling
    Thermaltake BigTyp 120
    Keyboard
    Microsoft Natural Ergonomic Keyboard 4000
    Mouse
    A4 X7 XL-755BK
9. Enable Secure Boot


At this point you can only enter UEFI BIOS by restarting Windows directly to UEFI Firmware:


Settings, Advanced Startup, Update and recovery, Recovery, Restart Now.​


When WinRE starts, select

Troubleshooting, Boot to UEFI Firmware.​


Once in UEFI BIOS, select Security tab and click Secure Boot: Enable, then click Install Default Secure Boot keys. This will offer protection from rootkits that try to install themselves to the bootloader.


All done!


The BCDBoot /f ALL command at configured the necessary UEFI BIOS settings by adding "Windows Boot Manager" to the list of bootable hard disk drives and enabled Ultra Fast Boot, which skips USB media check and UEFI BIOS hotkeys and goes directly to Windows boot. You may optionally disable Ultra fast boot and select Fast boot, so you can still enter UEFI BIOS at boot time by pressing Del or F2. (Options are valid for ASRock UEFI motherboards, your mileage may be different).
 

My Computer

System One

  • OS
    Windows 8.1
    Computer type
    PC/Desktop
    CPU
    Core i5-2500K
    Motherboard
    ASRock Z68 Extreme4 Gen3
    Memory
    16 GB Kingston HyperX Genesis KHX1600C9D3
    Graphics Card(s)
    MSI R9 290X GAMING 4G
    Monitor(s) Displays
    Samsung S27A950D
    Screen Resolution
    1920x1080
    Hard Drives
    Samsung 840 Pro 256 GB
    WD Caviar Black 4 TB
    WD Caviar Green 3 TB
    PSU
    Thermaltake Toughpower Grand 850
    Case
    Thermaltake V9 BlacX Edition
    Cooling
    Thermaltake BigTyp 120
    Keyboard
    Microsoft Natural Ergonomic Keyboard 4000
    Mouse
    A4 X7 XL-755BK
Comments and suggestions are welcome!
 

My Computer

System One

  • OS
    Windows 8.1
    Computer type
    PC/Desktop
    CPU
    Core i5-2500K
    Motherboard
    ASRock Z68 Extreme4 Gen3
    Memory
    16 GB Kingston HyperX Genesis KHX1600C9D3
    Graphics Card(s)
    MSI R9 290X GAMING 4G
    Monitor(s) Displays
    Samsung S27A950D
    Screen Resolution
    1920x1080
    Hard Drives
    Samsung 840 Pro 256 GB
    WD Caviar Black 4 TB
    WD Caviar Green 3 TB
    PSU
    Thermaltake Toughpower Grand 850
    Case
    Thermaltake V9 BlacX Edition
    Cooling
    Thermaltake BigTyp 120
    Keyboard
    Microsoft Natural Ergonomic Keyboard 4000
    Mouse
    A4 X7 XL-755BK
Dmitry, this is a very excellent tutorial (I am a technical writer; it is well written.) I would like to ask for your assistance. I am quite technically capable (have been troubleshooting since DOS/Win3, and once hacked and restored a Win2000 machine that had all user accounts deleted; including the admin account, with pure ingenuity...) -- Well, now I have not been 100% up on UEFI/ESP partitions and boot architecture. I have a 'primary' 1 TB disk that BSOD with inaccessible_boot_device, for no apparent reason. I am using a cloned backup (.5TB) disc in my system now, and using whatever tools I can find to repair the primary drive. Using Active@ tools, I can see that the drive, and all partitions and file systems read intact and healthy, except for the ESP. For that, So I copied the healthy 300mb ESP partition from the operational backup drive to the failed primary drive, and got past the inaccessible_boot_device message. However, I still have some issues; not getting to boot up. From this point, I'm guessing at what to do, I have full access to the drive (via USB) and any tools. Describing everything I did/tried/observed etc would take a long time. Would you be willing to connect via Teamviewer and help me fix the issue? We can use Teamviewer on the main/repair system and you can have remote control. and I can use a separate system to stay connected and with video, you can watch the screen/results as I go off-line with the repair system as I swap out the drives. Please write {my Forum ID}@usa.net. Thanks, Steve
 

My Computer

System One

  • OS
    8.1
    Computer type
    Laptop
    System Manufacturer/Model
    Acer Aspire V7
Hi, Dimitry,

This is a good tutorial. I used Paragon Partition Manager to convert my Win 8.1 MBR partition to GPT. Windows then stopped booting, could not find the boot loader. I can see the disk, partition, and even files, but it appears that the problem is that in the process, the new EFI partition got marked as "hidden."

How can I "unhide" the converted EFI partition so my system can find the boot loader?

Thanks,
 

My Computer

System One

  • OS
    Windows 8
Back
Top