findfs \- find a filesystem by label or UUID
.SH SYNOPSIS
.B findfs
-.BI LABEL= label
-.sp
-.B findfs
-.BI UUID= uuid
+.BI NAME= value
.SH DESCRIPTION
.B findfs
-will search the disks in the system looking for a filesystem which has
-a label matching
-.I label
-or a UUID equal to
-.IR uuid .
-If the filesystem is found, the device name for the filesystem will
-be printed on stdout.
+will search the block devices in the system looking for a filesystem or
+partition with specified tag. The currently supported tags are:
+.TP
+.B LABEL=<label>
+Specifies filesystem label.
+.TP
+.B UUID=<uuid>
+Specifies filesystem UUID.
+.TP
+.B PARTUUID=<uuid>
+Specifies partition UUID. This partition identifier is supported for example for
+GUID Partition Table (GPT) partition tables.
+.TP
+.B PARTLABEL=<label>
+Specifies partition label (name). The partition labels are supported for example for
+GUID Partition Table (GPT) or MAC partition tables.
+.PP
+If the filesystem or partition is found, the device name will be printed on
+stdout.
+
+The complete overview about filesystems and partitions you can get for example
+by
+.RS
+
+.br
+.BI "lsblk \-\-fs"
+.br
+
+.BI "partx --show <disk>"
+.br
+
+.BI blkid
+.br
+
+.RE
+
.PP
.SH "EXIT STATUS"
.RS
enables debug output.
.SH SEE ALSO
.BR blkid (8),
-.BR fsck (8)
+.BR lsblk (8),
+.BR partx (8)
.SH AVAILABILITY
The findfs command is part of the util-linux package and is available from
.UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
{
FILE *out = rc ? stderr : stdout;
fputs(USAGE_HEADER, out);
- fprintf(out, _(" %1$s [options] LABEL=<label>\n"
- " %1$s [options] UUID=<uuid>\n"),
+ fprintf(out, _(" %s [options] {LABEL,UUID,PARTUUID,PARTLABEL}=<value>\n"),
program_invocation_short_name);
fputs(USAGE_OPTIONS, out);
fputs(USAGE_HELP, out);
int main(int argc, char **argv)
{
- char *dev, *tk, *vl;
+ char *dev;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
* with version from e2fsprogs */
usage(FINDFS_USAGE_ERROR);
- if (!strncmp(argv[1], "LABEL=", 6)) {
- tk = "LABEL";
- vl = argv[1] + 6;
- } else if (!strncmp(argv[1], "UUID=", 5)) {
- tk = "UUID";
- vl = argv[1] + 5;
- } else if (strcmp(argv[1], "-V") == 0 ||
+ if (strcmp(argv[1], "-V") == 0 ||
strcmp(argv[1], "--version") == 0) {
printf(UTIL_LINUX_VERSION);
return FINDFS_SUCCESS;
} else if (strcmp(argv[1], "-h") == 0 ||
strcmp(argv[1], "--help") == 0) {
usage(FINDFS_SUCCESS);
- } else
+ } else if (argv[1][0] == '-')
usage(FINDFS_USAGE_ERROR);
- dev = blkid_evaluate_tag(tk, vl, NULL);
+ dev = blkid_evaluate_tag(argv[1], NULL, NULL);
if (!dev)
errx(FINDFS_NOT_FOUND, _("unable to resolve '%s'"), argv[1]);