LVM2 逻辑卷的指标

LVM2 逻辑卷的指标

我正在尝试弄清楚如何获取 Ubuntu Server 18.04 上 LVM2 逻辑卷的卷级指标。手册页lvm表示这dmstats是实现此目的的首选工具。

以下 LVM1 命令未在 LVM2 中实现:lvmchange、lvmsadc、lvmsar、pvdata。对于性能指标,请使用 dmstats(8);或者要直接操作 LVM2 使用的内核设备映射器驱动程序,请使用 dmsetup(8)。

但是,我无法找出任何dmstats命令排列来尝试检索有关 LVM 性能的基本指标。dmstats无论我使用哪些参数(除了帮助),都根本不返回任何输出。

我发现了一个来自 Oracle Linux 的文档这说明dmstats它坏了,但我不确定这是否也适用于 Ubuntu。

问题:谁能告诉我如何检索 LVM2 对象的指标/性能数据?

答案1

您运行的是哪个版本的 LVM2?dmsetup 命令中有一个回归(与统计无关的更改),导致 dmstats 生成空报告。

我去年修复了这个问题:

commit 925aaf0b874fd92aec1b34f42d23987f65205ff9
Author: Bryn M. Reeves <[email protected]>
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
    device.

    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 <[email protected]>

此提交位于上游主分支和稳定分支 2.02 上(取决于您的发行版当前所基于的版本)。

我认为主版本尚未发布新版本,但此修复应包含在 lvm2-2.02.183 中。

相关内容