Device names can move when storage order changes, but the filesystem UUID stays with the formatted volume. Reading that identifier before editing mounts, boot entries, or recovery notes keeps a Linux system pointed at the intended partition instead of whichever device name appears first.
The UUID shown by lsblk and blkid is filesystem metadata. It is the value used by UUID=… entries in /etc/fstab, mount commands, and many installer or recovery tools. It is separate from PARTUUID, which comes from the partition table and is only the right value when the target configuration explicitly uses PARTUUID=….
Use the partition, logical volume, or mapped device that contains the filesystem, not the parent disk, unless the filesystem was created directly on that whole-disk node. A blank UUID usually means the selected node has no filesystem signature, the device is encrypted or layered below another mapped device, or the metadata is not visible to the running system.
Steps to get a disk or partition UUID in Linux:
- List filesystem identifiers for visible block devices.
$ lsblk --fs --list NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS sda sda1 vfat FAT32 EFI 35A7-16B2 505M 1% /boot/efi sda2 ext4 1.0 root 41c22818-fbad-4da6-8196-c816df0b7aa8 42G 38% / sdb sdb1 ext4 1.0 data 90e3b518-5ab8-4162-b977-25346b1ef034 56G 12% /mnt/data
Use the row for the filesystem device, such as sdb1, nvme1n1p1, or a logical volume under /dev/mapper. Parent disks such as sdb often have no filesystem UUID.
- Read the exact filesystem metadata from the target device.
$ sudo blkid /dev/sdb1 /dev/sdb1: LABEL="data" UUID="90e3b518-5ab8-4162-b977-25346b1ef034" BLOCK_SIZE="4096" TYPE="ext4"
The UUID field is the filesystem identifier. If the target config uses PARTUUID=… instead, use the partition-table identifier from that same device only for that specific config.
- Print only the filesystem UUID when a configuration file or script needs the raw value.
$ sudo blkid -s UUID -o value /dev/sdb1 90e3b518-5ab8-4162-b977-25346b1ef034
If blkid prints no UUID, verify that the path points to the filesystem itself and not only to a whole-disk device that contains partitions.
- Confirm that a mounted filesystem with that UUID resolves to the expected device and mount point.
$ findmnt --source UUID=90e3b518-5ab8-4162-b977-25346b1ef034 --output TARGET,SOURCE,FSTYPE,OPTIONS TARGET SOURCE FSTYPE OPTIONS /mnt/data /dev/sdb1 ext4 rw,relatime
findmnt searches mounted filesystems. It prints nothing for an unmounted volume even when blkid can read the filesystem UUID.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.