Installation guide

Removing Lost Physical Volumes from a Volume Group
75
6.6. Removing Lost Physical Volumes from a Volume Group
If you lose a physical volume, you can activate the remaining physical volumes in the volume group
with the --partial argument of the vgchange command. You can remove all the logical volumes
that used that physical volume from the volume group with the --removemissing argument of the
vgreduce command.
It is recommended that you run the vgreduce command with the --test argument to verify what you
will be destroying.
Like most LVM operations, the vgreduce command is reversible in a sense if you immediately
use the vgcfgrestore command to restore the volume group metadata to its previous state. For
example, if you used the --removemissing argument of the vgreduce command without the --
test argument and find you have removed logical volumes you wanted to keep, you can still replace
the physical volume and use another vgcfgrestore command to return the volume group to its
previous state.
6.7. Insufficient Free Extents for a Logical Volume
You may get the error message "Insufficient free extents" when creating a logical volume when you
think you have enough extents based on the output of the vgdisplay or vgs commands. This is
because these commands round figures to 2 decimal places to provide human-readable output. To
specify exact size, use free physical extent count instead of some multiple of bytes to determine the
size of the logical volume.
The vgdisplay command, by default, includes this line of output that indicates the free physical
extents.
# vgdisplay
--- Volume group ---
...
Free PE / Size 8780 / 34.30 GB
Alternately, you can use the vg_free_count and vg_extent_count arguments of the vgs
command to display the free extents and the total number of extents.
[root@tng3-1 ~]# vgs -o +vg_free_count,vg_extent_count
VG #PV #LV #SN Attr VSize VFree Free #Ext
testvg 2 0 0 wz--n- 34.30G 34.30G 8780 8780
With 8780 free physical extents, you can run the following command, using the lower-case l argument
to use extents instead of bytes:
# lvcreate -l8780 -n testlv testvg
This uses all the free extents in the volume group.
# vgs -o +vg_free_count,vg_extent_count
VG #PV #LV #SN Attr VSize VFree Free #Ext
testvg 2 1 0 wz--n- 34.30G 0 0 8780