#2482·beszel

[Bug]: No disk throughput for LVM volume on Synology: LV name never matches the device-mapper label (vg1-volume_1)

Author: rbmatthCreated Sep 30, 2026Updated Sep 30, 2026

Component

Agent

Description

Disk throughput is missing for an LVM-backed volume on Synology DSM, while usage for the same volume is reported correctly. The agent logs:

INFO Detected disk name=volume_1 device=/dev/vg1/volume_1 mount=/volume1 io=volume_1 root=false
WARN Device not found in diskstats name=volume_1

This looks like the same symptom as #1790 (there it shows up as name=lv on /dev/vg1000/lv) and #365. This report is about why the existing matching logic misses it, in case auto-detection can be fixed instead of needing a config hint.

Environment

  • Beszel agent v0.20.0 (binary agent, installed natively, not Docker; EXTRA_FILESYSTEMS=/volume1)
  • Synology DS223j, DSM 7.4.1-90080, aarch64
  • gopsutil v4.26.8 (from v0.20.0's go.mod)

What the system looks like

$ grep ' /volume1 ' /proc/mounts
/dev/vg1/volume_1 /volume1 btrfs rw,nodev,relatime,ssd,...

$ ls -l /dev/vg1/volume_1
lrwxrwxrwx 1 root root 24 ... /dev/vg1/volume_1 -> /dev/mapper/vg1-volume_1

$ for d in /sys/block/dm-*; do echo "$(basename $d) -> $(cat $d/dm/name)"; done
dm-0 -> vg1-syno_vg_reserved_area
dm-1 -> vg1-volume_1

$ grep -E ' (dm-|md)[0-9]+ ' /proc/diskstats   # name, sectors read, sectors written
md0 2044576 171728
md1 16472 225992
md2 1121056 79241176
dm-0 672 56
dm-1 1114888 79241120

So the volume's I/O is in /proc/diskstats as dm-1, with device-mapper name vg1-volume_1.

Why it doesn't match (from reading v0.20.0 agent/disk.go)

  1. registerFilesystemStats sets key = filepath.Base(device). For the mount source /dev/vg1/volume_1 that is volume_1.
  2. volume_1 is not a key in diskIoCounters (the keys are dm-1, md2, ...), and the mount isn't under the /extra-filesystems path (binary agent), so it falls to findIoDevice("volume_1", ...).
  3. findIoDevice does compare against d.Label, which gopsutil fills from /sys/block/dm-1/dm/name (vg1-volume_1). But the comparison is exact match, or prefixRelated (HasPrefix in either direction). volume_1 is neither equal to vg1-volume_1 nor a prefix of it. It is the LV part of the <VG>-<LV> device-mapper name, i.e. a suffix.
  4. No match, so the key stays volume_1, and initializeDiskIoStats warns because diskIoCounters["volume_1"] doesn't exist.

The Label support that is already in findIoDevice would match if the lookup used vg1-volume_1.

Possible fixes (untested, only reasoned from the code above)

  • Resolve the partition device's symlink before taking the base name: /dev/vg1/volume_1 -> /dev/mapper/vg1-volume_1, base name vg1-volume_1. That is exactly the gopsutil Label, so the existing exact-label branch in findIoDevice would return dm-1.
  • Or, in findIoDevice, also treat a label that ends with -<name> as a match (device-mapper names are <vg>-<lv>), ideally only when there is a single such candidate.

Happy to test a patch or a build on this NAS if that helps.

Related

  • #1790 (feature request for a per-filesystem diskstats name hint; same symptom on Synology with name=lv)
  • #365 (closed; Synology LVM, answered with the Docker folder-name workaround)