lvmstat Command

Purpose

Reports input/output statistics for logical partitions, logical volumes and volume groups. Also reports pbuf and blocked I/O statistics.

Syntax

lvmstat { -l | -v } Name [ -e | -d ] [ -F ] [ -C ] [ -c Count ] [ -s ] [ Interval [ Iterations ] ]

lvmstat -v Name -r [ -L | -C ]

Description

The lvmstat command generates reports that can be used to change logical volume configuration to better balance the input/output load between physical disks.

By default, the statistics collection is not enabled in the system. You must use the -e flag to enable this feature for the logical volume or volume group in question. Enabling the statistics collection for a volume group enables for all the logical volume in that volume group.

Note: The -e flag and the -d flag are not applicable for the space reclamation statistics specified by the -r flag.

The first report generated by lvmstat provides statistics concerning the time since the system was booted. Each subsequent report covers the time since the previous report. All statistics are reported each time lvmstat runs. The report consists of a header row followed by a line of statistics for each logical partition or logical volume depending on the flags specified.

If the -l flag is specified, Name is the logical volume name, and the statistics are for the physical partitions of this logical volume. The mirror copies of the logical partitions are considered individually for the statistics reporting. They are listed in descending order of number of i/os (iocnt) to the partition.

The Interval parameter specifies the amount of time, in seconds, between each report. The first report contains statistics for the time since the volume group startup, varyonvg. Each subsequent report contains statistics collected during the interval since the previous report. If the Count parameter is specified, only the top Count lines of the report are generated. For a logical volume if Count is 10, only the 10 busiest partitions are identified. If the Iterations parameter is specified in conjunction with the Interval parameter, then only that many iterations are run. If no Iterations parameter is specified, lvmstat generates reports continuously. If Interval is used to run lvmstat more than once, no reports are printed if the statistics did not change since the last run. A single period . (period) is printed instead.

The lvmstat command is useful in determining whether a physical volume is becoming a hindrance to performance by identifying the busiest physical partitions for a logical volume.

Note: The lvmstat commands reports I/O statistics of the local node only.

Input/Output Reports

The lvmstat command generates two types of reports, per partition statistics in a logical volume and per logical volume statistics in a volume group. The reports have the following format:
Column Description
Log_part Logical partition number
mirror#Log_part Mirror copy number of the logical partition
iocntLog_part Number of read and write requests
Kb_readLog_part The total number of kilobytes read
Kb_wrtnLog_part The total number of kilobytes written
KbpsLog_part The amount of data transferred in kilobytes per second

Space reclaim statistics reports

The lvmstat -r command generates report for space reclaim statistics for physical volumes in the volume group. The reports have the following format:
Volume Group Description
PV_name Physical volume name
Reclaim Space reclamation state. The possible state values are:
on
Space reclaim is supported for the physical volume.
off
Space reclaim is not supported for the physical volume.
suspend
Space reclaim is suspended by LVM configuration commands.
Mb_freeed Amount of physical partition space is freed from logical volume by commands like rmlv, rmlvcopy, and chfs in megabytes
Mb_pending Space reclamation pending for the physical volume space in megabytes.
Mb_success Space reclamation requests succeeded at disk driver in megabytes.
Mb_failed Space reclamation requests failed by the disk driver in megabytes.
Mb_reused Free physical partition space reused for the logical volume without requesting the space reclamation in megabytes.
Mb_inprog Amount of space reclaim request outstanding at the disk driver in megabytes.
io_count Number of space reclaim I/O requests submitted to disk driver.
io_failed Number of space reclaim I/O requests failed by disk driver.
io_misalign Number of space reclaim requests reported as misaligned by the disk driver.
Mb_misalign Amount of space reclaim failed by the disk driver due to misalignment in megabytes.
Mb_resubmit Amount of space reclaim resubmitted due to reclaim block not being aligned on physical partition blocks.
num_pp_free Number of physical partitions are freed by LVM commands like rmlv, rmlvcopy, chfs, and so on.
Kb_blksize Space reclaim block size reported by the disk driver for alignment purpose.

Flags

Item Description
-c Count Prints only the specified number of lines of statistics.
-C Causes the counters that keep track of the iocnt, Kb_read and Kb_wrtn be cleared for the specified logical volume/volume group. This flag can also be used to resets the space reclaim statistics.
-d Specifies that statistics collection should be disabled for the logical volume/volume group in question.
-e Specifies that statistics collection should be enabled for the logical volume/volume group in question.
-F Causes the statistics to be printed colon-separated.
-l Specifies the name of the stanza to list.
-L Displays the space reclaim statistics in long listing mode.
-r Prints the space reclaim statistics for all physical volumes in the volume group.
-s Suppresses the header from the subsequent reports when Interval is used.
-v Specifies that the Name specified is the name of the volume group.

Security

To use lvmstat, you must have root user authority.

Attention RBAC users and Trusted AIX users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in Security. For a list of privileges and the authorizations that are associated with this command, see the lssecattr command or the getcmdattr subcommand.

Examples

  1. To enable the statistics collection for volume group datavg (all the LVs in datavg are enabled), enter the following command:
    lvmstat -v datavg -e
  2. To display the history of all the partitions of logical volume hd2, enter the following command:
    lvmstat -l hd2
  3. To display the history of top five logical volumes of volume group uservg, enter the following command:
    lvmstat -v uservg -c 5
  4. To display a continuous report at two second intervals for the logical volume ramlv, enter the following command:
    lvmstat -l ramlv 2
  5. To display six reports at two second intervals for the volume group rootvg, enter the following command:
    lvmstat -v rootvg 2 6
  6. To reset the counters for statistics for all the logical volumes in the volume group uservg, enter the following command:
    lvmstat -v uservg -C
  7. To disable statistics collection for datalv, enter the following command:
    lvmstat -l datalv -d
  8. To display statistics for space reclamation, enter the following command:
    lvmstat -v uservg -r
  9. To display statistics for space reclamation in long listing mode, enter the following command:
    lvmstat -v uservg -r -L
  10. To clear the statistics for space reclamation, enter the following command:
    lvmstat -v uservg -r -C

Files

Item Description
/usr/sbin/lvmstat Contains the lvmstat command.