findfs
Find filesystem by label or UUID
TLDR
Search block devices by filesystem label
Search by filesystem UUID
Search by partition label (GPT or MAC partition table)
Search by partition UUID (GPT partition table only)
SYNOPSIS
findfs LABEL=label
OR
findfs UUID=uuid
PARAMETERS
LABEL=
Specifies the filesystem label to search for. The label is a user-defined string assigned to the filesystem, often set during its creation or with utilities like tune2fs.
UUID=
Specifies the Universal Unique Identifier (UUID) of the filesystem to search for. UUIDs are globally unique 128-bit numbers automatically generated during filesystem creation and are highly recommended for persistent identification.
DESCRIPTION
The findfs command is a utility used to locate a block device (e.g., a partition or an entire disk) that contains a filesystem identified by its specific label or Universal Unique Identifier (UUID). Traditional device names like /dev/sda1 can change across reboots or hardware configurations, making them unreliable for persistent system configuration. findfs addresses this by allowing you to refer to filesystems by their persistent label or UUID, which remain constant regardless of the device's assigned name.
It scans known locations like /etc/fstab, /proc/partitions, or directly probes block devices to find a match. Upon success, it prints the full path to the device node (e.g., /dev/sdb1) to standard output. This makes it invaluable for system scripts, bootloaders, and entries in /etc/fstab to ensure correct filesystem identification and mounting.
CAVEATS
findfs typically requires root privileges to scan all block devices directly. Without them, it might rely solely on information available in /etc/fstab or /proc/partitions, which might not be exhaustive.
It prints only the first matching device path it finds. If multiple filesystems (which is generally discouraged, especially for UUIDs) happen to have the same identifier, only the first one encountered will be returned.
On systems with a very large number of block devices, a full scan could be relatively slow, although this is rarely a practical concern for typical usage.
COMMON USE CASES
findfs is frequently used in system scripts, boot scripts, backup routines, or any automation where a filesystem needs to be located reliably without hardcoding device paths. Although /etc/fstab itself directly supports LABEL= or UUID= entries, findfs provides the underlying lookup mechanism for such persistent identifiers. For example, a script might use `mount $(findfs LABEL=my_data_disk) /mnt/data` to dynamically mount a specific disk.
HOW TO GET LABEL/UUID
You can find the labels and UUIDs of your filesystems using commands like blkid or lsblk -f. For example, `blkid /dev/sda1` will show the UUID and LABEL of that specific partition, or `lsblk -f` will list this information for all block devices.
HISTORY
findfs is a long-standing utility part of the util-linux project, a widely used collection of essential system utilities for Linux. Its development has focused on providing a robust and reliable method for identifying filesystems independent of volatile device names, aligning with the broader goal of modern Linux systems to use persistent identifiers for storage.