I have a linux box (Ubuntu 16.04) whose boot disk is partitioned using MBR. How can I convert it to GPT+UEFI?
Linux UEFI GPT MBR – How to Convert Linux Disk from MBR to GPT with UEFI
gptlinuxmbruefi
gptlinuxmbruefi
I have a linux box (Ubuntu 16.04) whose boot disk is partitioned using MBR. How can I convert it to GPT+UEFI?
Best Answer
Before starting, make sure you have a backup, and make sure to have a linux live boot ready to rescue your system. It's easy to mess this up!
Use gdisk to convert the partition table to GPT.
Create the "BIOS boot" partition that GRUB needs.
Write the new partition table.
Reload the partition table.
Re-install the GRUB boot loader using the new partition scheme.
Optionally reboot to verify it's working. If you just need GPT and not UEFI, you can stop here.
Use gdisk to add an "EFI System" partition (ESP). Officially should be 100-500MB, but mine only used 130kB. Can be anywhere on the disk, so consider putting it at the end if you're using non-resizable media like a physical disk.
Give the ESP a distinctive label without whitespace like
EFI-system
, because we'll reference the partition label in fstab.Write the partition table.
Reload the partition table.
Build the filesystem for the ESP.
Create the ESP mount point.
Add the ESP to
/etc/fstab
. It should look like this:Mount the ESP.
Install EFI package on Ubuntu/Debian.
Install the GRUB EFI bootloader.
Reboot.
Change the BIOS from BIOS boot to UEFI boot.
Use the one-time boot menu to force boot the disk. You may have to navigate to the disk (Boot from file) ->
EFI
->ubuntu
->grubx64.efi
.Re-install GRUB's EFI bootloader to update the UEFI boot selector.
Resources:
gdisk
has a verbose description of MBR, GPT, and UEFI.