2

I have found a recommendation to change the GPT Attributes of a partition in order to prevent windows from automatically detecting and assigning a drive letter to an encrypted USB drive when inserted, as well as marking it as "required" - avoiding a pop-up suggesting to format it. This is the suggested change, and it appears to work across multiple computers with no data corruption yet.

GPT ATTRIBUTES=0xC000000000000001

I understand the '1' in the last position of the string is to mark the partition as "required" and prevent the system from deleting or formatting it. The first position following the 'x' has several possible values equating to things such as denoting the partition is a shadow, or a basic data partition; these all seem to be numeric values (ie. 2, 4, 8). But I cannot find anything that signifies what the 'C' in the first attributes. Does anyone know what this does, or if it poses an issue to data stability/corruption long term?

Thank you

jay-123
  • 23
  • 1
  • 1
  • 3

2 Answers2

3

First thing: 0xC = C (hex) = 12 (dec) = 1100 (bin). Four bits. Each and every character in the string C000000000000001 denotes four bits, 64 bits total. Binary representation of the string is 11…01 where replaces 60 zeros.

The meaning of these bits (from Wikipedia):

0 Platform required (required by the computer to function properly, OEM partition for example, disk partitioning utilities must preserve the partition as is)
1 EFI firmware should ignore the content of the partition and not try to read from it
2 Legacy BIOS bootable (equivalent to active flag (typically bit 7 set) at offset +0h in partition entries of the MBR partition table)
3–47 Reserved for future use
48–63 Defined and used by the individual partition type

It's not immediately obvious which bit in your 11…01sequence is 0th, which is 63rd. Are the numbers offsets in the bit sequence? or is the 0th bit the least significant (rightmost) bit in the resulting binary number? Well, in my tests with (Linux) gdisk I toggled the 0th bit and the attributes toggled between 00…00 and 00…01, so I would say 0th is the least significant bit in the resulting binary number.

Which means your interpretation of the (hexadecimal) digit 1 is right (although not complete, the digit includes information about bits 1, 2 and 3 as well, these bits are unset).

gdisk displays its own interpretation as:

0: system partition
1: hide from EFI
2: legacy BIOS bootable
60: read-only
62: hidden
63: do not automount

This agrees with Wikipedia when it comes to bits 0-2, and with this other answer and the link therein for 60, 62 and 63. I would treat those latter bits with a grain of salt, since Wikipedia states that

48–63 Defined and used by the individual partition type

and you didn't tell us what the partition type is, so we cannot really investigate further. On the other hand I wouldn't be surprised if Windows used its rules to all partition types. The fact your setup "works across multiple computers with no data corruption yet" suggests that at least for this particular partition Windows uses its rules regarding bits 62 and 63.


To summarize, the attributes in question mean:

  • disk partitioning utilities must preserve the partition as is,
  • hidden,
  • do not automount.

This setup should work for you and not possess any threat to data stability.

1

As Kamil pointed out, the "C" is hexadecimal, and is represented in binary as 1100. That is: 1*8 + 1*4 + 0*2 + 0*1. Thus, you can think of the "C" as a combination of an 8 and a 4.

From https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/gpt, here are some of the values of the GPT attributes.

  • 0x8000000000000000. Specifies that the partition will not receive a drive letter by default when the disk is moved to another computer or when the disk is seen for the first time by a computer.

  • 0x4000000000000000. Hides a partition's volume. That is, the partition will not be detected by the mount Manager.

So, in your case, treating "C" as a combination of 8 and 4, your partition (1) will not receive a drive letter, and (2) is hidden.

Doug Deden
  • 2,204
  • 1
  • 12
  • 16