Convert MBR to GPT
Instructons for Windows users
- Clone the disk in order to have backup data. You can skip this step but if somethings goes wrong the data on the disk may be lost
- Identify the disk which will be converted. Open Windows Disk Management and look the number (e.g. Disk 0).
- Download gptgen from sourceforge http://sourceforge.net/projects/gptgen This tool will allow you to convert the paritition table without loosing any data
- Unzip and start gptgen under elevated CMD (via Run as Administrator)
gptgen.exe -w \\.\physicaldriveX
Replace physicaldriveX with the disk number (e.g. physicaldrive0)
- Open elevated CMD and run
diskpart
list volume
select volume
and choose the number of the corresponding volume (e.g. 0)shrink
exit
- Rerun gptgen
Instructions for Linux
- Boot and open terminal. You need parted installed
- Make backup of the existing MBR partition table:
parted /dev/sda unit s print > partition_table.txt
If you are converting the disk with the operating system you are currently running copy the partition_table.txt file to USB drive or upload it to internet, so you can access it later if something goes wrong. - Create new GPT partition table overriding the existing MBR table
mktable gpt
When asked choose to ignore the warnings and to continue (with overwriting). We will recreate the existing partitions on exact sectors they have been before, but with new partition table format. - Recrete partitions by using the information from partition_table.txt file and commands
unit s mkpart
When asked fill the partition type (e.g. ext4) and partition starting/ending sector (see partition_table.txt) - Optionally set the legacy boot flag to the corresponding partition number.
set 1 legacy_boot on
- Print the partition table and compare it with the partition_table.txt file
print
Convert BIOS bootable to UEFI bootable for GPT partitioned disk
Since it is difficult to do the conversion while running the operating system I suggest you download a Fedora live CD and create bootable USB drive, so you can boot from it. Make sure that the USB is UEFI bootable - this means when you write it with rufus, choose GPT partition table and FAT32 system. If you plan to convert Windows to UEFI, then you need also a Windows installation DVD or USB. Then change the boot type in BIOS from Legacy BIOS to UEFI - see docs from your commputer manifacturer how to do it.In order for UEFI to work you need a new partition with type C12A7328-F81F-11D2-BA4B-00A0C93EC93B - EFI System Partition (ESP). The new partition should be formatted with FAT32 system. The partition should be the first one. It will contain the files required to boot the operating system(s).
Windows
In GPT Windows needs additional partition called Microsoft Reserved Partition (MSR). In standard MBR partition scheme Windows used hidden sectors to store system data, but GPT doesn't allow hidden sectors, so MSR partition is used instead. It should not be formatted with any file system, because its sectors will be used directly by the operating system. The partition type should be E3C9E316-0B5C-4DB8-817D-F92DF00215AE.How to create the ESP and MSR under Windows
This guide is adapted from Technet article- Boot from Windows installation DVD or USB
- Choose repair and open command prompt
- Start diskpart
- Select the disk where the ESR and MSR partitions will be created
list disk select disk X
Replace X with the disk number (e.g. 0) - Usually you have one small bootable partition used to boot Windows. We are going to delete it and use the space to create a new ESR and MSR
list partition select partition 1 delete partition
- Now create ESR
create partition EFI size=100 offset=1 format quick fs=fat32 label="System" assign letter=S
- Now create MSR
create partition msr size=128 offset=103424
- Find out the windows installation drive letter.
list volume
You can also reassign it if needed (Usually it should be C:)select volume 3 assign letter=C
- Exit disk part
exit
- Generate boot partiton data
bcdboot c:\windows /s s: /f UEFI
Replace C: with your Windows installation letter