9

Linux LVM assigns UUID values to physical and logical volumes but they aren't valid RFC4122 UUID strings. Here is an example:

  • 2185fe86-41d4-4311-9a47-8f0ebc7ecc5a RFC4122
  • AZdHpq-uENw-cRo2-t6jS-iQXu-nD2u-woW7RT LVM

The LVM format is longer and its representation uses non-hexadecimal characters and is hyphenated differently.

What's the rationale behind this variation and why use the term "UUID" when it isn't strictly a valid UUID per the specification ?

Perhaps the LVM format is another UUID standard format but I've been unable to find any references that suggest this.

starfry
  • 7,302
  • 6
  • 47
  • 69
  • I get perfectly fine UUIDs for logical volumes. – muru Dec 11 '14 at 11:52
  • 1
    Those UUIDs are the internal representation used by LVM. If you check `/dev/disk/by-uuid/` you only see RFC4122 UUID strings. – wurtel Dec 11 '14 at 11:56
  • That is true indeed, also `blkid`. Is there a logical relationship between the "internal" UUID and the actual one shown. – starfry Dec 11 '14 at 12:05
  • 1
    See also the question [here](http://unix.stackexchange.com/q/129497). The format used in LVM is defined in the source code (see lib/uuid/[uuid.c](https://git.fedorahosted.org/cgit/lvm2.git/tree/lib/uuid/uuid.c) and lib/uuid/[uuid.h](https://git.fedorahosted.org/cgit/lvm2.git/tree/lib/uuid/uuid.h)) – don_crissti Dec 11 '14 at 12:18

1 Answers1

4

They are a completely random 192-bit identifier (c.f. 128 bits for RFC4122 UUID) that is used by LVM to uniquely identify each of its various entities: volume group, physical volume, logical volume.

As described here, this is generated from /dev/urandom using the characters [a-zA-Z0-9]. Note that this provides for 5.808 bits per character. According to the LVM2 source code, because LVM1 UUIDs didn't support them, the two extra characters supported by the format ("!" and "#") are not used during UUID generation.

The probability of duplicates is exceedingly low by extrapolating from the calculations on the Universally unique identifier page on Wikipedia.

Alastair Irvine
  • 232
  • 1
  • 12