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
45       optionally exist near the end of the device.  The metadata text  exists
46       in an area (about 1MiB by default) immediately following the mda_header
47       sector.  The metadata text  is  checked  but  not  printed  (see  other
48       options).
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
87       being 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
123       behaviors.  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
130       default.) 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
151       device 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
250              LABEL_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
295              unusual error messages in multi-stage operations if a tool
296              relies on reading back metadata it believes has changed but
297              hasn't.
298
299       -v|--verbose ...
300              Set verbose level. Repeat from 1 to 4 times to increase the
301              detail of messages sent to stdout and stderr.
302
303       --version
304              Display version information.
305
306       -y|--yes
307              Do not prompt for confirmation interactively but always assume
308              the answer yes. Use with extreme caution.  (For automatic no,
309              see -qq.)
310

VARIABLES

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

ENVIRONMENT VARIABLES

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

EXAMPLES

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

SEE ALSO

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