The GPT format introduce far more place to metadata.
To set a partition type in diskpart, one use :

DISKPART> create partition msr


DISKPART> create partition efi


DISKPART> create partition primary

But how to do change the type after partition creation like changing primary to efi ?

  • note it doesn’t have to be done with diskpart, other built‑in tools can be used. – user2284570 Jan 8 '16 at 21:54
  • Please could you stick to standard ANSI text and refrain from using Unicode "lowercase capitals" or similar. It makes it impossible to search for your questions as "normal" search terms (non Unicode) will not be matched in your questions. This makes it harder for future visitors to find your question and thus reduces the audience of people who might be able to help you. – Mokubai Jan 8 '16 at 22:03
  • Change the type to what exactly? There is only one type of GPT partition. – Ramhound Jan 8 '16 at 22:09
  • @Ramhound : for example convert unknown to efi. A ɢᴘᴛ partition have types set has flags (you can combine several types) ; associated ᴏꜱ ; id ; and guid. – user2284570 Jan 8 '16 at 22:10
  • I don't believe diskpart has the capability. – Ramhound Jan 8 '16 at 22:16
up vote 4 down vote accepted

DiskPart can actually do this. Select the appropriate disk and partition, then use the set id command. For example, this changes the selected partition into an EFI partition:

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

Using a combination of the set id TechNet article and detail partition, I discovered these common possible values:

  • Recovery: de94bba4-06d1-4d40-a16a-bfd50179d6ac
  • Normal: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
  • EFI: c12a7328-f81f-11d2-ba4b-00a0c93ec93b
  • Reserved: e3c9e316-0b5c-4db8-817d-f92df00215ae

It's probably a good idea to consult the partition attributes for a partition of a certain type (look at a healthy computer) so the set flags make sense. As you discovered, gpt attributes sets flags; detail partition displays them.

Danger zone: setting the Reserved type

The TechNet documentation says that DiskPart won't let you make a partition into a Microsoft Reserved one. That claim is true, so you might want to use a different tool. If you really want to use DiskPart, you'll have to whack the Windows disk management infrastructure it so that it doesn't know what types are not allowed. Danger! I have not tested the following steps on a bootable disk; they're here for entertainment purposes only. Do them at your own risk, preferably on a throwaway computer or VM.

Break out a hex editor - I like XVI32 - and open a copy of vdsbas.dll (in System32). That's the module that serves most disk-related operations, and it's the one responsible for policing partition types. The GUID of the Microsoft Reserved type starts at byte 0x21CD8 for the version that comes with Windows 10 x64; you should search for the hex string 16 E3 C9 E3 (0xE3C9E316 in little-endian). Flipping a bit there will make the whacked copy not know you're setting a special type. You'll have to change the security settings on the original copy of vdsbas.dll before Windows will let you overwrite it. You'll also have to make sure the Virtual Disk service isn't running (stopping it in Services is fine), otherwise the file will be in use.

Note that such Reserved partitions must not be associated with a volume. I do not know whether DiskPart has a way to keep a partition that way.

There's probably a good reason Microsoft doesn't let you set this type, so make a back-up of anything important on the drive if you decide to go this route. If you direly need such a partition back, it's probably better to reinstall/repair Windows from official media.

  • 1
    Ok, I thoughtset idwas referring to an unique identifier much like ɢᴜɪᴅ instead of a type. – user2284570 Jan 8 '16 at 23:47
  • The microsoft reserved partition need to to carry a name in more the specific id. If it don’t you won’t be able to upgrade the windows® version without re‑installing. – user2284570 Jan 11 '16 at 1:36
  • Note a full list of Microsoft-documented guids for GPT partitions is available here: – Simon Mourier Nov 13 at 19:38

There seems to be a bit of confusion, or at least imprecise use of terminology, in this question and its discussion. Thus, it may be useful to review the GPT data structures, which are described in the Wikipedia article on GPT. (The EFI spec is more authoritative, and is freely available, but requires accepting license terms to download. See here to get it.) GPT type codes are actually GUID values -- see the partition type GUIDs table in the Wikipedia article for a listing of well-known values. There are also GPT attributes and partition names; these are three entirely independent data structures (although many partitioning tools set partition names based on the type code). I know of no GPT partition type called "primary." I suspect that the reference to this type is a result of confusion with MBR partitions, which can be primary, extended, or logical; but these concepts are meaningless in GPT. Some tools continue to apply the term "primary" in reference to all GPT partitions, presumably because the tools were originally written for MBR disks, and so require a primary/extended/logical identification for all partitions.

Type codes, in both MBR and GPT, identify the intended use of the partition. Windows, OS X, and some other OSes use type codes as a sort of "filter" -- these OSes ignore partitions that aren't of certain types, so that you can set up (say) a Linux filesystem on a partition with a Linux-specific type code and Windows won't try to format it. There are also several Windows-specific type codes (see the Wikipedia table), and some that are cross-OS (like the code for the EFI System Partition, or ESP).

Attributes are less commonly used (type codes are mandatory), but they may modify the way the OS or firmware treats the partition. A "hidden" attribute, for instance, tells the OS to ignore the partition. This may or may not be honored, depending on the OS. Attributes can vary from one partition type to another.

Partition names exist mainly for human consumption, so that you can identify partitions. I haven't investigated it extensively, but I think that OS X is finicky about the name assigned to its Recovery HD partition; in my (brief) tests, it flaked out when this partition was renamed. I haven't encountered any other case of OSes or utilities caring about partition names, although they're often assigned to descriptions associated with the type code when partitions are created.

I'm not very familiar with Microsoft's diskpart tool, but as Ben N specifies in his answer, it it possible to use it to set type codes to arbitrary GUID values. Other tools can do this, too, or can set type codes in some other way. My own GPT fdisk (gdisk), for instance, uses four-digit (two-byte) hexadecimal values as "shortcuts" to known GUID values; or you can enter GPT values "raw." See the gdisk Walkthrough section of the documentation for information on how to do this. The libparted library (which is used by several Linux tools) sets type codes based on the filesystem you say will be used on a partition; but you can change them to a limited extent by setting "flags," some of which correspond to type codes and some to attributes. This is a rather confusing blending of two independent underlying data structures.

  • 1
    The Microsoft windows® reserved partition need to to carry a name or it will won’t be possible to upgrade the windows® version without re‑installing. id and ɢᴜɪᴅs are 2 different independent things with 2 different values for each partition. – user2284570 Jan 11 '16 at 1:38
  • If you just want to see these values in gdisk without looking anywhere else: gdisk /dev/sdX. Select the extra functionality (experts only) menu (press x) and then press i to show detailed information on a partition. You need to do it one partition at a time (perhaps there is a better way?) – starfry Jul 3 at 13:40

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.