lvmstat Command

Purpose

Reports input or output (I/O) 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 ]
start of change
lvmstat -v Name -m 
end of change

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. 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 volumes in that volume group.

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

The first report that is generated by lvmstat provides the statistics that concerns the time since the system was booted. Each subsequent report covers the time since the previous report. All the statistics are reported each time lvmstat runs. The report consists of a header row followed by a line of the statistics for each logical partition or logical volume that depends 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 the statistics for the time since the volume group is activated by using the varyonvg command. Each subsequent report contains the statistics that are collected during the interval since the previous report. If the Count parameter is specified, only the highest 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 along 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:
Table 1. I/O reports 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 kilobyte (KB) read
Kb_wrtnLog_part The total number of KB written
KbpsLog_part The amount of data transferred in KB 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:
Table 2. Space reclaim statistics reports format
Volume Group Description
PV_name Physical volume name
Reclaim Space reclamation state. The space reclamation state can have the following values:
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 The amount of physical partition space that is freed from logical volume by commands like rmlv, rmlvcopy, and chfs in megabytes.
Mb_pending Space reclamation that are 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 The amount of free physical partition space that is reused for the logical volume without requesting the space reclamation in megabytes.
Mb_inprog Specifies the amount of space reclaim request outstanding at the disk driver in megabytes.
io_count Number of space reclaim I/O requests submitted to the disk driver.
io_failed Number of space reclaim I/O requests failed by the disk driver.
io_misalign Number of space reclaim requests reported as misaligned by the disk driver.
Mb_misalign The amount of space reclaims failed by the disk driver due to misalignment in megabytes.
Mb_resubmit The amount of space reclaims resubmitted due to reclaim block not being aligned on physical partition blocks.
num_pp_free The number of physical partitions that are freed by LVM commands like rmlv, rmlvcopy, chfs, and so on.
Kb_blksize Space reclaims block size that is reported by the disk driver for alignment purpose.
start of changeMirror write consistency statistics reportend of change
start of change
The lvmstat -m generates the statistics report for an active mirror write consistency cache (MWCC). The report is displayed in the following format:
Table 3. Mirror write consistency cache statistics report format
Column Description
IO_CNT Specifies the total number of requests.
FULL_CNT Specifies the number of times the request was on hold because the cache was full.
INFLT_CNT Specifies the number of times the request was on hold because the cache write operation was in progress.
end of change

Flags

Table 4. Flags
Item Description
-c Count Prints only the specified number of lines of statistics.
Note: start of changeThe -c flag is not supported for MWCC statistics.end of change
-C Causes the counters that keeps track of the iocnt, Kb_read, and Kb_wrtn be cleared for the specified logical volume or volume group. This flag can also be used to reset the space reclaim statistics.
-d Specifies that the statistics collection must be disabled for the logical volume or volume group in question.
-e Specifies that the statistics collection must be enabled for the logical volume or volume group in question.
-F Prints the statistics separated by a colon.
-l Specifies the name of the stanza to the list.
-L Displays the space reclaim statistics in long listing mode.
start of change-mend of change start of changeDisplays the MWCC statistics for a volume group that is specified by the Name variable.end of change
-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: 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 the first five logical volumes of the volume group uservg, enter the following command:
    lvmstat -v uservg -c 5
  4. To display a continuous report at an interval of two-seconds for the logical volume ramlv, enter the following command:
    lvmstat -l ramlv 2
  5. To display six reports at an interval of two-seconds for the volume group rootvg, enter the following command:
    lvmstat -v rootvg 2 6
  6. To reset the counters for the statistics for all the logical volumes in the volume group uservg, enter the following command:
    lvmstat -v uservg -C
  7. To disable the statistics collection for datalv, enter the following command:
    lvmstat -l datalv -d
  8. To display the statistics for space reclamation, enter the following command:
    lvmstat -v uservg -r
  9. To display the statistics for space reclamation in long listing mode, enter the following command:
    lvmstat -v uservg -r -L
  10. To clear the the statistics for space reclamation, enter the following command:
    lvmstat -v uservg -r -C
  11. start of changeTo enable the MWCC statistics for the volume group datavg, enter the following command:
    lvmstat -v datavg -m -e
    end of change
  12. start of changeTo disable the MWCC statistics for the volume group datavg, enter the following command:
    lvmstat -v datavg -m -d
    end of change
  13. start of changeTo clear the MWCC statistics for the volume group datavg, enter the following command:
    lvmstat -v datavg -m -C
    end of change
  14. start of changeTo display five MWCC statistics reports at a time for the volume group datavg at an interval of 10 seconds in comma-separated values (csv) file format, enter the following command:
    lvmstat -v datavg -F m -s 10 5
    end of change

Files

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