Converting MBR to GPT
Converting a DOS (MBR) partition layout to GPT without losing data is remarkably straightforward with the gdisk
utility. Why this is straightforward is explained by the gdisk
author.
Before converting a production disk, converting can be tested with a virtual machine (VM).
Create a new VM. Create an empty but realistic virtual disk size of at least 20 GB.
Ensure the VM has sufficient RAM to run a Live ISO that contains gdisk
. The Live ISO should also contain fdisk
, cfdisk
, and gparted
.
Boot the VM with the Live ISO. Using fdisk
, cfdisk
, or gparted
, format the virtual disk with the older DOS (MBR) partition layout. Create at least one Primary
partition but also create a Extended
partition with at least one Logical
partition.
The partitions do not need to contain any data.
To convert:
- Open a terminal window.
- Run
fdisk -l /dev/sda
. - Verify the
DOS
partition layout. - Launch
gdisk /dev/sda
. - Ensure there are no error messages.
- Select the
w
option (to write changes). - Run
fdisk -l /dev/sda
. - Confirm the layout shows
GPT
- Verify there no longer is any
Extended
partition.
Notice the partition numbering skips because of removing the Extended partition.
- Launch
gdisk /dev/sda
. - Select the
s
option (to sort partitions). - Select the
w
option (to write changes).
The partitions will be renumbered sequentially.
Launch gparted
. Notice there is unused space between the partitions. Move partitions as desired to recover the lost space.
With a production disk renumbering the partitions (sorting) might affect /etc/fstab
when using block device nomenclature rather than UUIDs. Edit the table as necessary.
With a production disk be sure to update the boot loader.
Although I never had issues converting, as always backup any data before proceeding.
Posted: Usability Tagged: General
Category:Next: Recovering From GRUB Failures
Previous: Odd VirtualBox Audio Bug