summaryrefslogtreecommitdiff
path: root/tools/lvmcmdline.c
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2019-10-29 16:08:43 -0500
committerDavid Teigland <teigland@redhat.com>2019-11-27 11:13:47 -0600
commit3145a855836c4cf50d4b6064b3e6f1ce4a366aad (patch)
treea5409755ba31e9d334921874979effba42ec34b6 /tools/lvmcmdline.c
parent2e0f2730081554460328b3ac7e28080bd902535c (diff)
downloadlvm2-3145a855836c4cf50d4b6064b3e6f1ce4a366aad.tar.gz
pvck: repair headers and metadata
To write a new/repaired pv_header and label_header: pvck --repairtype pv_header --file <file> <device> This uses the metadata input file to find the PV UUID, device size, and data offset. To write new/repaired metadata text and mda_header: pvck --repairtype metadata --file <file> <device> This requires a good pv_header which points to one or two metadata areas. Any metadata areas referenced by the pv_header are updated with the specified metadata and a new mda_header. "--settings mda_num=1|2" can be used to select one mda to repair. To combine all header and metadata repairs: pvck --repair --file <file> <device> It's best to use a raw metadata file as input, that was extracted from another PV in the same VG (or from another metadata area on the same PV.) pvck will also accept a metadata backup file, but that will produce metadata that is not identical to other metadata copies on other PVs and other areas. So, when using a backup file, consider using it to update metadata on all PVs/areas. To get a raw metadata file to use for the repair, see pvck --dump metadata|metadata_search. List all instances of metadata from the metadata area: pvck --dump metadata_search <device> Save one instance of metadata at the given offset to the specified file (this file can be used for repair): pvck --dump metadata_search --file <file> --settings "metadata_offset=<off>" <device>
Diffstat (limited to 'tools/lvmcmdline.c')
-rw-r--r--tools/lvmcmdline.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 860e6de3a..3d79e9739 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1077,6 +1077,15 @@ int configtype_arg(struct cmd_context *cmd, struct arg_values *av)
return 0;
}
+int repairtype_arg(struct cmd_context *cmd, struct arg_values *av)
+{
+ if (!strcmp(av->value, "pv_header") ||
+ !strcmp(av->value, "metadata") ||
+ !strcmp(av->value, "label_header"))
+ return 1;
+ return 0;
+}
+
/*
* FIXME: there's been a confusing mixup among:
* resizeable, resizable, allocatable, allocation.