I'm trying to figure out how to get volume-level metrics for an LVM2 logical volume on Ubuntu Server 18.04. The man page for lvm indicates that dmstats is the preferred tool for this purpose.

The following LVM1 commands are not implemented in LVM2: lvmchange, lvmsadc, lvmsar, pvdata. For performance metrics, use dmstats(8) or to manipulate the kernel device-mapper driver used by LVM2 directly, use dmsetup(8).

However, I can't figure out any permutations of dmstats commands to try to retrieve basic metrics about LVM performance. dmstats simply returns no output, no matter which parameters I use (aside from help).

I found a document from Oracle Linux that says dmstats is broken, but I'm not sure if this applies to Ubuntu as well, or not.

Question: Can anyone tell me how to retrieve metrics / performance data for LVM2 objects?


What version of LVM2 are you running? There was a regression in the dmsetup command (a change unrelated to stats) that causes dmstats to produce empty reports.

I fixed this last year:

commit 925aaf0b874fd92aec1b34f42d23987f65205ff9
Author: Bryn M. Reeves <bmr@redhat.com>
Date:   Thu Nov 1 16:49:05 2018 +0000

    dmsetup: fix stats report command output

    Since the stats handle is neither bound nor listed before the
    attempt to call dm_stats_get_nr_regions(), it will always return
    zero: this prevents reporting of any dmstats regions on any

    Remove the dm_stats_get_nr_regions() check and instead rely on
    the correct return status from dm_stats_populate() which only
    returns 0 in the case that there are regions to inspect (and
    which logs a specific error for all other cases).

    Reported-by: Bryan Gurney <bgurney@redhat.com>

This commit is on both the upstream master, and stable-2.02 branches (depending which version your distro is currently basing on).

I don't think a new release has been made from master yet, but this fix should be included in lvm2-2.02.183.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.