LVM performance monitoring with the lvmstat command

You can use the lvmstat command to detect whether certain areas or partitions of a logical volume are accessed more frequently than others.

In order to display the statistics of these frequently accessed areas with the lvmstat command, you must enable the statistics to run on a per logical volume or volume group basis.

To enable the statistics for the lvmstat command for a specific logical volume, use the following command:
 # lvmstat -l lvname -e
To disable the statistics for the lvmstat command for a specific logical volume, use the following command:
 # lvmstat -l lvname -d
To enable the statistics for the lvmstat command for all logical volumes in a volume group, use the following command:
 # lvmstat -v vgname -e
To disable the statistics for the lvmstat command for all logical volumes in a volume group, use the following command:
 # lvmstat -v vgname -d
When using the lvmstat command, if you do not specify an interval value, the output displays the statistics for every partition in the logical volume. When you specify an interval value, in seconds, the lvmstat command output only displays statistics for the particular partitions that have been accessed in the specified interval. The following is an example of the lvmstat command:
# lvmstat -l lv00 1

Log_part  mirror#  iocnt   Kb_read   Kb_wrtn      Kbps
       1       1   65536     32768         0      0.02
       2       1   53718     26859         0      0.01

Log_part  mirror#  iocnt   Kb_read   Kb_wrtn      Kbps
       2       1    5420      2710         0  14263.16

Log_part  mirror#  iocnt   Kb_read   Kb_wrtn      Kbps
       2       1    5419      2709         0  15052.78

Log_part  mirror#  iocnt   Kb_read   Kb_wrtn      Kbps
       3       1    4449      2224         0  13903.12
       2       1     979       489         0   3059.38

Log_part  mirror#  iocnt   Kb_read   Kb_wrtn      Kbps
       3       1    5424      2712         0  12914
You can use the -c flag to limit the number of statistics the lvmstat command displays. The -c flag specifies the number of partitions with the most I/O activity that you want displayed. The following is an example of using the lvmstat command with the -c flag:
# lvmstat -l lv00 -c 5
The above command displays the statistics for the 5 partitions with the most I/O activity.

If you do not specify the iterations parameter, the lvmstat command continues to produce output until you interrupt the command. Otherwise, the lvmstat command displays statistics for the number of iterations specified.

In using the lvmstat command, if you find that there are only a few partitions that are heavily used, you might want to separate these partitions over different hard disks using the lvmstat command. The lvmstat command allows you to migrate individual partitions from one hard disk to another. For details on using the lvmstat command, see migratelp Command in Commands Reference, Volume 3.

For more options and information about the lvmstat command, see lvmstat Command in Commands Reference, Volume 3.