]> sourceware.org Git - lvm2.git/commit
pv: check for the PV_EXT_USED flag and deny pvcreate/pvchange/pvremove/vgcreate on...
authorPeter Rajnoha <prajnoha@redhat.com>
Tue, 10 Mar 2015 10:25:14 +0000 (11:25 +0100)
committerPeter Rajnoha <prajnoha@redhat.com>
Mon, 15 Feb 2016 11:44:46 +0000 (12:44 +0100)
commit52999133a36e5ab194dfa10d9108ca09ff1c930d
tree300086400bdddbe9c323ef933fb9f73eb7a54d6a
parentd320d9c52bd1817daf5573b772e01a871837d2ee
pv: check for the PV_EXT_USED flag and deny pvcreate/pvchange/pvremove/vgcreate on such PV (unless forced)

Make sure we won't use a PV that is already marked as used. Normally,
VG metadata would stop us from doing that, but we can run into a
situation where such metadata is missing because PVs with MDAs
are missing and the PVs left are the ones with 0 MDAs.

(/dev/sda in this example has 0 MDAs and it belongs to a VG,
but other PVs with MDA are missing)

$ pvs -o pv_name,pv_mda_count /dev/sda
  PV         #PMda
  /dev/sda       0

$ pvcreate /dev/sda
  PV '/dev/sda' is marked as belonging to a VG but its metadata is missing.
  Can't initialize PV '/dev/sda' without -ff.

$ pvchange -u /dev/sda
  PV '/dev/sda' is marked as belonging to a VG but its metadata is missing.
  Can't change PV '/dev/sda' without -ff.
  Physical volume /dev/sda not changed
  0 physical volumes changed / 1 physical volume not changed

$ pvremove /dev/sda
  PV '/dev/sda' is marked as belonging to a VG but its metadata is missing.
  (If you are certain you need pvremove, then confirm by using --force twice.)

$ vgcreate vg /dev/sda
  Physical volume '/dev/sda' is marked as belonging to a VG but its metadata is missing.
  Unable to add physical volume '/dev/sda' to volume group 'vg'.
lib/metadata/metadata.c
lib/metadata/pv_manip.c
tools/pvchange.c
This page took 0.038207 seconds and 5 git commands to generate.