33

In the blkid output, some lines contain UUID and PARTUUID pairs and others only PTUUID. What do they mean?

In particular, why are two IDs required for a partition and why are some partitions identified by UUID/PARTUUID and some by PTUUID?

  • 1
    https://www.kernel.org/pub/linux/utils/util-linux/v2.25/libblkid-docs/libblkid-Partitions-probing.html#libblkid-Partitions-probing.description – don_crissti Jul 05 '17 at 18:38
  • 1
    @don_crissti I've seen that page in Google, but it doesn't explain anything. – anatoly techtonik Jul 05 '17 at 18:40
  • 2
    What kind of "explanation" do you need, other than the description of PTUUID and PART_ENTRY_UUID (aka PARTUUID) ? – don_crissti Jul 05 '17 at 18:45
  • PARTUUID identifies a GPT partition (like /dev/sdbX). UUID identifies a filesystem. Not sure about PTUUID.. Maybe identifies a GPT device (like /dev/sdX)? – Pozinux Sep 23 '17 at 15:03

1 Answers1

45

UUID is a filesystem-level UUID, which is retrieved from the filesystem metadata inside the partition. It can only be read if the filesystem type is known and readable.

PARTUUID is a partition-table-level UUID for the partition, a standard feature for all partitions on GPT-partitioned disks. Since it is retrieved from the partition table, it is accessible without making any assumptions at all about the actual contents of the partition. If the partition is encrypted using some unknown encryption method, this might be the only accessible unique identifier for that particular partition.

PTUUID is the UUID of the partition table itself, a unique identifier for the entire disk assigned at the time the disk was partitioned. It is the equivalent of the disk signature on MBR-partitioned disks but with more bits and a standardized procedure for its generation.

On MBR-partitioned disks, there are no UUIDs in the partition table. The 32-bit disk signature is used in place of a PTUUID, and PARTUUIDs are created by adding a dash and a two-digit partition number to the end of the disk signature.

mcrute
  • 105
telcoM
  • 96,466
  • 3
    Can that PARTUUID be used in e.g. /etc/fstab like UUID? – jarno May 23 '20 at 08:14
  • 4
    @jarno According to man fstab on my Debian 10 system, yes. If you use a different distribution, check the man page on your system to verify. – telcoM May 23 '20 at 10:41
  • Here it also says that "Note that mount(8) uses UUIDs as strings. The string representation of the UUID should be based on lower case characters." However, at least in one case also capital letters seem to work. – jarno May 23 '20 at 14:14
  • Is it possible to change or replace PTUUID and PARTUUID using dd? – Yousha Aleayoub Oct 08 '20 at 06:11
  • 3
    @YoushaAleayoub It's technically possible, but very awkward to do, since you must calculate the location of each PTUUID and also recalculate and replace a CRC32 checksum after making a change. It'll be much easier to use the expert commands of fdisk that is of a recent enough version to support GPT partitioning: x then i to change PTUUID, or x then u to change PARTUUID of a specific partition. – telcoM Oct 08 '20 at 06:24