Disk
findfs
Find a filesystem by label or UUID.
filesystemlabeluuiddiskfind
Additional Notes
findfs searches the system's block devices for a filesystem matching a given label or UUID and prints the device path. It is a simple wrapper that uses the blkid library to locate the device. It is commonly used in initramfs scripts and /etc/fstab entries to resolve LABEL= or UUID= references to device nodes.
The search examines all available block devices, including disks, partitions, and logical volumes. It prints the first match and returns an exit code of 0 on success or 1 if no match is found.
Syntax
findfs search-parameter
Parameters
search-parameter: EitherLABEL=labelnameorUUID=uuid-stringto search for.
Examples
findfs LABEL=root
Find the device with the filesystem label root.
findfs UUID=123e4567-e89b-12d3-a456-426614174000
Find the device with the specified UUID.
Practical Notes
- The output is a device path such as
/dev/sda1or/dev/mapper/vg-root. findfssearches all visible block devices, not just those listed in/etc/fstab.- If multiple devices have the same label,
findfsreturns the first match found. - Use
blkidfor more detailed information about filesystem attributes. - In scripts, use
findfsto dynamically resolve filesystem references at runtime. - For persistent device naming, prefer UUIDs over labels since labels are not guaranteed unique.