- Unix Commands Reference
- Unix Commands - Home
findfs Command in Linux
The Linux findfs command finds the filesystem by label and UUID. The label and UUID are unique identifiers of the filesystem or partition. The label is a human-readable name, while the UUID (Universally Unique Identifier) is a long, 128-bit unique identifier that is automatically generated. The label can be changed using various tools, however, the UUID cannot be modified.
Table of Contents
Here is a comprehensive guide to the options available with the findfs command −
- Syntax of findfs Command
- Options of findfs Command
- Understanding Linux Filesystem and Partition Identifiers
- Examples of findfs Command in Linux
Syntax of findfs Command
The syntax of the Linux findfs command is as follows −
findfs NAME=value
The NAME can be a LABEL, UUID, PARTUUID, and PARTLABEL in the above given syntax. The value is used to specify the corresponding identifier. These identifiers can be obtained from various Linux tools.
Options of findfs Command
The options for the findfs command are listed in the table below −
Flags | Options | Description |
---|---|---|
-h | --help | It is used to display the help related to the command |
-v | --version | It is used to display the version of the command |
Understanding Linux Filesystem and Partition Identifiers
In Linux, the filesystem and partitions are assigned unique identifiers to manage system storage effectively. Commonly used identifiers include device files, such as /dev/sda and /dev/vda. Note that device file names may change upon boot.
Another identifier is the LABEL, a human-readable name for the filesystem. Partitions can have their own labels, referred to as PARTLABEL. Labels can be modified using tools like e2label.
The UUID (Universally Unique Identifier) is a globally unique identifier for the filesystem and cannot be changed. Partitions have their own UUIDs, referred to as PARTUUIDs. The PARTUUID uniquely identifies a partition regardless of its filesystem. In Linux, these identifiers can be listed using different tools, such as lsblk, partx, or blkid.
To list filesystem identifiers using lsblk, use the following command −
lsblk -fs
This command gives information about LABELs, UUIDs, PARTUUIDs, mount points, and filesystem types. To list specific fields, use the -o flag. For example, to list only NAME, LABEL, and UUIDs of /dev/vda, use the following command −
lsblk -o NAME,LABEL,UUID /dev/vda
With the partx command, use the -s or --show options along with the device name −
partx --show /dev/vda
To list filesystems and partitions using the blkid command, use −
blkid
Examples of findfs Command in Linux
This section demonstrates the usage of the findfs command in Linux through various examples −
- Finding Filesystem using LABEL
- Finding Filesystem using UUID
- Displaying Help
Finding Filesystem using LABEL
To find the filesystem using the LABEL, first identify the label. For example, to find the filesystem by label MyData, use −
findfs LABEL=MyData
Similarly, to find the filesystem of a partition using the PARTLABEL identifier, use the findfs command in the following way −
findfs PARTLABEL=PART_DATA
Finding Filesystem using UUID
To find the filesystem using the UUID, use the UUID name with the identifier value. For example, to find the filesystem of UUID, e625beb1-4c0c-44a9-af8a-e98a642bcf20, use the command mentioned below −
findfs UUID=e625beb1-4c0c-44a9-af8a-e98a642bcf20
In the same manner, to find the filesystem associated with a partition using PARTUUID, use −
findfs PARTUUID=d3f5c9bf-55e6-4478-8fdb-cd9def2c4cf1
Displaying Help
To display a brief help of findfs command, use the -h or --help options −
findfs -h
Conclusion
The findfs command in Linux is used to identify the filesystem by LABEL or UUID. It is a useful approach for automatic disk management because the device file names keep on changing. However, the identifiers remain unique.
In this tutorial, we explained the findfs command, its syntax, options, and usage in Linux through examples.