How To Convert A Disk From MBR To GPT On Linux?

The firmware interface is a way by which firmware interacts with the operating system. The BIOS is the usual firmware interface while UEFI is the newer one that has more features.

MBR uses the standard BIOS partition table while GPT uses Unified Extensible Firmware Interface (UEFI). The GPT has various advantages over the MBR disk, for example, you can create more than four primary partitions on a GPT disk. The GPT is required if the size of a disk is greater than 2 TB.

So let’s see how to convert an MBR disk to GPT on Linux.

Why convert MBR to GPT

GPT takes advantage of UEFI to support storage devices larger than 2 TB. It lets you set up as many partitions as you need for example – Windows support 128 partitions on a GPT disk.

To boot your computer from UEFI mode, you need to use the drive formatted as a GPT partition structure. You can read the subsequent part of this article if you want to convert an MBR disk to GPT.

Converting a disk from MBR to GPT

For converting an MBR disk to GPT we will use a GPT aware program for example gptfdisk or gdisk. The gdisk tool is a text-based menu-driven program for the creation and manipulation of partition tables.

First, you need to install the gdisk if it is not in your system. You can install it by using the following command –

sudo apt install gdisk -y

After installing gdisk follow the given steps.

Note: Before converting a disk from MBR to GPT backup any data on it.

Step 1: List and identify the disk

Use the following command to list the disk available in your system –

sudo fdisk -l

Scroll and identify the disk that is to be converted from MBR to GPT in the output of this command.

Step 2: Use the gdisk tool

Run the following command in your terminal –

sudo gdisk /dev/sda1

or use the –

sudo gdisk

This will ask you to enter the disk name, enter the name of the disk and then press the return key.

Now this command will scan and display the partition table present on this partition –

Note – Don’t forget to replace /dev/sda1 with the correct drive on your system for example it could be /dev/sda on many systems

Step 3: Entering command to write gpt partition table

Now enter the w and then press the return key. This will write the gpt partition table on the given disk. If asked press y to confirm your choice.

Step 4: Verify the conversion

The disk is now converted from the MBR to GPT. You could verify this by using the following command –

sudo gdisk /dev/sda1

Conclusion

By following this you are now able to convert an MBR disk into GPT. Now if you have anything to say on this topic then you can write to us in the comments below.

4 thoughts on “How To Convert A Disk From MBR To GPT On Linux?”

  1. This guide is wrong, you try to convert a single partition to gpt. Gdisk is relentless and writes the partition table to the partition, that doesn’t make much sence. You always convert a whole drive, not a single partition. The correct command would be “sudo gdik /dev/sda” to convert the disk to gpt.

    Reply
    • Thanks, mook for pointing out this.

      I used Ubuntu on a virtual machine and a USB drive to demonstrate this. On my system, this USB was listed as /dev/sda1. I forgot to mention it while writing this article.

      By the way, I updated the post with a separate note on this.

      Reply
    • The expected answer: it preserves the data, it does not delete files or partitions.
      The way to understand the answer and apply it a serious situation is to perform an experiment on a flash disk of 8-16 GB (less than US $8 dollars at Walmart).

      An example of a serious situation is transforming a 4TB spinning disk from MBR to GPT, no data loss. Serious situations demand data backup, i.e., on DropBox or Google Drive, possibly on one or more attached spinning disks. Data loss can happen for reasons beyond your control: disk error, clumsy fingers in gdisk, power bump, program hang.

      The experiment suggested will settle issues before the idea is applied to a serious situation. Some details:

      Create an MBR-partitioned flash disk with 4 partitions, for instance two partitions fat32, one partition ext4, one partition linux swap. Add files to the fat32 partitions, like a few video files and photos. Tools: gparted under linux, disk management under Win 10. Test the disk, displaying and playing the photos and videos.

      Under Linux in a terminal:

      Insert the flash disk into USB. Execute *blkid * to find out the device used by the flash disk, assumed here to be /dev/sdX. Mount and unmount and remount the flash drive to verify the device name.

      Execute *sudo gdisk /dev/sdX* in a terminal, hoping to convert the flash disk from MBR to GPT. What can go wrong? The last partition on the MBR flash disk could fill the disk to the end. Bad result. The fix: shrink the partition at the end of the data by 50MB and try again.

      Gdisk will create an in-memory GPT partition table and use it for further commands. To convert the disk requires entry of command w (W=write the GPT partition table to disk). To bail out with no changes use command q (q=quit no changes).

      Not the end. If it works then you must reboot the Linux machine and run Linux utility *disks* or Linux utility *gparted*. Those utilities can reveal expanded info about the converted disk, if it is MBR or GPT, and list the partitions.

      To test data integrity re-inesrt the flash drive and play the videos and display the photos.

      After a successful experiment you are ready to attack conversion of a serious project, like converting a 4TB MBR-partitioned spinning disk to GPT-partitioning, no data loss.

      About bootable MBR disks: do not expect GPT-converted disks to be bootable just because they were MBR-bootable before the conversion. Linux requires grub to be installed anew on the converted disk. Windows 10 requires startup repair from a Win 10 install disk.

      Win 10 needs 2 or 3 partitions to execute boot. Do not expect new partitions to be created by the Win 10 repair disk software. Two paths to follow in this case:

      1. Do not use Linux gdisk. Use Win 10 software to convert MBR bootable to GPT bootable. Search Microsoft for details. This advice applies only to Win 10, not to Win 8 or Win 7. The old disk is lost by this plan, replaced by a modified (by Microsoft) system. The data is safe.

      2. Do not use Linux gdisk. Create a new minimal install of Win 10/8/7 on a new second disk, then copy with gparted the largest partition from the old disk to the new disk, the other partitions untouched. Follow that by Win 10/8/7 startup repair. The old disk is untouched by this plan, so the old data is safe.

      Reply

Leave a Comment