I successfully achieved converting MBR to GPT, but used two extra (new) disks for safety reasons.
Note that I'm using Debian in combination with the
With my setup, which simply has a Linux partition and a swap partition, the procedure is
roughly as following.
First, make a full backup:
- use the first extra disk to make a full backup of the old disk
- disconnect (!) the original drive and put it somewhere safe (this guarantees we're not writing it by accident)
- connect the backup drive such that you can boot from it (e.g. first SATA connection on mother board)
- also connect the second extra disk
- boot from your backup disk
If you can boot and everything works normally, this also proves your backup is sound.
Now let's really begin:
- partition the still empty second disk using
gdisk in the new MPT format
- deliberately use the same partition sizes as the old disk so we can easily migrate
- use the code
8300 for the linux partition and
8200 for the linux swap partition.
- also create an extra 2 MiB partition using the
ef02 code, remember the partition number we will need it later.
Note: This 2 MiB partition is for booting
GRUB and does not have to be at the start of the disk per se.
dd to copy the data from the boot disk Linux partition to the new
- activate the newly created swap partition (use the mkswap command)
At this stage, the system files and your data have been copied to the new disk.
Only thing that remains is to make things bootable.
Run the following command:
parted /dev/sdXXX set YYY bios_grub on
where XXX is the device corresponding to the 2 MiB partition we have created and YYY the partition number I asked you to remember.
grub-install /dev/sdZ where sdZ is the disk you want to make bootable.
Disconnect the backup disk
- Wire the GPT disk so you can boot from it
- Test (boot into your new GPT enabled disk)