Home / Alt manpages / lvmsadc(8)

  • lvmsadc(8)
  • Admin command
  • linux

Replace lvmsadc with dmstats on LVM2

Find an old script calling lvmsadc for activity data, and it is chasing a command the LVM2 manual itself says is unsupported. This guide confirms that, identifies your LVM2 version, and moves you to the supported device-mapper statistics tool without touching a logical volume.

  • Time: about ten minutes.
  • Risk: the checks are read-only, but the later dmstats commands that create or clear statistics are state-changing and are kept separate below.

1. Check the installed package and command

Start as your ordinary user. This does not need elevated privileges and gives you the version context for the result:

$ command -v lvmsadc
/usr/sbin/lvmsadc
$ dpkg-query -W -f='${Package} ${Version}\n' lvm2
lvm2 2.03.16-3ubuntu3.2
$ lvm version
  LVM version:     2.03.16(2) (2022-05-18)
  Library version: 1.02.185 (2022-05-18)

Your distribution may report a different package revision. Record both values when diagnosing an old script or comparing hosts: the command name being present is not proof that the command is supported.

2. Read the command's actual contract

Ask for help, then read the installed manual page. The help request is harmless, although this LVM command may print a warning when it cannot access the device-mapper control node:

$ lvmsadc --help
  lvmsadc - Collect activity data

  lvmsadc
        [ COMMON_OPTIONS ]

The manual page is the decisive check. For LVM2 2.03.16, lvmsadc(8) says that lvmsadc is not supported under LVM2, and names the device-mapper statistics facility, managed with dmstats(8), as the similar replacement. There are no lvmsadc collection flags or output files to configure here: do not infer a usable interface from the generic LVM options shown by --help.

Checkpoint

If your installed manual page makes the same statement, stop trying to build a monitoring workflow around lvmsadc. A successful process launch would not turn an unsupported command into a reliable collector.

3. Avoid the common false success

On a restricted shell or container, running the binary can produce diagnostics such as a non-root warning or a failure to communicate with the kernel device-mapper driver. Those messages describe the current environment, but they are not the main reason to adopt the replacement: even on a fully configured host, the LVM2 manual marks this program unsupported.

  • Do not add sudo to silence the warning. Elevated access can change which devices and metadata a command can inspect, but it cannot restore an unsupported interface.
  • Do not redirect the output into a file and call it a data set. The manpage does not define a supported report format or collection schedule for lvmsadc.

There is nothing to undo from the checks above. They do not alter volumes, device-mapper tables, service configuration or persistent LVM metadata.

4. Inspect the supported replacement

Check that dmstats is installed and read its help. This remains an ordinary, read-only inspection:

$ command -v dmstats
/usr/sbin/dmstats
$ dmstats --help
Usage:

dmstats
        [-h|--help]
        [-v|--verbose [-v|--verbose ...]]
        [--areas <nr_areas>] [--areasize <size>]
        [--units <units>]

        list [device_name]
        report [--interval <seconds>] [--count <cnt>]
            [--units <u>] [--noheadings] [device...]

The exact help text varies with the installed device-mapper tools, so use dmstats --help on the target host rather than copying an option set from another release. The local dmstats(8) synopsis describes commands including list, create, print, report and delete.

If the command is missing, install the package supplied by your normal distribution process. Do not create a replacement shell script named lvmsadc: that hides the compatibility problem and can make old automation appear to work while collecting nothing useful.

5. List existing statistics before creating any

Existing device-mapper statistics can be listed without creating a region:

$ dmstats list
Name                    Reg Count   Rel Start   Rel Length   Precis  Bounds
<host-specific rows>

The headings and rows depend on the kernel, device-mapper state and any statistics regions already configured. An empty result is a valid result: it means there is no existing region for the command to list, not that lvmsadc should be used instead.

Some hosts require elevated privileges to inspect or manage device-mapper state. If an unprivileged invocation reports permission denied, first confirm the command and package as the same user, then follow your host's access policy. Do not weaken device permissions as a workaround.

6. Treat collection changes as a separate operation

Unlike the read-only checks above, dmstats create adds device-mapper statistics regions and can impose monitoring overhead. The manpage supports selecting a device, areas or an area size, and optional metadata such as a program ID. Choose the exact device and collection interval for your monitoring design before running it.

Warning

Do not paste a guessed device name or use an all-devices option on a production host. Verify the target first with the device inventory used by your platform. A safe planning check is:

$ dmstats list /dev/mapper/EXAMPLE_LV
Name                    Reg Count   Rel Start   Rel Length   Precis  Bounds
<host-specific rows, or no rows>

Replace /dev/mapper/EXAMPLE_LV only after confirming the logical volume name. When you are ready to create a region, use the exact create syntax shown by the installed manual page and obtain the required privilege through your normal operational process. Record the command, device, areas and user data so another operator can identify the region later.

Removal is also state-changing. The corresponding dmstats delete command removes statistics regions, so keep the original creation details and review the target before using it. Do not use clear as a cleanup shortcut: clearing counters discards measurements while leaving the monitoring setup in place.

Common traps

  • The binary exists but the manual says unsupported. Treat the manual as authoritative for LVM2 and migrate the workflow to dmstats.
  • Device-mapper access is denied. Check the kernel device-mapper setup and host policy: root access alone does not repair an incompatible or unavailable driver.
  • No rows appear from dmstats list. There may simply be no statistics regions. Listing does not create one.
  • A script expects an lvmsadc output file. Stop and redesign that integration around the fields and lifecycle of dmstats instead of parsing incidental warnings or generic LVM help.

Done means

  • Recorded the installed LVM2 package and version.
  • Checked lvmsadc(8) and confirmed its unsupported LVM2 status.
  • Ran dmstats --help and dmstats list on the target host.
  • Changed nothing: no volume, device-mapper table or persistent LVM configuration was touched during the checks.
  • Planned ahead: any future statistics region will have a confirmed device, reviewed lifecycle and an operator-approved cleanup plan.