User Tools

Site Tools


microsoft:windows:disk:convertmbrtogpt

Convert MBR -> GPT

gptgen.
Usage example: bramp.net - Converting MBR to GPT without deleting your partitions

In short:

  1. BACKUP YOUR DATA!
  2. Determine the number of the disk with Disk Management (diskmgmt.msc). (Disk1 is used in the examples below.)
  3. Use gptgen without the -w parameter (dryrun), but with the \\.\\physicaldriveX parameter (where X is the disk number):
    gptgen.exe \\.\\physicaldrive1

    Sample output:

    gptgen.exe: Partition table converter v1.1
    
    Boot: 0, Type: 0x7, Start: sector 2048, Length: 4093634560 sectors
    
    Writing primary GPT and protective MBR to primary.img...
    Writing secondary GPT to secondary.img...
    Success!
    Write primary.img to LBA address 0.
    Write secondary.img to LBA address 4093640671.
  4. This will have created a primary.img and secondary.img in the working directory both containing what gptgen.exe would have written to disk when provided with the -w parameter. Determine the size of primary.img and secondary.img:
    dir *.img
    28-07-2012 10:44 17.408 primary.img
    28-07-2012 10:44 16.896 secondary.img
  5. Calculate the count= value needed for dd.exe for each .img. In this example:
    1. primary.img: 17408 / 512 = 34
    2. secondary.img: 16896 / 512 = 33
  6. Create a backup with dd.exe of the disk locations that will be overwritten by gptgen.exe. You can get the value for skip= from the gptgen output line:
    Write secondary.img to LBA address 4093640671.
    dd if=\\.\\physicaldrive1 of=primary-backup.img bs=512 count=34
    dd if=\\.\\physicaldrive1 of=secondary-backup.img bs=512 count=33 skip=4093640671
  7. Use gptgen with -w parameter to write the changes to disk:
    gptgen.exe -w \\.\\physicaldrive1
  8. If all went well: rescan disks with Disk Management (diskmgmt.msc).
  9. Done.

If something went wrong, you can try to write the backup .img files back to the disk with the if= and of= values switched and seek= instead of skip=:

dd if=primary-backup.img   of=\\.\\physicaldrive1 bs=512 count=34
dd if=secondary-backup.img of=\\.\\physicaldrive1 bs=512 count=33 seek=4093640671
microsoft/windows/disk/convertmbrtogpt.txt · Last modified: 2012/08/02 08:00 by bas

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki