diff options
author | Karel Zak | 2014-03-28 10:36:05 +0100 |
---|---|---|
committer | Karel Zak | 2014-03-28 10:36:05 +0100 |
commit | c48508c2faa356c48c26d7d0070a6f20ae4ba9a0 (patch) | |
tree | 9e60a32ca2ba8ac140a239d54048675d9945a662 /misc-utils | |
parent | findfs: use symbolic exit values, and tell about them in manual (diff) | |
download | kernel-qcow2-util-linux-c48508c2faa356c48c26d7d0070a6f20ae4ba9a0.tar.gz kernel-qcow2-util-linux-c48508c2faa356c48c26d7d0070a6f20ae4ba9a0.tar.xz kernel-qcow2-util-linux-c48508c2faa356c48c26d7d0070a6f20ae4ba9a0.zip |
findfs: add ability to work with PART{UUID,LABEL}= too
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils')
-rw-r--r-- | misc-utils/findfs.8 | 51 | ||||
-rw-r--r-- | misc-utils/findfs.c | 17 |
2 files changed, 44 insertions, 24 deletions
diff --git a/misc-utils/findfs.8 b/misc-utils/findfs.8 index 1469df2dc..32b74b423 100644 --- a/misc-utils/findfs.8 +++ b/misc-utils/findfs.8 @@ -7,19 +7,45 @@ 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 @@ -50,7 +76,8 @@ Karel Zak 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/ diff --git a/misc-utils/findfs.c b/misc-utils/findfs.c index 23d121b0b..59f9ce072 100644 --- a/misc-utils/findfs.c +++ b/misc-utils/findfs.c @@ -25,8 +25,7 @@ static void __attribute__((__noreturn__)) usage(int rc) { 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); @@ -37,7 +36,7 @@ static void __attribute__((__noreturn__)) usage(int rc) int main(int argc, char **argv) { - char *dev, *tk, *vl; + char *dev; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); @@ -49,23 +48,17 @@ int main(int argc, char **argv) * 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]); |