1PVCK(8)                     System Manager's Manual                    PVCK(8)
2
3
4

NAME

6       pvck - Check metadata on physical volumes
7

SYNOPSIS

9       pvck option_args position_args
10           [ option_args ]
11
12           --commandprofile String
13           --config String
14        -d|--debug
15           --driverloaded y|n
16           --dump headers|metadata|metadata_all|metadata_search
17        -f|--file String
18        -h|--help
19           --labelsector Number
20           --lockopt String
21           --longhelp
22           --nolocking
23           --profile String
24           --[pv]metadatacopies 0|1|2
25        -q|--quiet
26           --repair
27           --repairtype pv_header|metadata|label_header
28           --settings String
29        -t|--test
30        -v|--verbose
31           --version
32        -y|--yes
33

DESCRIPTION

35       pvck checks and repairs LVM metadata on PVs.
36
37
38   Dump options
39       headers
40       Print  LVM  on-disk  headers  and  structures: label_header, pv_header,
41       mda_header(s), and metadata text.  Warnings are printed if  any  values
42       are incorrect.  The label_header and pv_header both exist in a 512 byte
43       sector, usually the second sector of the device.  An mda_header  exists
44       in a 512 byte sector at offset 4096 bytes.  A second mda_header can op‐
45       tionally exist near the end of the device.  The metadata text exists in
46       an  area  (about  1MiB by default) immediately following the mda_header
47       sector.  The metadata text is checked but not printed  (see  other  op‐
48       tions).
49
50       metadata
51       Print the current LVM VG metadata text (or save to a file), using head‐
52       ers to locate the latest copy of metadata.   If  headers  are  damaged,
53       metadata  may  not  be  found  (see  metadata_search).   Use --settings
54       "mda_num=2" to look in mda2 (the second mda at the end of  the  device,
55       if  used).   The  metadata text is printed to stdout or saved to a file
56       with --file.
57
58       metadata_all
59       List all versions of VG metadata found  in  the  metadata  area,  using
60       headers to locate metadata.  Full copies of all metadata are saved to a
61       file with the --file option.  If headers are damaged, metadata may  not
62       be  found  (see metadata_search).  Use --settings "mda_num=2" as above.
63       Use -v to include descriptions and dates  when  listing  metadata  ver‐
64       sions.
65
66       metadata_search
67       List  all versions of VG metadata found in the metadata area, searching
68       common locations so metadata can be found if headers are damaged.  Full
69       copies  of all metadata are saved to a file with the --file option.  To
70       save one specific version of metadata,  use  --settings  "metadata_off‐
71       set=<offset>",  where  the  offset  is  taken from the list of versions
72       found.  Use -v to include descriptions and dates when listing  metadata
73       versions.
74
75       metadata_area
76       Save the entire text metadata area to a file without processing.
77
78
79   Repair options
80       --repair
81       Repair  headers  and metadata on a PV.  This uses a metadata input file
82       that was extracted by --dump, or a backup file (from  /etc/lvm/backup).
83       When possible, use metadata saved by --dump from another PV in the same
84       VG (or from a second metadata area on the PV).
85
86       There are cases where the PV UUID needs to be specified for the PV  be‐
87       ing  repaired.   It is specified using --settings "pv_uuid=<UUID>".  In
88       particular, if the device name for the PV being repaired does not match
89       the  previous device name of the PV, then LVM may not be able to deter‐
90       mine the correct PV UUID.  When headers are damaged on more than one PV
91       in  a VG, it is important for the user to determine the correct PV UUID
92       and specify it in --settings.  Otherwise, the wrong PV  UUID  could  be
93       used  if  device  names  have  been swapped since the metadata was last
94       written.
95
96       If a PV has no metadata areas and the pv_header is  damaged,  then  the
97       repair  will  not  know  to create no metadata areas during repair.  It
98       will by default repair metadata in mda1.  To repair  with  no  metadata
99       areas, use --settings "mda_offset=0 mda_size=0".
100
101       There  are cases where repair should be run on all PVs in the VG (using
102       the same metadata file):  if all PVs in the VG are damaged, if using an
103       old  metadata version, or if a backup file is used instead of raw meta‐
104       data (taken from pvck dump.)
105
106       Using --repair is equivalent to running --repairtype pv_header followed
107       by --repairtype metadata.
108
109       --repairtype pv_header
110       Repairs the header sector, containing the pv_header and label_header.
111
112       --repairtype metadata
113       Repairs  the  mda_header and metadata text.  It requires the headers to
114       be correct (having been undamaged or already repaired).
115
116       --repairtype label_header
117       Repairs label_header fields, leaving the pv_header (in the same sector)
118       unchanged.  (repairtype pv_header should usually be used instead.)
119
120
121   Settings
122       The  --settings option controls or overrides certain dump or repair be‐
123       haviors.  All offset and size values in settings are  in  bytes  (units
124       are not recognized.)  These settings are subject to change.
125
126       mda_num=1|2
127       Select  which metadata area should be used.  By default the first meta‐
128       data area (1) is used.  mda1 is always located at offset  4096.   mda2,
129       at the end of the device, often does not exist (it's not created by de‐
130       fault.) If mda1 is erased, mda2, if it exists, will  often  still  have
131       metadata.
132
133       metadata_offset=bytes
134       Select  metadata  text  at  this  offset.   Use with metadata_search to
135       print/save one instance of metadata text.
136
137       mda_offset=bytes mda_size=bytes
138       Refers to a metadata area (mda) location and size.  An mda includes  an
139       mda_header  and  circular  metadata  text  buffer.  Setting this forces
140       metadata_search look for metadata in the  given  area  instead  of  the
141       standard  locations.   When  set  to  zero with repair, it indicates no
142       metadata areas should exist.
143
144       mda2_offset=bytes mda2_size=bytes
145       When repairing a pv_header, this forces a specific offset and size  for
146       mda2 that should be recorded in the pv_header.
147
148       pv_uuid=uuid
149       Specify  the PV UUID of the device being repaired.  When not specified,
150       repair will attempt to determine the correct PV UUID by matching a  de‐
151       vice name in the metadata.
152
153       device_size=bytes
154       data_offset=bytes
155       When  repairing a pv_header, the device_size, data_offset, and pvid can
156       all be specified directly, in which case these  values  are  not  taken
157       from  a  metadata file (where they usually come from), and the metadata
158       file can be omitted.  data_offset is the starting location of the first
159       physical extent (data), which follows the first metadata area.
160
161

USAGE

163       Check for metadata on a device
164
165       pvck PV ...
166           [ COMMON_OPTIONS ]
167       -
168
169       Check and print LVM headers and metadata on a device
170
171       pvck --dump headers|metadata|metadata_all|metadata_search PV
172           [ -f|--file String ]
173           [    --settings String ]
174           [    --[pv]metadatacopies 0|1|2 ]
175           [ COMMON_OPTIONS ]
176       -
177
178       Repair LVM headers or metadata on a device
179
180       pvck --repairtype pv_header|metadata|label_header PV
181           [ -f|--file String ]
182           [    --settings String ]
183           [ COMMON_OPTIONS ]
184       -
185
186       Repair LVM headers and metadata on a device
187
188       pvck --repair -f|--file String PV
189           [    --settings String ]
190           [ COMMON_OPTIONS ]
191       -
192
193       Common options for command:
194           [    --labelsector Number ]
195
196       Common options for lvm:
197           [ -d|--debug ]
198           [ -h|--help ]
199           [ -q|--quiet ]
200           [ -t|--test ]
201           [ -v|--verbose ]
202           [ -y|--yes ]
203           [    --commandprofile String ]
204           [    --config String ]
205           [    --driverloaded y|n ]
206           [    --lockopt String ]
207           [    --longhelp ]
208           [    --nolocking ]
209           [    --profile String ]
210           [    --version ]
211

OPTIONS

213       --commandprofile String
214              The command profile to use for command configuration.  See
215              lvm.conf(5) for more information about profiles.
216
217       --config String
218              Config settings for the command. These override lvm.conf set‐
219              tings.  The String arg uses the same format as lvm.conf, or may
220              use section/field syntax.  See lvm.conf(5) for more information
221              about config.
222
223       -d|--debug ...
224              Set debug level. Repeat from 1 to 6 times to increase the detail
225              of messages sent to the log file and/or syslog (if configured).
226
227       --driverloaded y|n
228              If set to no, the command will not attempt to use device-mapper.
229              For testing and debugging.
230
231       --dump headers|metadata|metadata_all|metadata_search
232              Dump headers and metadata from a PV for debugging and repair.
233              Option values include: headers to print and check LVM headers,
234              metadata to print or save the current text metadata, meta‐
235              data_all to list or save all versions of metadata, meta‐
236              data_search to list or save all versions of metadata, searching
237              standard locations in case of damaged headers, metadata_area to
238              save an entire text metadata area to a file.
239
240       -f|--file String
241              Metadata file to read or write.
242
243       -h|--help
244              Display help text.
245
246       --labelsector Number
247              By default the PV is labelled with an LVM2 identifier in its
248              second sector (sector 1). This lets you use a different sector
249              near the start of the disk (between 0 and 3 inclusive - see LA‐
250              BEL_SCAN_SECTORS in the source). Use with care.
251
252       --lockopt String
253              Used to pass options for special cases to lvmlockd.  See lvm‐
254              lockd(8) for more information.
255
256       --longhelp
257              Display long help text.
258
259       --nolocking
260              Disable locking.
261
262       --profile String
263              An alias for --commandprofile or --metadataprofile, depending on
264              the command.
265
266       --[pv]metadatacopies 0|1|2
267              The number of metadata areas to set aside on a PV for storing VG
268              metadata.  When 2, one copy of the VG metadata is stored at the
269              front of the PV and a second copy is stored at the end.  When 1,
270              one copy of the VG metadata is stored at the front of the PV.
271              When 0, no copies of the VG metadata are stored on the given PV.
272              This may be useful in VGs containing many PVs (this places limi‐
273              tations on the ability to use vgsplit later.)
274
275       -q|--quiet ...
276              Suppress output and log messages. Overrides --debug and --ver‐
277              bose.  Repeat once to also suppress any prompts with answer
278              'no'.
279
280       --repair
281              Repair headers and metadata on a PV.
282
283       --repairtype pv_header|metadata|label_header
284              Repair headers and metadata on a PV. See command description.
285
286       --settings String
287              Specifies command specific settings in "Key = Value" form.  Com‐
288              bine multiple settings in quotes, or repeat the settings option
289              for each.
290
291       -t|--test
292              Run in test mode. Commands will not update metadata.  This is
293              implemented by disabling all metadata writing but nevertheless
294              returning success to the calling function. This may lead to un‐
295              usual error messages in multi-stage operations if a tool relies
296              on reading back metadata it believes has changed but hasn't.
297
298       -v|--verbose ...
299              Set verbose level. Repeat from 1 to 4 times to increase the de‐
300              tail of messages sent to stdout and stderr.
301
302       --version
303              Display version information.
304
305       -y|--yes
306              Do not prompt for confirmation interactively but always assume
307              the answer yes. Use with extreme caution.  (For automatic no,
308              see -qq.)
309

VARIABLES

311       PV
312              Physical  Volume  name,  a device path under /dev.  For commands
313              managing physical extents, a PV positional arg generally accepts
314              a suffix indicating a range (or multiple ranges) of physical ex‐
315              tents (PEs). When the first PE is omitted, it  defaults  to  the
316              start of the device, and when the last PE is omitted it defaults
317              to end.  Start and end range (inclusive):  PV[:PE-PE]...   Start
318              and length range (counting from 0): PV[:PE+PE]...
319
320       String
321              See the option description for information about the string con‐
322              tent.
323
324       Size[UNIT]
325              Size is an input number that accepts an  optional  unit.   Input
326              units are always treated as base two values, regardless of capi‐
327              talization, e.g. 'k' and 'K' both refer to  1024.   The  default
328              input unit is specified by letter, followed by |UNIT.  UNIT rep‐
329              resents other possible input units:  bBsSkKmMgGtTpPeE.   b|B  is
330              bytes,  s|S is sectors of 512 bytes, k|K is KiB, m|M is MiB, g|G
331              is GiB, t|T is TiB, p|P is PiB, e|E is EiB.  (This should not be
332              confused  with the output control --units, where capital letters
333              mean multiple of 1000.)
334

ENVIRONMENT VARIABLES

336       See lvm(8) for information about environment  variables  used  by  lvm.
337       For example, LVM_VG_NAME can generally be substituted for a required VG
338       parameter.
339

EXAMPLES

341       If the partition table is corrupted or lost on /dev/sda, and  you  sus‐
342       pect  there  was  an  LVM partition at approximately 100 MiB, then this
343       area of the disk can be scanned using the --labelsector parameter  with
344       a value of 204800 (100 * 1024 * 1024 / 512 = 204800).
345       pvck --labelsector 204800 /dev/sda
346

SEE ALSO

348       lvm(8) lvm.conf(5) lvmconfig(8)
349
350       pvchange(8)  pvck(8)  pvcreate(8)  pvdisplay(8)  pvmove(8)  pvremove(8)
351       pvresize(8) pvs(8) pvscan(8)
352
353       vgcfgbackup(8) vgcfgrestore(8) vgchange(8) vgck(8)  vgcreate(8)  vgcon‐
354       vert(8)  vgdisplay(8)  vgexport(8)  vgextend(8)  vgimport(8)  vgimport‐
355       clone(8) vgmerge(8) vgmknodes(8)  vgreduce(8)  vgremove(8)  vgrename(8)
356       vgs(8) vgscan(8) vgsplit(8)
357
358       lvcreate(8)  lvchange(8)  lvconvert(8)  lvdisplay(8)  lvextend(8) lvre‐
359       duce(8) lvremove(8) lvrename(8) lvresize(8) lvs(8) lvscan(8)
360
361       lvm-fullreport(8) lvm-lvpoll(8) lvm2-activation-generator(8) blkdeacti‐
362       vate(8) lvmdump(8)
363
364       dmeventd(8)  lvmpolld(8)  lvmlockd(8)  lvmlockctl(8)  cmirrord(8) lvmd‐
365       busd(8)
366
367       lvmsystemid(7) lvmreport(7) lvmraid(7) lvmthin(7) lvmcache(7)
368
369
370
371Red Hat, Inc.          LVM TOOLS 2.03.11(2) (2021-01-08)               PVCK(8)
Impressum