Announcement

Collapse
No announcement yet.

UUID vs GUID, efibootmgr, gdisk, partitions, filesystems

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    UUID vs GUID, efibootmgr, gdisk, partitions, filesystems

    UUID vs GUID, efibootmgr, gdisk, partitions, filesystems

    See also Post 2 below.

    (Very quick note on GUIDs vs UUIDs)

    Often you want to know which disk it is, so you can track down what's going on.

    Your GRUB configuration files show UUIDs
    efibootmgr shows GUIDs
    gdisk shows GUIDs.
    This shows GUIDs: ls -l /dev/disk/by-partuuid
    This shows UUIDs: ls -l /dev/disk/by-uuid
    blkid shows UUIDs (though some versions of blkid also show GUIDs)

    As you mess with things, often you need to know which disk is being used for what, and maybe all you have to go on is a long string of hyphenated numbers.
    Just to be clear about this, the output of sudo efibootmgr -v shows some hard drive partitions with their GUIDs.

    Think this way:
    GUID --> GPT only --> partition,
    and
    UUID --> filesystem;

    or the distinction offered by SteveRiley:

    /dev/disk/by-partuuid shows the UUID assigned to the partition when it was created by a partitioning tool.
    /dev/disk/by-uuid shows the UUID assigned to the file system when it was formatted.

    Note gdisk: To use gdisk to find GUIDs:
    sudo gdisk /dev/sdx
    command: i
    partition number (1-n): [enter the partition you want to know about]
    Then, you get some output, like:
    Partition GUID code: C12A7328-F81F-11D2-BA4B-00A0C93EC93B (EFI system partition)
    Partition unique GUID: CFC63277-3E31-4939-BDE9-DB4429F4FA77

    Final Note: From Rod Smith, at
    https://askubuntu.com/questions/4727...partition-guid

    You're confusing filesystem UUIDs with partition GUIDs.
    The former are stored within the filesystems and can be used in Linux's /etc/fstab file or by the mount command via the UUID= parameter.
    (Despite the "UUID" name, they aren't always true UUIDs. FAT doesn't use UUIDs, for instance, so for FAT, the serial number is used instead of a UUID.)
    These UUIDs should be unique for any given filesystem, although cloned filesystems might have duplicated UUIDs.

    Partition GUIDs, by contrast, are available only on GPT disks. There are actually two GUIDs associated with a partition:

    A type code GUID, which is what the C12A7328-F81F-11D2-BA4B-00A0C93EC93B figure is. That particular GUID identifies an EFI System Partition (ESP). This is equivalent to the one-byte partition type codes of an MBR disk.

    A partition's unique GUID, which, like a filesystem UUID, should be unique to any particular partition. The EFI uses this GUID internally, and some versions of Linux utilities enable you to use it much like a filesystem UUID, but using the PARTUUID= label rather than UUID=.

    Last edited by Qqmike; Sep 28, 2024, 11:00 AM.
    An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

    #2
    I'm going to dump this discussion (to myself) that relates to the issue. I'll try to clean it up later.
    But this could be helpful to you if you are delving deep into an issue you've encountered.
    So here goes, raw from my Writer notes:

    GPT_ESP_GUIDs

    This is a loose end that goes with my recent new PC build, UEFI, Kubuntu only (no Windows). It is about all the GUIDs floating around related to the ESP of a GPT. I'll just copy-paste my write-up for those who follow this stuff. In particular, it shows how to locate the GUID of the ESP and exactly what is is (it is a Partition GUID "code"). Here is the deal:

    Exploring the GUIDs -- sorting them out

    This material is added to my write-up (New PC build--Kubuntu only 2015) after a discussion with SteveRiley in a thread about UEFI and dual booting, credit goes to him,
    https://www.kubuntuforums.net/showthr....t369678

    We will look at three GUIDs associated with the ESP:
    The Partition GUID code, the Partition unique GUID, and the GUID entry in your /etc/fstab for the /boot/esp filesystem.

    We are told the GUID of the ESP is
    C12A7328-F81F-11D2-BA4B-00A0C93EC93B
    Actually, it is the Partition GUID code.

    (Comment, aside: Remember that GPT means GUID Partition Table, and it is part of the UEFI specification.
    http://en.wikipedia.org/wiki/GUID_Partition_Table
    GUID means Globally Unique Identifier.
    http://en.wikipedia.org/wiki/Globally_unique_identifier )

    The GUID code indicates the type of partition.
    In the Wikipedia article, scroll down to the table Partition Type GUIDs,
    http://en.wikipedia.org/wiki/GUID_Pa...ion_type_GUIDs
    then under Operating System: None, EFI System Partition, then in the right column the GUID,
    C12A7328-F81F-11D2-BA4B-00A0C93EC93B

    To find the GUID code of the ESP on your system:

    In Konsole, run the command
    sudo gdisk /dev/sda
    You will be asked for Command, type i (for information).
    You will be asked for Partition number, type the partition number of the ESP on your system. You might have to guess at it. Mine was 1. (See the Note below for another tip.)
    And you can see the Partition GUID code and a Partition unique GUID:
    CODE

    mike@mike-desktop:~$ sudo gdisk /dev/sda
    [sudo] password for mike:
    GPT fdisk (gdisk) version 0.8.8

    Partition table scan:
    MBR: protective
    BSD: not present
    APM: not present
    GPT: present

    Found valid GPT with protective MBR; using GPT.

    Command (? for help): i
    Partition number (1-4): 1
    Partition GUID code: C12A7328-F81F-11D2-BA4B-00A0C93EC93B (EFI System)
    Partition unique GUID: 0B3A3E36-B506-4F4A-9811-8549F1B5D884
    First sector: 2048 (at 1024.0 KiB)
    Last sector: 1026047 (at 501.0 MiB)
    Partition size: 1024000 sectors (500.0 MiB)

    Note: To find the partition number of the ESP, you can run this:
    CODE

    mike@mike-desktop:~$ sudo gdisk -l /dev/sda
    GPT fdisk (gdisk) version 0.8.8
    Partition table scan:
    MBR: protective
    BSD: not present
    APM: not present
    GPT: present
    Found valid GPT with protective MBR; using GPT.
    Disk /dev/sda: 976773168 sectors, 465.8 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): D3B766B4-D998-4351-8F06-13BC87F55BDE
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 976773134
    Partitions will be aligned on 2048-sector boundaries
    Total free space is 676741101 sectors (322.7 GiB)

    Number Start (sector) End (sector) Size Code Name
    1 2048 1026047 500.0 MiB EF00
    2 1026048 62466047 29.3 GiB 8300
    3 62466048 267266047 97.7 GiB 8300
    4 267266048 300034047 15.6 GiB 8200


    The ESP is indicated by the code EF00. The other partitions are Linux. Thus, my ESP is on partition 1.

    So, going back to the output of sudo gdisk /dev/sda, we got:
    Partition GUID code: C12A7328-F81F-11D2-BA4B-00A0C93EC93B (EFI System)
    Partition unique GUID: 0B3A3E36-B506-4F4A-9811-8549F1B5D884
    The Partition code GUID shows the partition type to be the ESP.
    QUOTE
    SteveRiley
    The partition unique GUID is generated and assigned by the operating system each time you create a partition. It has no relationship to the partition GUID code. Only GPT disks have these; MBR disks do not.

    You can see all [your] partition unique GUIDs this way:
    ls -al /dev/disk/by-partuuid


    Now, one more GUID: in your file /etc/fstab.
    Mine shows:
    CODE

    # /boot/efi was on /dev/sda1 during installation
    UUID=74D7-02F2 /boot/efi vfat defaults 0 1


    The ESP is mounted (in your Kubuntu OS) on the folder /boot/efi. (The main directory in this folder is the EFI directory; the subfolder /boot/efi/EFI/ubuntu contains the bootloader files for OSs on your PC.)
    QUOTE
    SteveRiley
    The entry in fstab shows the filesystem unique GUID. This is generated and assigned by the operating system when you put a filesystem into a partition. It has no relationship to either the partition unique GUID or the partition GUID code. All filesystems have these, regardless of the disk type. You can see all filesystem unique GUIDs this way:
    ls -al /dev/disk/by-uuid


    Conclusion:
    Thus, this then sorts out three GUIDs associated with the ESP:
    The Partition GUID code, the Partition unique GUID, and the GUID entry in your /etc/fstab for the /boot/esp filesystem.

    Last edited by Qqmike; Sep 28, 2024, 11:02 AM.
    An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

    Comment


      #3
      Originally posted by Qqmike View Post
      ...
      GUID --> GPT only --> partition,
      and
      UUID --> filesystem;
      ...
      I thought the term UUID applied everywhere, and that GUID is or was a Microsoft term for a UUID. Indeed, your wiki link for "globally unique identifier" redirects to the UUID article.

      However it's good to point out the fake UUID used by FAT file systems, and the difference between file system UUIDs and partition UUIDs.



      Regards, John Little

      Comment


        #4
        Originally posted by jlittle View Post
        I thought the term UUID applied everywhere, and that GUID is or was a Microsoft term for a UUID. Indeed, your wiki link for "globally unique identifier" redirects to the UUID article.
        See also https://stackoverflow.com/questions/...uid-and-a-uuid
        Windows no longer obstructs my view.
        Using Kubuntu Linux since March 23, 2007.
        "It is a capital mistake to theorize before one has data." - Sherlock Holmes

        Comment


          #5
          It is or can be confusing.
          If you want some scrambled brains this morning, search on things like,
          'difference between UUID and GUID?' 'is UUID the same as GUID?' etc.
          For sure, they are unique identifiers (except possibly for cloned disks).
          Rod Smith would be a good source to consult. (I'm sure I read his entire website at one time.)
          For my (practical) purposes,
          (1) Thankfully, whatever they are, they are automatically generated (and not by me!);
          (2) And whatever they are, I just need the right tool to explore them so I can identify the disks and bootloaders in lists like you get from efibootmgr.

          Thanks, guys, for looking over this stuff!
          An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

          Comment


            #6
            BTW, I had read your link at one time, Snowhog, and he points out some good (subtle) distinctions. Thanks.

            It's useful -- practical -- to think of them as (essentially unique) random numbers!
            An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

            Comment


              #7
              Originally posted by Qqmike View Post
              It's useful -- practical -- to think of them as (essentially unique) random numbers!
              I dislike them for not being human-readable. Sure you can work through the hex digits, but by the time you get to the end most mortals' short term memory has been flushed at least twice. I much prefer using my choice of labels or keys when I can.

              Regards, John Little

              Comment


                #8
                Yes, labels ... thumbs up on that! 👍👌
                An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

                Comment

                Working...
                X