Friday, January 8, 2016

Changing Partition Types with DiskPart

DiskPart and the Disk Management snap-in note for each partition its type - "Recovery", "EFI System", "Primary", etc. For GPT (GUID Partition Table) disks, these partition types are identified by - you guessed it - GUIDs. DiskPart makes it possible to change the type, if you direly need to do so.

Run diskpart from an elevated command prompt and select the desired disk and partition. Then issue set id= followed immediately by the GUID (without braces). For example, this changes the selected partition's type to EFI:

set id=c12a7328-f81f-11d2-ba4b-00a0c93ec93b

Other types:

  • Normal: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
  • Recovery: de94bba4-06d1-4d40-a16a-bfd50179d6ac
  • Reserved: e3c9e316-0b5c-4db8-817d-f92df00215ae
(Note that it may not be possible to change an existing partition's type to Reserved, according to the "set id" technical reference. If you're really intent on making a partition have the Reserved type, see the dangerous part of my Super User answer on the subject.)

Each partition's attributes/flags can be changed with the gpt attributes= command. Its current attributes can be seen with as part of the detail partition output.

3 comments:

  1. Thank you for the helpful details, however I'm unable to get diskpart to set id to reserved even after using the "dangerous method" I changed the bits to 00 00 00 00 and it would still reject the id... Any help please?

    ReplyDelete
    Replies
    1. I tested my procedure and you're right, it didn't work. I edited that answer with steps that do. The component that actually enforces the ban on that GUID is "vdsbas.dll", so that's the one that should be changed. Modifying that one appropriately let me change a partition into the Reserved type.

      Delete
    2. Ah good to hear that! I couldn't find the procedure anywhere on the net.

      Delete