0

I get the following results for the 3 commands blkid, lsblk and sfdisk on an Arch Linux system

$ lsblk --json -p -b -o+PTUUID,UUID /dev/sda1
{
   "blockdevices": [
      {
         "name": "/dev/sda1",
         "maj:min": "8:1",
         "rm": false,
         "size": 535822336,
         "ro": false,
         "type": "part",
         "mountpoints": [
             null
         ],
         "ptuuid": "772eba14-e67c-40d8-8ddd-2317d5a4156d",
         "uuid": "6BCD-C870"
      }
   ]
}
$ blkid /dev/sda1
/dev/sda1: 
UUID="6BCD-C870" 
BLOCK_SIZE="512" 
TYPE="vfat" 
PARTLABEL="primary" 
PARTUUID="47948fda-bd1d-4dee-9d9a-ab0da02b08b2"
sfdisk --json /dev/sda
{
   "partitiontable": {
      "label": "gpt",
      "id": "772EBA14-E67C-40D8-8DDD-2317D5A4156D",
      "device": "/dev/sda",
      "unit": "sectors",
      "firstlba": 34,
      "lastlba": 937701342,
      "sectorsize": 512,
      "partitions": [
         {
            "node": "/dev/sda1",
            "start": 2048,
            "size": 1046528,
            "type": "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7",
            "uuid": "47948FDA-BD1D-4DEE-9D9A-AB0DA02B08B2",
            "name": "primary"
         }
      ]
   }
}

I'm mainly interested in the UUID and PTUUID which for the above output does not seem to match between the commands.

         PTUUID                                   UUID
lsblk    772eba14-e67c-40d8-8ddd-2317d5a4156d     6BCD-C870
blkid    47948fda-bd1d-4dee-9d9a-ab0da02b08b2     6BCD-C870
sfdisk                                            47948FDA-BD1D-4DEE-9D9A-AB0DA02B08B2

Could someone explain why they are different and can which one can be trusted, if any?

wasp256
  • 215
  • 5
  • 15
  • https://wiki.archlinux.org/title/persistent_block_device_naming In Ubuntu which I use, it is partUUID, but is really the partition's GUID when using gpt partitioning. Gpt has several GUIDs. One is unique to partition, and one is a partition type. https://en.wikipedia.org/wiki/GUID_Partition_Table If your ptuuid is the unique one, you can use it. UEFI uses GUID to know which partition is ESP. But most Linux commands use UUID or labels. But now many commands are updated to also use the GUID. – oldfred Jun 15 '22 at 14:21
  • Just checked in Ubuntu and man lsblk -help shows this: " PTUUID partition table identifier (usually UUID) PTTYPE partition table type " – oldfred Jun 15 '22 at 15:59

0 Answers0