How safe is it to convert an MBR disk to GBT?

For reasons I need to convert an MBR disk to GBR. No BIOS, no UEFI or so included, it’s just a data disk.

It’s just one simple partition.
The only thing, which makes me cautious is that it uses LUKS(2)… (see my speculation below)
More partition details here.

How safe is that?

Especially given this error of gdisk:

$ sudo gdisk /dev/disk/by-id/usb-[…]-0:0
GPT fdisk (gdisk) version 1.0.7

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
typing 'q' if you don't want to convert your MBR partitions
to GPT format!

Exact type match not found for type code E800; assigning type code for
'Linux filesystem'

Command (? for help):

I guess the reason for that error is that it does not “know” the type code for the Luks partition:

Exact type match not found for type code E800; assigning type code for
‘Linux filesystem’

My idea is now:

  • move the partition with GParted some MiB away from the start, i.e. so that the tool and things have enough space at the start
  • backup the MBR
  • run the conversion

Now one specific question:

  • If the partition type code is wrong after the conversion (as gdisk seems to want to do), can I change that somehow?

The warning is always there, so that’s fine. But I suggest you to fix the partition type first, and then convert from MBR to GPT.

You can change the partition type using fdisk with t command. Lookup the correct partition type. Although, I don’t know who cares about the partition type anyway :smiley: It seems that most tools just ignore it. But, its better to set the correct type rather than an invalid type.

There is no need to move your partition.

But, just to be sure, before doing anything please run gdisk and then run the p command and see the output to make sure that the partition’s start & end does match to that of fdisk output. Because the start of your partition is a bit early (sector 32). Make sure that it remains as is in gdisk p output.

1 Like

Just a general note that converting from MBR to GPT is not a safe operation. I would definitely not do it unless you have a backup of your data.

Does it work? Yes. Is it failproof? No.


Unless the converter app is really buggy, I’d say a backup of MBR is more than enough. The tool should not touch user partition at all, as it only touches few sectors at the beginning of disk (and, as noted below, few ones at the end if possible). And considering that his partition starts at sector 32 (with 4K sectors), his data should be completely safe.

Just FYI, it might also touch a few sectors at the very end of the disk if they are not listed as being used in the existing partition table (I wonder if that could corrupt an mdadm device with metadata at the end of the drive?). The sectors written at the end of the disk are a backup copy of what is written at the start of the disk. This backup data will also need to be moved if you increase the size of the underlying device.

1 Like

Thank you for your correction. Yeah, I didn’t notice that. :slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.