Why are LVM2 commands, such as vgscan, taking a very long time to complete?

Updated

Release Found: Red Hat Enterprise Linux 4 and later

Scanning logical volumes with commands such as vgscan and lvscan will scan all disks for LVM information. This information is contained in meta-data areas (MDAs). By default, every physical volume contains an MDA. It is important to have multiple copies of an MDA for redundancy, and for most configurations there is no performance impact. However, for LVM configurations that have a large number of physical volumes, the scan can take a long time. IBM Z-series systems, for example, typically have storage configurations with large numbers of small physical volumes.

The solution for accommodating large numbers of physical volumes is to limit the number of MDAs used. The following steps can be followed when creating volumes to avoid the default behavior of one MDA per physical volume.

  1. Select the number of MDAs to use. A minimum of four is recommended

  2. For the devices that will contain an MDA, run the following, where $DEVICE is the full path to the disk:

            # pvcreate --metadatacopies=1 $DEVICE
    
  3. For the remaining devices, run:

            # pvcreate --metadatacopies=0 $DEVICE
    
  4. Assemble the volume group as your normally would:

            # vgcreate <VolGroup Name> [ ... ]
    
  5. Verify the volume group metadata areas:

           # vgdisplay
             --- Volume group ---
             VG Name               t0
             System ID
             Format                lvm2
             Metadata Areas        4         <-------------
             Metadata Sequence No  2
             VG Access             read/write
             VG Status             resizable
             MAX LV                0
             Cur LV                0
             Open LV               0
             Max PV                0
             Cur PV                64
             Act PV                64
             VG Size               7.75 GB
             PE Size               4.00 MB
             Total PE              1984
             Alloc PE / Size       0 / 0
             Free  PE / Size       1984 / 7.75 GB
             VG UUID               PcERts-A1MU-KoT6-gu6R-Acuw-MYuf-08
    
Article Type