Scanning Disks For Volume Groups To Build The Cache File; Removing Physical Volumes From A Volume Group - Red Hat ENTERPRISE LINUX 5.1 - LVM ADMINISTRATION Manual

Table of Contents

Advertisement

Chapter 4. LVM Administration with CLI Commands
PE Size
Total PE
Alloc PE / Size
Free
PE / Size
VG UUID

4.3.4. Scanning Disks for Volume Groups to Build the Cache File

The vgscan command scans all supported disk devices in the system looking for LVM physical
volumes and volume groups. This builds the LVM cache in the /etc/lvm/.cache file, which
maintains a listing of current LVM devices.
LVM runs the vgscan command automatically at system startup and at other times during LVM
operation, such as when you execute a vgcreate command or when LVM detects an inconsistency.
You may need to run the vgscan command manually when you change your hardware configuration,
causing new devices to be visible to the system that were not present at system bootup. This may be
necessary, for example, when you add new disks to the system on a SAN or hotplug a new disk that
has been labeled as a physical volume.
You can define a filter in the lvm.conf file to restrict the scan to avoid specific devices. For
information on using filters to control which devices are scanned, see
Device Scans with
Filters".
The following example shows the output of a vgscan command.
# vgscan
Reading all physical volumes.
Found volume group "new_vg" using metadata type lvm2
Found volume group "officevg" using metadata type lvm2

4.3.5. Removing Physical Volumes from a Volume Group

To remove unused physical volumes from a volume group, use the vgreduce command. The
vgreduce command shrinks a volume group's capacity by removing one or more empty physical
volumes. This frees those physical volumes to be used in different volume groups or to be removed
from the system.
Before removing a physical volume from a volume group, you can make sure that the physical volume
is not used by any logical volumes by using the pvdisplay command.
# pvdisplay /dev/hda1
-- Physical volume ---
PV Name
VG Name
PV Size
PV#
PV Status
Allocatable
22
4.00 MB
13164
13 / 52.00 MB
13151 / 51.37 GB
jxQJ0a-ZKk0-OpMO-0118-nlwO-wwqd-fD5D32
This may take a while...
/dev/hda1
myvg
1.95 GB / NOT usable 4 MB [LVM: 122 KB]
1
available
yes (but full)
Section 4.6, "Controlling LVM

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise linux 5.1 cluster logical volume manager

Table of Contents