Chapter 8. Displaying LVM components

LVM provides a variety of ways to display the LVM components, as well as to customize the display. This sections summarizes the usage of the basic LVM display commands.

8.1. Displaying LVM Information with the lvm Command

The lvm command provides several built-in options that you can use to display information about LVM support and configuration.

  • lvm devtypes

    Displays the recognized built-in block device types

  • lvm formats

    Displays recognized metadata formats.

  • lvm help

    Displays LVM help text.

  • lvm segtypes

    Displays recognized logical volume segment types.

  • lvm tags

    Displays any tags defined on this host.

  • lvm version

    Displays the current version information.

8.2. Displaying physical volumes

There are three commands you can use to display properties of LVM physical volumes: pvs, pvdisplay, and pvscan.

The pvs command provides physical volume information in a configurable form, displaying one line per physical volume. The pvs command provides a great deal of format control, and is useful for scripting.

The pvdisplay command provides a verbose multi-line output for each physical volume. It displays physical properties (size, extents, volume group, and so on) in a fixed format.

The following example shows the output of the pvdisplay command for a single physical volume.

# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sdc1
  VG Name               new_vg
  PV Size               17.14 GB / not usable 3.40 MB
  Allocatable           yes
  PE Size (KByte)       4096
  Total PE              4388
  Free PE               4375
  Allocated PE          13
  PV UUID               Joqlch-yWSj-kuEn-IdwM-01S9-XO8M-mcpsVe

The pvscan command scans all supported LVM block devices in the system for physical volumes.

The following command shows all physical devices found:

# pvscan
 PV /dev/sdb2   VG vg0   lvm2 [964.00 MB / 0   free]
 PV /dev/sdc1   VG vg0   lvm2 [964.00 MB / 428.00 MB free]
 PV /dev/sdc2            lvm2 [964.84 MB]
 Total: 3 [2.83 GB] / in use: 2 [1.88 GB] / in no VG: 1 [964.84 MB]

You can define a filter in the lvm.conf file so that this command will avoid scanning specific physical volumes.

8.3. Displaying volume groups

There are two commands you can use to display properties of LVM volume groups: vgs and vgdisplay. The vgscan command, which scans all supported LVM block devices in the system for volume groups, can also be used to display the existing volume groups.

The vgs command provides volume group information in a configurable form, displaying one line per volume group. The vgs command provides a great deal of format control, and is useful for scripting.

The vgdisplay command displays volume group properties (such as size, extents, number of physical volumes, and so on) in a fixed form. The following example shows the output of the vgdisplay command for the volume group new_vg. If you do not specify a volume group, all existing volume groups are displayed.

# vgdisplay new_vg
  --- Volume group ---
  VG Name               new_vg
  System ID
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  11
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               51.42 GB
  PE Size               4.00 MB
  Total PE              13164
  Alloc PE / Size       13 / 52.00 MB
  Free  PE / Size       13151 / 51.37 GB
  VG UUID               jxQJ0a-ZKk0-OpMO-0118-nlwO-wwqd-fD5D32

The following example shows the output of the vgscan command.

# vgscan
Reading all physical volumes.  This may take a while...
Found volume group "new_vg" using metadata type lvm2
Found volume group "officevg" using metadata type lvm2

8.4. Displaying logical volumes

There are three commands you can use to display properties of LVM logical volumes: lvs, lvdisplay, and lvscan.

The lvs command provides logical volume information in a configurable form, displaying one line per logical volume. The lvs command provides a great deal of format control, and is useful for scripting.

The lvdisplay command displays logical volume properties (such as size, layout, and mapping) in a fixed format.

The following command shows the attributes of lvol2 in vg00. If snapshot logical volumes have been created for this original logical volume, this command shows a list of all snapshot logical volumes and their status (active or inactive) as well.

# lvdisplay -v /dev/vg00/lvol2

The lvscan command scans for all logical volumes in the system and lists them, as in the following example.

# lvscan
 ACTIVE                   '/dev/vg0/gfslv' [1.46 GB] inherit