The Ubuntu installer defaults to a MBR drive setup when a UEFI BIOS isn't detected (such as when the hardware doesn't support EFI/is too old). It still uses LVM as the automatic partition scheme.

In Fedora there's a way to force the installer using a boot flag (inst.gpt) to create a GPT drive with LVM.

There's not currently a way to do this on Ubuntu so how do I convert the MBR drive to GPT with a LVM scheme, post-install? Currently the only documentation I have found (http://www.rodsbooks.com/gdisk/mbr2gpt.html) does not cover LVM setups (encrypted or not).

The setup I am attempting this on is Ubuntu 16.04.6 on a Dell Latitude E6400 (manufactured in 2009, it doesn't have EFI) but this would apply to any non-EFI system where the user wants to use GPT rather than MBR. Currently what happens when I run the installer and choose LVM (encrypted) is that the installer creates the scheme with MBR.

While some of what the answer here says may apply https://askubuntu.com/a/85857/39237 it does not cover LVM (encrypted or not).

Please note the answer I'm looking for doesn't necessarily need to cover encrypted LVM setups (it may not even be possible, but i am not 100% certain on this yet). An answer that covers an unencrypted LVM setup would be okay.

  • I think there is nothing special about LVM, we talk about converting the partition table, this will not change the partitions itself. You'll need a bios_boot partition when using GPT for grub's core.img and of course, you'll have to reinstall grub. I don't have a machine to test it, so I feel not convenient enough to provide an answer. – mook765 Aug 18 '19 at 16:04

All you have to do is remove the old table (which doesn't break filesystems, but does break bootloader), then make a new one, with the same start sectors for all partitions with data (lvm, filesystems, etc.).

You could probably do this in the running system, but you'll get warnings and errors (on redhat distros, gparted is patched/configured to be idiot proof and stop you, but sgdisk and probably gdisk works). You should do it in a LIVE or rescue boot.

  • the new partitions must start exactly on the same sector as the old ones
  • the new partitions must end exactly on the same sector or after the old ones
  • forget about extended partitions... the relevant sector numbers are the primary and logical ones; the rest of the space used by the extended partition will be free
  • ideally you want them in the same order, and with anything boot related to be created with numbers in order starting on 1 and before 2TiB (avoid some problems maybe caused by hardware, firmware, bootloaders)
  • you either need to boot in legacy mode and create a >= 1MiB bios_grub partition with the bios_grub flag on (parted /dev/sdX set 1 bios_grub on), or boot in UEFI mode and create an ESP partition (formatted with mkfs.vfat -F 32 ... and esp flag on: parted /dev/sdX set 1 esp on). Or you can create both and boot either at any time. (I would put bios_grub before ESP, and haven't tested the other way around). This is NOT your /boot partition... it's in addition.
  • due to previous item, prerequisite is that there is enough space left before the partitions you had alrady to add this one. On windows, just shrink the recovery volume, or on linux, shrink and move boot or swap. If that fails, you can clone it to another place, resizing as you clone or when you clone it back.
  • you will need to reinstall the bootloader with grub-install ... (if the distro doesn't figure out the rest automatically, here it is fully grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu --recheck --no-floppy /dev/sdX), or use other EFI things, not grub.
  • I recommend generating a new initramfs... it'll figure out which modules you need, which may have changed... I don't know.
  • and then for special setups, just repeat whatever is necessary to make it work, such as encryption... which may not be the same way as your installer did it. This is just about the bootloader, not the tools and rootfs.

Use gparted or another partitioning tool from the live cd to format the drive and create a GPT partition table, then install Ubuntu. It will keep the existing partition table.

  • This doesn't work because the auto installer simply wipes out anything you set up and creates a MBR+LVM setup – warsong Feb 20 '18 at 9:05
  • 1
    Choose the manual option and partition it yoruself. – psusi Feb 20 '18 at 19:46
  • How much of the process is the same as the non-encrypted-LVM setup? – warsong Aug 18 '19 at 12:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.