NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ZFS Partition GUID all zeros?



riz%tastylime.net@localhost (Jeff Rizzo) writes:

>I was getting some help with related problems on IRC earlier today (I 
>think they're mostly sorted) , and it didn't even think about this one:  
>the `gpt` command seems to have created partitions with all-zeros GUID.

The gpt command creates GUIDs, including the partition GUIDs when you
create the GPT itself. When adding, modifying or removing partitions 
these are not changed (just the "type GUIDs").

All 3 partitions are in the same block of the GPT table.

3 uefiboot1 nil
1 bootraid1 someguid
2 zfswd1    nil

The whole GPT is also CRC checked and all generated GUIDs have some
bits set. So it's difficult to understand how you can have a mix of
good and bad GUIDs using regular gpt operations.


>So... how bad is it that I have four GPT partitions with the same GUID?  

I can only see two all-zero GUIDs, the others are unique. For NetBSD
you only need unique "wedge names" that are made from the GPT partition
labels or the partition GUIDs if no label was set. Wedges with non-unique
names are ignored and the console logs that 'manual intervention' is
required.


>:)  Can I edit them? And how do we think this happened?

You can use the 'gpt uuid' command to replace the GUIDs with fresh ones.

You can even set a specific UUID (including symbolic type GUIDs) and
also tell gpt to apply it everywhere, including the header.

Parsing a numeric UUID is supposed to check for a valid GUID, but
the check isn't sufficient.

        /* We have a successful scan. Check semantics... */
        n = u->clock_seq_hi_and_reserved;
        if ((n & 0x80) != 0x00 &&                       /* variant 0? */
            (n & 0xc0) != 0x80 &&                       /* variant 1? */
            (n & 0xe0) != 0xc0)                         /* variant 2? */
                return -1;
        return 0;

Variant 0 is NCS legacy, variant 1 is standard, variant 2 is Microsoft legacy.
Variant 3 is reserved for future use.

There is no further check for standard requirements and there is no check for
uniqueness. An all-zeros GUID would be interpreted as 'variant 0'.

gpt will only create variant 1 UUIDs that are either random or time based when
it sets up a GPT. However, when selecting time based UUIDs, you get the same
for the header and all partitions.


gpt uuid -a

will do the best for you, it will just replace all GUIDs with fresh random ones.



Greetings,


Home | Main Index | Thread Index | Old Index