Changing partition table format without losing data

9,565

The first 34 sectors and the last 34 sectors of your disk shouldn't be covered by any partition. You should check that with sudo fdisk -l, look for your disk and check on which sector the first partition starts and on which sector the last partition ends.

If any partition is covering the first or last 34 sectors of the disk you would have to resize this partition first with gparted. After this preparation you need to run sudo gdisk sdX where sdX is the disk you want to convert.

From man gdisk:

Upon start, gdisk attempts to identify the partition type in use on the
disk.  If  it finds valid GPT data, gdisk will use it. If gdisk finds a
valid MBR or BSD disklabel but no GPT data, it will attempt to  convert
the  MBR or disklabel into GPT form.  Upon  exiting  with  the  'w'  option,
gdisk replaces the MBR or disklabel with a GPT. If you mistakenly launch gdisk
on an MBR disk, you  can safely  exit  the  program  without making any changes
by using the 'q' option.

The MBR-to-GPT conversion will leave at least one gap in the  partition
numbering  if  the original MBR used logical partitions. These gaps are
harmless, but you can eliminate them by using the 's'  option,  if  you
like.

If gdisk is not installed on your system, you can do that with sudo apt-get install gdisk. Please refer to the manual with man gdisk

Share:
9,565

Related videos on Youtube

Chris S
Author by

Chris S

Updated on September 18, 2022

Comments

  • Chris S
    Chris S over 1 year

    Sorry in advance for some extraneous info.

    So I just got a new 3TB HDD and used ddrescue to copy files from a failing 2TB HDD to this new one. I knew the partition on my new 3TB HDD would be limited to the size of the old 2TB one but thought that I could use GParted to extend the partition once everything was copied.

    And then... I tried to extend my partition size to the full 3TB and found out that I couldn't because of the msdos partition table imposed maximum which allows at largest 2TB. So while using this site I found the solution was to create a gpt partition table in GParted but looking into this it said it would delete all data on the drive.

    Soooo the crux of the matter: Is it possible for me to change the partition table format on my hard drive to gpt without wiping the drive?

    • WinEunuuchs2Unix
      WinEunuuchs2Unix over 7 years
      Why not copy files from a 2TB gparted to a 3TB gpt instead? Perhaps naive question since I don't have either.
    • David Foerster
      David Foerster over 7 years
      @WinEunuuchs2Unix: Presumably the original drive failed or is about to fail, so OP doesn't want to risk losing all their data in an attempt to copy them again.
  • Chris S
    Chris S over 7 years
    Thank you so much! Between your answer and this one (askubuntu.com/questions/672436/…) I was able to figure this out pretty painlessly!
  • Reza Taba
    Reza Taba over 2 years
    Great solution. Activated GPT without losing other partitions' data. "sudo gdisk /dev/sda" with the input of W worked in my case.