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           --devices PV
16           --devicesfile String
17           --driverloaded y|n
18           --dump headers|metadata|metadata_all|metadata_search
19        -f|--file String
20        -h|--help
21           --journal String
22           --labelsector Number
23           --lockopt String
24           --longhelp
25           --nohints
26           --nolocking
27           --profile String
28           --[pv]metadatacopies 0|1|2
29        -q|--quiet
30           --repair
31           --repairtype pv_header|metadata|label_header
32           --settings String
33        -t|--test
34        -v|--verbose
35           --version
36        -y|--yes
37

DESCRIPTION

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

USAGE

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

OPTIONS

221       --commandprofile String
222              The  command  profile  to  use  for  command configuration.  See
223              lvm.conf(5) for more information about profiles.
224
225       --config String
226              Config settings for the command. These override lvm.conf(5) set‐
227              tings.   The  String arg uses the same format as lvm.conf(5), or
228              may use section/field syntax.  See lvm.conf(5) for more informa‐
229              tion about config.
230
231       -d|--debug ...
232              Set debug level. Repeat from 1 to 6 times to increase the detail
233              of messages sent to the log file and/or syslog (if configured).
234
235       --devices PV
236              Restricts the devices that are visible  and  accessible  to  the
237              command.  Devices not listed will appear to be missing. This op‐
238              tion can be repeated, or accepts a comma separated list  of  de‐
239              vices. This overrides the devices file.
240
241       --devicesfile String
242              A file listing devices that LVM should use.  The file must exist
243              in /etc/lvm/devices/ and is managed with the lvmdevices(8)  com‐
244              mand.   This  overrides  the lvm.conf(5) devices/devicesfile and
245              devices/use_devicesfile settings.
246
247       --driverloaded y|n
248              If set to no, the command will not attempt to use device-mapper.
249              For testing and debugging.
250
251       --dump headers|metadata|metadata_all|metadata_search
252              Dump  headers  and  metadata from a PV for debugging and repair.
253              Option values include: headers to print and check  LVM  headers,
254              metadata  to  print  or  save the current text metadata, metada‐
255              ta_all to list or save all versions of metadata, metadata_search
256              to list or save all versions of metadata, searching standard lo‐
257              cations in case of damaged headers, metadata_area to save an en‐
258              tire text metadata area to a file.
259
260       -f|--file String
261              Metadata file to read or write.
262
263       -h|--help
264              Display help text.
265
266       --journal String
267              Record  information in the systemd journal.  This information is
268              in addition to information enabled by the  lvm.conf  log/journal
269              setting.   command:  record information about the command.  out‐
270              put: record the default command output.  debug: record full com‐
271              mand debugging.
272
273       --labelsector Number
274              By  default  the  PV  is labelled with an LVM2 identifier in its
275              second sector (sector 1). This lets you use a  different  sector
276              near  the start of the disk (between 0 and 3 inclusive - see LA‐
277              BEL_SCAN_SECTORS in the source). Use with care.
278
279       --lockopt String
280              Used to pass options for special cases to  lvmlockd.   See  lvm‐
281              lockd(8) for more information.
282
283       --longhelp
284              Display long help text.
285
286       --nohints
287              Do  not  use the hints file to locate devices for PVs. A command
288              may read more devices to find PVs when hints are not  used.  The
289              command will still perform standard hint file invalidation where
290              appropriate.
291
292       --nolocking
293              Disable locking. Use with caution, concurrent commands may  pro‐
294              duce incorrect results.
295
296       --profile String
297              An alias for --commandprofile or --metadataprofile, depending on
298              the command.
299
300       --[pv]metadatacopies 0|1|2
301              The number of metadata areas to set aside on a PV for storing VG
302              metadata.   When 2, one copy of the VG metadata is stored at the
303              front of the PV and a second copy is stored at the end.  When 1,
304              one  copy  of  the VG metadata is stored at the front of the PV.
305              When 0, no copies of the VG metadata are stored on the given PV.
306              This may be useful in VGs containing many PVs (this places limi‐
307              tations on the ability to use vgsplit later.)
308
309       -q|--quiet ...
310              Suppress output and log messages. Overrides --debug  and  --ver‐
311              bose.   Repeat  once  to  also  suppress any prompts with answer
312              'no'.
313
314       --repair
315              Repair headers and metadata on a PV.
316
317       --repairtype pv_header|metadata|label_header
318              Repair headers and metadata on a PV. See command description.
319
320       --settings String
321              Specifies command specific settings in "Key = Value" form.  Com‐
322              bine  multiple settings in quotes, or repeat the settings option
323              for each.
324
325       -t|--test
326              Run in test mode. Commands will not update  metadata.   This  is
327              implemented  by  disabling all metadata writing but nevertheless
328              returning success to the calling function. This may lead to  un‐
329              usual  error messages in multi-stage operations if a tool relies
330              on reading back metadata it believes has changed but hasn't.
331
332       -v|--verbose ...
333              Set verbose level. Repeat from 1 to 4 times to increase the  de‐
334              tail of messages sent to stdout and stderr.
335
336       --version
337              Display version information.
338
339       -y|--yes
340              Do  not  prompt for confirmation interactively but always assume
341              the answer yes. Use with extreme caution.   (For  automatic  no,
342              see -qq.)
343

VARIABLES

345       PV     Physical  Volume  name,  a device path under /dev.  For commands
346              managing physical extents, a PV positional arg generally accepts
347              a suffix indicating a range (or multiple ranges) of physical ex‐
348              tents (PEs). When the first PE is omitted, it  defaults  to  the
349              start of the device, and when the last PE is omitted it defaults
350              to end.  Start and end range (inclusive):  PV[:PE-PE]...   Start
351              and length range (counting from 0): PV[:PE+PE]...
352
353       String See the option description for information about the string con‐
354              tent.
355
356       Size[UNIT]
357              Size is an input number that accepts an  optional  unit.   Input
358              units are always treated as base two values, regardless of capi‐
359              talization, e.g. 'k' and 'K' both refer to  1024.   The  default
360              input unit is specified by letter, followed by |UNIT.  UNIT rep‐
361              resents other possible input units: b|B is bytes, s|S is sectors
362              of  512  bytes,  k|K is KiB, m|M is MiB, g|G is GiB, t|T is TiB,
363              p|P is PiB, e|E is EiB.  (This should not be confused  with  the
364              output  control  --units, where capital letters mean multiple of
365              1000.)
366

ENVIRONMENT VARIABLES

368       See lvm(8) for information about environment  variables  used  by  lvm.
369       For example, LVM_VG_NAME can generally be substituted for a required VG
370       parameter.
371

EXAMPLES

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

SEE ALSO

380       lvm(8), lvm.conf(5), lvmconfig(8), lvmdevices(8),
381
382       pvchange(8), pvck(8), pvcreate(8), pvdisplay(8), pvmove(8),
383       pvremove(8), pvresize(8), pvs(8), pvscan(8),
384
385       vgcfgbackup(8), vgcfgrestore(8), vgchange(8), vgck(8), vgcreate(8),
386       vgconvert(8), vgdisplay(8), vgexport(8), vgextend(8), vgimport(8),
387       vgimportclone(8), vgimportdevices(8), vgmerge(8), vgmknodes(8),
388       vgreduce(8), vgremove(8), vgrename(8), vgs(8), vgscan(8), vgsplit(8),
389
390       lvcreate(8), lvchange(8), lvconvert(8), lvdisplay(8), lvextend(8),
391       lvreduce(8), lvremove(8), lvrename(8), lvresize(8), lvs(8), lvscan(8),
392
393       lvm-fullreport(8), lvm-lvpoll(8), blkdeactivate(8), lvmdump(8),
394
395       dmeventd(8), lvmpolld(8), lvmlockd(8), lvmlockctl(8), cmirrord(8),
396       lvmdbusd(8), fsadm(8),
397
398       lvmsystemid(7), lvmreport(7), lvmcache(7), lvmraid(7), lvmthin(7),
399       lvmvdo(7), lvmautoactivation(7)
400
401
402
403
404Red Hat, Inc.          LVM TOOLS 2.03.22(2) (2023-08-02)               PVCK(8)
Impressum