Score:0

Convert exixting Ubuntu 20.04 disk to UEFI

th flag

I use Ubuntu 20.04 as my only system in my laptop. Ubuntu resides on an SSD disk booting in legacy mode (i.e. BIOS, or MBR mode).
I have now bought a new laptop with Windows 10 pre-installed which of course boots in UEFI mode.
Since my new laptop has a slot for a second SATA disk, I want to keep the Windows 10 system and exploit the second slot to boot my old SSD Ubuntu disk from there, thus having a dual boot laptop.
I tried different configurations with the BIOS in my new PC but could not boot Ubuntu in legacy mode, even if it is supposed to do so.
Reading in help.ubuntu.com and here in askubuntu, I could only find a statement in which it says that the two systems must have the same booting mode.
I am not quite sure if this is my real problem, but I would like to give it a try, so I need to convert my Ubuntu disk to UEFI. Instructions are quite vague (they always suppose a fresh install), so I would like to know if it is possible to make my disk a UEFI disk without losing the possibility to boot back to my old laptop in legacy mode, and what is more important, without breaking my system (I have upgraded it through time from 16.04 and through different laptops, always managing to keep my installation safe).

Organic Marble avatar
us flag
Does this answer your question? [Convert MBR partition to GPT without data loss](https://askubuntu.com/questions/1314111/convert-mbr-partition-to-gpt-without-data-loss)
karel avatar
sa flag
Does this answer your question? [In a dual boot system, how does the BIOS choose which bootloader to run?](https://askubuntu.com/questions/981382/in-a-dual-boot-system-how-does-the-bios-choose-which-bootloader-to-run)
Score:1
cc flag

Contrary to popular belief, there's nothing in a legacy install of Ubuntu that wont boot/run in UEFI mode. No "conversions" necessary. You probably should do a few things like:

  1. Add the /boot/efi mount point for the EFI (so any future updates of grub/shim will work).
  2. Add the fstab line to mount /boot/efi (totally non-critical to running).
  3. Change grub-pc to grub-efi so the grub.cfg which gets created will also boot Windows in UEFI mode. That's right, the legacy grub.cfg will still boot Ubuntu just fine.

I did such a legacy SSD to UEFI, setting up an EFI partition on the ssd, but my case was the first disk was still legacy. The same mode installation is necessary if you want to boot both Windows and Ubuntu from grub (because the mode decision has already been made by the time grub runs). I default to my UEFI ssd, and boot the hard disk via the EFI boot menu selection if I want to run Windows (or a legacy Ubuntu) off the first disk.


See https://help.ubuntu.com/community/UEFI for all the usual requirements on an EFI partition (ESP). (primary, FAT32, boot flag).

The choice you have to make is whether to use the primary disk's ESP or make a new ESP on the sdd. grubx64.efi + shimx64.efi take less than 6MB, so even if you double that for copies in .../EFI/Boot, you can fit the Ubuntu bootloaders into 12MB of free space. The drawback to using the first disk's ESP is that grub is now split across the two disks, and needs both to boot. Not really an issue if you don't plan on removing the SDD.

If you do plan on removing the SDD, expect the first disk to stil boot Windows, and maybe the removed SDD to boot on another machine, you should put an ESP on the SDD (100-200MB, FAT, boot flag, etc.). With the SDD first boot order, it will boot grub, which will boot either Ubuntu or Windows. Without the SDD, your laptop should just boot Windows (no grub).

th flag
But should I make a separate partition for the /boot/efi directory? Should it be primary or logical? Should it be Fat32? And should I flag it as bootable as well as the Ubuntu main partition?
oldfred avatar
cn flag
If doing new install, Ubuntu's Ubiquity only installs grub to first drive's ESP - efi system partition. So you can use the Windows ESP as long as you do not want to use drive on any other UEFI system. UEFI also highly suggests gpt partitioning and you can convert. But then you have to update all fstab UUID & total reinstall of grub. You can boot in BIOS or UEFI mode from gpt, but need bios_grub partition for BIOS or ESP for UEFI boot. Having both BIOS & UEFI versions of grub will work, but updates may get them out of sync, but then you just need an update in other boot mode.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.