|
|
b394b9 |
From 2555bd3bad9ea8e7ae40a727f59bb546d2aa2717 Mon Sep 17 00:00:00 2001
|
|
|
b394b9 |
From: Karel Zak <kzak@redhat.com>
|
|
|
b394b9 |
Date: Fri, 28 Mar 2014 10:36:05 +0100
|
|
|
b394b9 |
Subject: [PATCH 69/84] findfs: add ability to work with PART{UUID,LABEL}= too
|
|
|
b394b9 |
|
|
|
b394b9 |
Upstream: http://github.com/karelzak/util-linux/commit/c48508c2faa356c48c26d7d0070a6f20ae4ba9a0
|
|
|
b394b9 |
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1335671
|
|
|
b394b9 |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
b394b9 |
---
|
|
|
b394b9 |
misc-utils/findfs.8 | 51 +++++++++++++++++++++++++++++++++++++++------------
|
|
|
b394b9 |
misc-utils/findfs.c | 17 +++++------------
|
|
|
b394b9 |
2 files changed, 44 insertions(+), 24 deletions(-)
|
|
|
b394b9 |
|
|
|
b394b9 |
diff --git a/misc-utils/findfs.8 b/misc-utils/findfs.8
|
|
|
b394b9 |
index 8a6bca1..b92cd45 100644
|
|
|
b394b9 |
--- a/misc-utils/findfs.8
|
|
|
b394b9 |
+++ b/misc-utils/findfs.8
|
|
|
b394b9 |
@@ -7,19 +7,45 @@
|
|
|
b394b9 |
findfs \- find a filesystem by label or UUID
|
|
|
b394b9 |
.SH SYNOPSIS
|
|
|
b394b9 |
.B findfs
|
|
|
b394b9 |
-.BI LABEL= label
|
|
|
b394b9 |
-.sp
|
|
|
b394b9 |
-.B findfs
|
|
|
b394b9 |
-.BI UUID= uuid
|
|
|
b394b9 |
+.BI NAME= value
|
|
|
b394b9 |
.SH DESCRIPTION
|
|
|
b394b9 |
.B findfs
|
|
|
b394b9 |
-will search the disks in the system looking for a filesystem which has
|
|
|
b394b9 |
-a label matching
|
|
|
b394b9 |
-.I label
|
|
|
b394b9 |
-or a UUID equal to
|
|
|
b394b9 |
-.IR uuid .
|
|
|
b394b9 |
-If the filesystem is found, the device name for the filesystem will
|
|
|
b394b9 |
-be printed on stdout.
|
|
|
b394b9 |
+will search the block devices in the system looking for a filesystem or
|
|
|
b394b9 |
+partition with specified tag. The currently supported tags are:
|
|
|
b394b9 |
+.TP
|
|
|
b394b9 |
+.B LABEL=<label>
|
|
|
b394b9 |
+Specifies filesystem label.
|
|
|
b394b9 |
+.TP
|
|
|
b394b9 |
+.B UUID=<uuid>
|
|
|
b394b9 |
+Specifies filesystem UUID.
|
|
|
b394b9 |
+.TP
|
|
|
b394b9 |
+.B PARTUUID=<uuid>
|
|
|
b394b9 |
+Specifies partition UUID. This partition identifier is supported for example for
|
|
|
b394b9 |
+GUID Partition Table (GPT) partition tables.
|
|
|
b394b9 |
+.TP
|
|
|
b394b9 |
+.B PARTLABEL=<label>
|
|
|
b394b9 |
+Specifies partition label (name). The partition labels are supported for example for
|
|
|
b394b9 |
+GUID Partition Table (GPT) or MAC partition tables.
|
|
|
b394b9 |
+.PP
|
|
|
b394b9 |
+If the filesystem or partition is found, the device name will be printed on
|
|
|
b394b9 |
+stdout.
|
|
|
b394b9 |
+
|
|
|
b394b9 |
+The complete overview about filesystems and partitions you can get for example
|
|
|
b394b9 |
+by
|
|
|
b394b9 |
+.RS
|
|
|
b394b9 |
+
|
|
|
b394b9 |
+.br
|
|
|
b394b9 |
+.BI "lsblk \-\-fs"
|
|
|
b394b9 |
+.br
|
|
|
b394b9 |
+
|
|
|
b394b9 |
+.BI "partx --show <disk>"
|
|
|
b394b9 |
+.br
|
|
|
b394b9 |
+
|
|
|
b394b9 |
+.BI blkid
|
|
|
b394b9 |
+.br
|
|
|
b394b9 |
+
|
|
|
b394b9 |
+.RE
|
|
|
b394b9 |
+
|
|
|
b394b9 |
.PP
|
|
|
b394b9 |
.SH AUTHOR
|
|
|
b394b9 |
.B findfs
|
|
|
b394b9 |
@@ -30,7 +56,8 @@ the util-linux package by Karel Zak (kzak@redhat.com).
|
|
|
b394b9 |
enables debug output.
|
|
|
b394b9 |
.SH SEE ALSO
|
|
|
b394b9 |
.BR blkid (8),
|
|
|
b394b9 |
-.BR fsck (8)
|
|
|
b394b9 |
+.BR lsblk (8),
|
|
|
b394b9 |
+.BR partx (8)
|
|
|
b394b9 |
.SH AVAILABILITY
|
|
|
b394b9 |
The findfs command is part of the util-linux package and is available from
|
|
|
b394b9 |
ftp://ftp.kernel.org/pub/linux/utils/util-linux/.
|
|
|
b394b9 |
diff --git a/misc-utils/findfs.c b/misc-utils/findfs.c
|
|
|
b394b9 |
index bc4a843..29ca1cb 100644
|
|
|
b394b9 |
--- a/misc-utils/findfs.c
|
|
|
b394b9 |
+++ b/misc-utils/findfs.c
|
|
|
b394b9 |
@@ -19,8 +19,7 @@ static void __attribute__((__noreturn__)) usage(int rc)
|
|
|
b394b9 |
{
|
|
|
b394b9 |
FILE *out = rc ? stderr : stdout;
|
|
|
b394b9 |
fputs(USAGE_HEADER, out);
|
|
|
b394b9 |
- fprintf(out, _(" %1$s [options] LABEL=<label>\n"
|
|
|
b394b9 |
- " %1$s [options] UUID=<uuid>\n"),
|
|
|
b394b9 |
+ fprintf(out, _(" %s [options] {LABEL,UUID,PARTUUID,PARTLABEL}=<value>\n"),
|
|
|
b394b9 |
program_invocation_short_name);
|
|
|
b394b9 |
fputs(USAGE_OPTIONS, out);
|
|
|
b394b9 |
fputs(USAGE_HELP, out);
|
|
|
b394b9 |
@@ -31,7 +30,7 @@ static void __attribute__((__noreturn__)) usage(int rc)
|
|
|
b394b9 |
|
|
|
b394b9 |
int main(int argc, char **argv)
|
|
|
b394b9 |
{
|
|
|
b394b9 |
- char *dev, *tk, *vl;
|
|
|
b394b9 |
+ char *dev;
|
|
|
b394b9 |
|
|
|
b394b9 |
setlocale(LC_ALL, "");
|
|
|
b394b9 |
bindtextdomain(PACKAGE, LOCALEDIR);
|
|
|
b394b9 |
@@ -43,23 +42,17 @@ int main(int argc, char **argv)
|
|
|
b394b9 |
* with version from e2fsprogs */
|
|
|
b394b9 |
usage(2);
|
|
|
b394b9 |
|
|
|
b394b9 |
- if (!strncmp(argv[1], "LABEL=", 6)) {
|
|
|
b394b9 |
- tk = "LABEL";
|
|
|
b394b9 |
- vl = argv[1] + 6;
|
|
|
b394b9 |
- } else if (!strncmp(argv[1], "UUID=", 5)) {
|
|
|
b394b9 |
- tk = "UUID";
|
|
|
b394b9 |
- vl = argv[1] + 5;
|
|
|
b394b9 |
- } else if (strcmp(argv[1], "-V") == 0 ||
|
|
|
b394b9 |
+ if (strcmp(argv[1], "-V") == 0 ||
|
|
|
b394b9 |
strcmp(argv[1], "--version") == 0) {
|
|
|
b394b9 |
printf(UTIL_LINUX_VERSION);
|
|
|
b394b9 |
return EXIT_SUCCESS;
|
|
|
b394b9 |
} else if (strcmp(argv[1], "-h") == 0 ||
|
|
|
b394b9 |
strcmp(argv[1], "--help") == 0) {
|
|
|
b394b9 |
usage(EXIT_SUCCESS);
|
|
|
b394b9 |
- } else
|
|
|
b394b9 |
+ } else if (argv[1][0] == '-')
|
|
|
b394b9 |
usage(2);
|
|
|
b394b9 |
|
|
|
b394b9 |
- dev = blkid_evaluate_tag(tk, vl, NULL);
|
|
|
b394b9 |
+ dev = blkid_evaluate_tag(argv[1], NULL, NULL);
|
|
|
b394b9 |
if (!dev)
|
|
|
b394b9 |
errx(EXIT_FAILURE, _("unable to resolve '%s'"), argv[1]);
|
|
|
b394b9 |
|
|
|
b394b9 |
--
|
|
|
b394b9 |
2.7.4
|
|
|
b394b9 |
|