10

Long story short, I have an external USB hard drive formatted using a MBR partition table, and I want to install Ubuntu in UEFI mode in a ~23.40 GB unallocated space before a ~442.33 GB NTFS partition that I need to keep:

screenshot

To install Ubuntu in UEFI mode I need the partition table of the drive to be formatted as gpt.

I don't think there's an easy / direct way to convert a MBR partition table to a gpt partition table, so I'm also looking for the complicated / indirect way.

For example I think something can be done by noting down the NTFS partition start, writing the new partition table and adding the NTFS partition to the new partition table, but I've never done this and I have no idea where to start; furthermore I don't wish to try this for the first time in this case, since I'm not really confident with this stuff and I can't afford losing the NTFS partition I need to keep.

1

1 Answer 1

18

There actually is an easy way to do it: Run gdisk on the disk and then type w to save the changes (which, if you do nothing else, consist of converting from MBR to GPT, which gdisk does automatically). That said, there are a few caveats:

  • If the disk is bootable, it will cease to be bootable after the conversion. Bootability can often be restored by installing a suitable boot loader. NTFS implies Windows, which would mean a conversion from BIOS-mode to EFI-mode booting. Making this change is possible, but is a bit tedious. Here is one page that describes how to do it. If the disk is strictly a data (non-boot) disk, then this issue isn't important for you.
  • If the final partition on the disk ends too close to the end of the disk, it may need to be shrunk by a small amount -- just a few sectors, normally, although many tools will require rounding to 1MiB units, so you may lose 1MiB or so. GParted often ignores tiny gaps like this, so it's unclear from your screen shot if you'd need to do this.
  • If the first partition begins too close to the start of the disk, its start point may need to be moved. That's obviously not the case for your disk.
  • Some meta-data, like partition type codes, won't be correctly converted. This isn't an issue for your disk.

For more on this subject, see my GPT fdisk documentation on MBR-to-GPT conversions. (Note: I'm the author of gdisk, which is installed by default with recent versions of Ubuntu; so that page can be considered official documentation.)

2
  • Using gdisk worked like a charm (I had to shrink the NTFS partition as you predicted); thanks for the very thorough answer (and for such an useful utility!)
    – kos
    Sep 14, 2015 at 11:31
  • 1
    On a side note, I got this message after having issued w: "Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!!". I guess this applies only to the first / last partition in case they start / end too close to the start / end of the disk. From my user perspective I felt like the NTFS partition entry was going to be deleted, I went ahead only because you (the author) said it was ok to do so. I don't know if this is intended or not, however I'm leaving my user perspective's feedback in case you want to and can improve this. Great utility tough.
    – kos
    Sep 14, 2015 at 11:31

You must log in to answer this question.

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