I recently have upgraded my PC, my new Motherboard (ASUS M5A99X EVO) uses UEFi instead of the regular MBR option.

I have a Ubuntu 11.10 installation that I did when I had my previous hardware (MSI MS 7267) , Ubuntu alone boots fine, and so does Windows 7, however Windows 7 is using UEFI (GPT) boot whereas Ubuntu is using MBR.

I have my OSs in separate drives, so that GRUB2 wont' get replaced by the Windows Bootloader and viceversa, as I said both OSs boot fine on their own, but to do that I have to disconnect one drive in this case the Ubuntu drive as it prevents Windows from loading.

Now my question is, How can I change/convert Ubuntu's drive so that instead of using MBR it uses GPT and allow Windows to boot?.

Preferably without reinstalling the whole system or lose any data.

And if I were to wipe the drive, How can I install Ubuntu in GPT, UEFI, whatever it is mode?.

I have used gdisk to convert from MBR to GPT, but now Ubuntu can't boot seems like grub just doesn't start.

I have re installed the OS, and the drive is GPT now by default however grup-pc is still being used instead of grub-efi.

How can i make Ubuntu boot from EFI?.


4 Answers 4


Table of contents:

  1. Terminology
  2. Converting
  3. Configuring (+ Dual boot)


BIOS = Basic Input/Output System

(U)EFI = (Unified) Extensible Firmware Interface

MBR = Master Boot Record

GPT = GUID Partition Table

UEFI / EFI / BIOS = Firmware interface

MBR / GPT = How the computer knows (per hard disk) what partitions are on the drive and how to boot from them.


A firmware interface is the way that the firmware (the software inside devices) and operating system interact. It initialises the hardware then runs the operating system and ensures that the operating system drivers can operate the hardware.

The BIOS has been the usual firmware interface that has been used. The UEFI is a newer interface that has several features, such as being faster, having a GUI and being able to start the network card and get an ip address. UEFI replaces EFI. (Those developing EFI saw that there were others doing something similar and so joined them, bringing the ideas of EFI with them. This then became UEFI).

A BIOS requires the bootloader to be at the start of the disk, however a UEFI uses a partition for this and can choose among multiple boot loaders to use.


The MBR is a section of code at the start of the disk that contains a boot loader (for the BIOS), as well as the partition map and a unique disk identifier.

To install GRUB onto a disk with a MBR, GRUB places a small program in the MBR to load the rest of GRUB from another part of the disk. (This is done because the MBR is too small to contain all of GRUB). The space that is chosen is space between the MBR and the first partition, which usually exists.

GPT is a standard for how the partitons are specified. It does have a 'protective' MBR, however this is only for allowing BIOS based computers to boot and stop tools that only know about MBR from trying to trash GPT. It can have

(How GPT is handled depends on whether it is booting using a BIOS (or UEFI system in BIOS emulation mode) or UEFI. I will focus on UEFI as it relates to the question).

Boot loaders for operating systems are stored in a partion called EFI System Partiton, that is formatted (usually) with FAT32. This is where GRUB is installed.



We are playing around with the partition table, so guaranteed safety is not possible. It is a risky operation. However, the method should not lose data.

Others coming across this: Do not use on Apple Macs.


You will need to do this on a live CD (or another linux installation installed to a different disk.)

When dealing with GPT disks, we need to use a GPT aware program. 'GPT fdisk' is a good tool to use and what I will be using. It can be called gptfdisk or gdisk depending on distribution (Ubuntu calles it gdisk). Parted (and Gparted) is also GPT aware, so can 'safely' be used with GPT disks.

To convert you need to:

  1. Resize partitions to fit GPT data and EFI system partition.
  2. Convert the disk and add partitions
  3. Install GRUB to EFI system partition.

1) Resize partition

Use parted (command line) or gparted (GUI) to resize the first and last partition. The first partion should have about 200MiB before it, and the last partition should have 1MiB to 2MiB (either will do) taken off the end.

2) Convert the disk


gdisk /dev/sdx

changing the device you want to convert is /dev/sdx.

It should tell you that it will convert the partiton table.

GPT fdisk (gdisk) version 0.6.14

Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: not present

Found invalid GPT and valid MBR; converting MBR to GPT format.
you don't want to convert your MBR partitions to GPT format!

Command (? for help): 

Now add a new partition, making it of type 'EFI system'. It should find the free space at the beginning (I suggest some low sector number like 34) and automatically use all the free space. The examples use a 4GB USB flash drive with 1 partition already on there, resized as per above.

Command (? for help): n
Partition number (2-128, default 2): 2
First sector (34-7831518, default = 34) or {+-}size{KMGTP}: 
Information: Moved requested sector from 34 to 2048 in
order to align on 2048-sector boundaries.
Use 'l' on the experts' menu to adjust alignment
Last sector (2048-421887, default = 421887) or {+-}size{KMGTP}: 
Current type is 'Linux/Windows data'
Hex code or GUID (L to show codes, Enter = 0700): L
0700 Linux/Windows data    0c01 Microsoft reserved    2700 Windows RE          
4200 Windows LDM data      4201 Windows LDM metadata  7501 IBM GPFS            
7f00 ChromeOS kernel       7f01 ChromeOS root         7f02 ChromeOS reserved   
8200 Linux swap            8301 Linux reserved        8e00 Linux LVM           
a500 FreeBSD disklabel     a501 FreeBSD boot          a502 FreeBSD swap        
a503 FreeBSD UFS           a504 FreeBSD ZFS           a505 FreeBSD Vinum/RAID  
a800 Apple UFS             a901 NetBSD swap           a902 NetBSD FFS          
a903 NetBSD LFS            a904 NetBSD concatenated   a905 NetBSD encrypted    
a906 NetBSD RAID           ab00 Apple boot            af00 Apple HFS/HFS+      
af01 Apple RAID            af02 Apple RAID offline    af03 Apple label         
af04 AppleTV recovery      be00 Solaris boot          bf00 Solaris root        
bf01 Solaris /usr & Mac Z  bf02 Solaris swap          bf03 Solaris backup      
bf04 Solaris /var          bf05 Solaris /home         bf06 Solaris alternate se
bf07 Solaris Reserved 1    bf08 Solaris Reserved 2    bf09 Solaris Reserved 3  
bf0a Solaris Reserved 4    bf0b Solaris Reserved 5    c001 HP-UX data          
c002 HP-UX service         ef00 EFI System            ef01 MBR partition scheme
ef02 BIOS boot partition   fd00 Linux RAID            
Hex code or GUID (L to show codes, Enter = 0700): ef00
Changed type of partition to 'EFI System'

You should now have the EFI partition.

Command (? for help): p
Disk /dev/sdd: 7831552 sectors, 3.7 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 669247F2-37F7-4797-98F9-9CE56F7EA8C8
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 7831518
Partitions will be aligned on 2048-sector boundaries
Total free space is 4029 sectors (2.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1          421888         7829503   3.5 GiB     0700  Linux/Windows data
   2            2048          421887   205.0 MiB   EF00  EFI System

Then exit gdisk

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING

Do you want to proceed, possibly destroying your data? (Y/N): y
OK; writing new GUID partition table (GPT).
The operation has completed successfully.

Now use Gparted (or command-line mkfs.vfat -F 32 /dev/partition) to format the partition as FAT32.

3) Install GRUB

This comes with less assurances that the previous part as I have not tried it myself.

I am not sure about this step, so I'll guess using RAOF's instructions:

To switch to grub-efi you'd want to

  1. Find your EFI partition; mount it in /boot/efi. Add this to /etc/fstab¹
  2. Install the grub-efi package
  3. Switch your BIOS boot priority from UEFI and Legacy to UEFI only (or a similar option)

You should work out which version of grub-efi to install with

ioreg -l -p IODeviceTree | grep firmware-abi

If it says EFI32 install the grub-efi-ia32 package, if it says EFI64 install the grub-efi-amd64 package. You can install the packages with

sudo apt-get install <package name>

This will probably only work if you have booted in EFI mode.

If it does not work, you could try these step by step instructions (under "Install GRUB2 in (U)EFI systems") once grub-efi is installed.

Configuring (+ Dual Boot)

If RAOK's instructions work, you should be able to add the following line to /etc/grub.d/40_custom

menuentry "Windows 7" {
        set root='(hd0,gpt1)'
        chainloader /EFI/microsoft/bootmgfw.efi

It assumes that Windows is recognised as hd0 by GRUB. It may need to be changed to hd1 in order to work.

Now run


to update the config file.

References and further reading

I used several sources.

  • WOah, thank you!.. but I'm still stuck in installing grub-efi to the drive, i have reinstalled the OS and made the drive GPT, but its still using grub-pc not grub-efi. Commented Dec 7, 2011 at 17:08
  • If you have the option (as I don't own any UEFI devices I am severely crippled in being able to help) you need to boot the live CD in UEFI mode and not BIOS/MBR mode. Commented Dec 7, 2011 at 23:08
  • How about removing grub-pc and installing grub-efi while in the live cd (before you install maybe?)? Commented Dec 8, 2011 at 5:27
  • 1
    Wow, this worked flawlessly, thank you! I've just migrated a parallel installation of Fedora 25 and Windows 10 from MBR+BIOS to GPT+UEFI without reinstalling anything. I've performed steps 1 and 2 from a Fedora 25 Live USB stick booted with UEFI. For step 3, I used chroot to access my existing system from the Live system as described under wiki.ubuntuusers.de/GRUB_2/Reparatur/#chroot-Methode . I've uninstalled grub2, installed grub2-efi and grub2-efi-modules and explicitly reinstalled shim (without reinstalling shim, the Grub menu would not appear). Finally ... Commented May 14, 2017 at 0:26
  • 2
    For installing GRUB, I just booted a live USB and used boot-repair. askubuntu.com/questions/226061/… Thanks for this post!
    – jbrock
    Commented Jan 7, 2019 at 20:47

This answer is incomplete; I've not tested any of this. It's unlikely to eat any of your data, but you have been warned!

What I would guess is happening here is that your BIOS is preferentially booting from legacy MBR, so poor old UEFI Windows 7 is getting overlooked.

One of the nice things about UEFI is that you should no longer need to worry about Windows overwriting GRUB; they should both coexist nicely on the EFI partition. One option would therefore be to switch to grub-efi. Note: I'm unsure whether grub-efi understands MSDOS-style partitions; I think it does. If it does not, this will fail to boot, and you'll need a LiveCD to recover. In fact, have a LiveCD handy anyway!

To switch to grub-efi you'd want to

  1. Find your EFI partition; mount it in /boot/efi. Add this to /etc/fstab¹
  2. Install the grub-efi package
  3. Switch your BIOS boot priority from UEFI and Legacy to UEFI only (or a similar option)

That should leave you with a UEFI-booting Ubuntu install. If it does not, boot up your trusty LiveCD (or Ubuntu Alternate install CD - the “Fix a broken system” option is what you're after ☺), chroot into your system, and install grub-pc again.

¹: More detail for this step: You'll need to find what the Linux kernel calls your EFI system partition. This will be something like /dev/sda2, /dev/sdb3, or such². You'll then need to make the /boot/efi directory, and add a line to /etc/fstab. If your EFI partition is /dev/sdb3, then you would add the following line:

/dev/sdb3    /boot/efi    vfat    defaults    0    1

Once you run sudo mount /boot/efi you should then find that /boot/efi contains a EFI directory, with a subdirectory for Windows 7.

²: Since you've got multiple hard drives it might be a good idea to find out the UUID of the partition, as that will be stable under addition/removal of harddrives whereas the /dev/sda2 name is not guaranteed not to change. This can be done after you've finished setting everything else up, though.

You can find the UUID by looking in /dev/disk/by-uuid. For example, I get:

$ ls /dev/disk/by-uuid -lah
total 0
drwxr-xr-x 2 root root 100 Dec  5 09:12 .
drwxr-xr-x 6 root root 120 Dec  5 09:12 ..
lrwxrwxrwx 1 root root  10 Dec  5 09:12 27fae347-4c7f-45cb-92d6-5f3d410599a1 -> ../../sda3
lrwxrwxrwx 1 root root  10 Dec  5 09:12 4405-64C8 -> ../../sda1
lrwxrwxrwx 1 root root  10 Dec  5 09:12 5243e250-8da5-4fea-aa63-61466022661d -> ../../dm-0

In my case, I know /dev/sda1 is my EFI system partition, so I have

UUID=4405-64C8  /boot/efi       vfat    defaults        0       1

in my /etc/fstab.

  • If Windows 7 is booting from EFI, then it will have placed its bootloader in the EFI partition - so you must have one ☺. This will not be visible anywhere in the standard Ubuntu filesystem. You'll need to find it with something like the Disk utility program. Until you've found and mounted your EFI partition, grub-efi won't be able to work - it needs to stick its bootloader in the EFI system partition.
    – RAOF
    Commented Dec 4, 2011 at 21:54
  • Still can't boot into Ubuntu, i have added the lines to fstab using a livecd and also created the efi directory in /boot but it doesn't seem to have any effect. Commented Dec 5, 2011 at 0:23
  • Now that you've got the EFI partition mounted, you need to run sudo grub-install and sudo update-grub in order to actually install and set up GRUB on the EFI partition. You'll need to do this after chrooting into your install (because it needs to know things about the install on your hard drive). If you need help doing that I can add details to the answer.
    – RAOF
    Commented Dec 5, 2011 at 0:53
  • Yes please add how to chroot into my install and reinstall grub. Commented Dec 5, 2011 at 1:15
  • I followed the instructions here, but I had a problem with the new EFI partition. When I attempted to install a windows 10 preview, the installer gave this error: "Windows detected that the EFI system partition was formatted as NTFS. format the EFI system partition as FAT32 and restart the installation" I was able to resolve the problem by using the diskpart tool that comes with the windows installer, by deleting the first EFI partition and creating another with create partition efi. For info on diskpart, see technet.microsoft.com/en-us/library/cc766465%28WS.10%29.aspx
    – Pathogen
    Commented Jun 26, 2015 at 5:30

I have my OSs in separate drives, so that GRUB2 wont' get replaced by the Windows Bootloader and viceversa

That's ideal, so you're likely to have at least one primary partition free in the partition table.

Now my question is, How can I change/convert Ubuntu's drive so that instead of using MBR it uses GPT and allow Windows to boot?

You don't have to convert MBR to GPT to do UEFI booting, just create a primary FAT partition, install the grub-efi-amd64-bin package and follow the instructions in Add an ESP to an existing installation with MBR which should work with current releases of Ubuntu.

  • 1
    Under-rated answer. Windows obstinately requires GPT+UEFI or MBR+BIOS boot, but Linux allows mix-and-match and grub can chainload another disk or boot Windows 7's bootmgr directly.
    – Tim G
    Commented Dec 13, 2016 at 2:07
  • @timg This may be true after the fact but unfortunately if you are setting up Windows 10 from scratch it appears the installer won't let you proceed without a GPT volume, if you booted EFI.
    – Merk
    Commented Feb 11, 2017 at 6:26
  • @Merk Oh, I use the Windows installer a different way: Shift-F10 gives you a command line and you can diskpart, dism /apply-image, then bcdboot (more options on both of those of course) to make it install mbr or gpt regardless of how you booted.
    – Tim G
    Commented Feb 15, 2017 at 22:01

To complement Portablejim's answer (which really helped me for converting from MBR to GPT, thanks !), you can use Boot-Repair to reinstall grub. It worked like a charm to repair my boot after I failed to complete step 3, and once again when the installation of Windows 10 made the linux boot option disappear.

  • I have a Ubuntu-only disk and using Boot-Repair as step 3 worked like a charm! Commented Apr 3, 2019 at 21:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .