lvmstat Command

Purpose

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

Syntax

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

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.

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

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.
-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.
-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 AIX® Version 7.1 Security. For a list of privileges and the authorizations 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), type:
    lvmstat -v datavg -e
  2. To display the history of all the partitions of logical volume hd2, type:
    lvmstat -l hd2
  3. To display the history of top five logical volumes of volume group uservg, type:
    lvmstat -v uservg -c 5
  4. To display a continuous report at two second intervals for the logical volume ramlv, type:
    lvmstat -l ramlv 2
  5. To display six reports at two second intervals for the volume group rootvg, type:
    lvmstat -v rootvg 2 6
  6. To reset the counters for statistics for all the logical volumes in the volume group uservg, type:
    lvmstat -v uservg -C
  7. To disable statistics collection for datalv, type:
    lvmstat -l datalv -d

Files

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