Collect a Safe, Useful LVM Diagnostic Dump with lvmdump

lvmdump gathers everything support will ask for into one directory, in a single command. You will collect the dump, check what it contains, and decide whether the extra metadata and service context are justified. The installed tool is from LVM2 2.03.16, package version 2.03.16-3ubuntu3.2. Allow about fifteen minutes for a basic collection, plus time to review the files before sharing them.

The dump can contain LVM configuration, process information, system messages, device names, udev data and, with additional options, physical-volume metadata and the current boot's journal. Treat it as sensitive operational data. Do not attach it to a public issue or send it to an unapproved recipient.

1. Confirm the installed command

Check the binary, package version and the local help text before collecting anything. These are ordinary read-only checks:

$ command -v lvmdump
/usr/sbin/lvmdump
$ dpkg-query -W -f='${Package} ${Version}\n' lvm2
lvm2 2.03.16-3ubuntu3.2
$ lvmdump -h
/usr/sbin/lvmdump [options]
    -h print this message
    -a advanced collection - warning: if lvm is already hung,
       then this script may hang as well
    -d <directory> dump into a directory instead of tarball
    -l gather lvmetad state if running
    -p gather lvmpolld state if running
    -m gather LVM metadata from the PVs
    -s gather system info and context
    -u gather udev info and context

Checkpoint: if the package is missing, stop here and use your normal package-management process. Do not download a replacement script into a production host just to obtain a diagnostic.

2. Choose a new destination

Use mktemp -d to create an unused directory. The command below changes no LVM configuration and does not require root, although an unprivileged collection can be incomplete:

$ dump_dir=$(mktemp -d /tmp/lvmdump.XXXXXX)
$ printf 'dump directory: %s\n' "$dump_dir"
dump directory: /tmp/lvmdump.K7mQ2x

Keep the directory outside a shared location while you inspect it. The placeholder suffix is generated by mktemp; use the value printed by your shell in later commands. Avoid a path that already contains a previous dump, because a diagnostic run should not blur two collection times together.

3. Collect the basic raw dump

Pass the new directory to -d. This requests a raw dump tree rather than the default single compressed tarball:

$ lvmdump -d "$dump_dir"
WARNING! Running as non-privileged user, dump is likely incomplete!
Creating dump directory: /tmp/lvmdump.K7mQ2x

Gathering LVM & device-mapper version info...
Gathering dmsetup info...
Gathering process info...
Gathering console messages...
Gathering /etc/lvm info...
Gathering /dev listing...
Gathering /sys/block listing...

A successful collection ends with exit status zero. The warning is a reason to repeat the collection with elevated privileges when you need a complete host diagnosis, not a reason to ignore the output:

$ printf 'exit status: %s\n' "$?"
exit status: 0
$ find "$dump_dir" -maxdepth 2 -type f -printf '%P\n' | sort
config_diff
config_missing
dev_listing
dmsetup_info
dmsetup_ls_tree
dmsetup_status
dmsetup_table
etc_lvm_listing
lvm/lvm.conf
lvm/lvmlocal.conf
lvmdump.log
messages
ps_info
sysblock_listing
versions

If the source files or device information require access that your account does not have, run the same command with sudo after checking your local change-control policy:

$ sudo lvmdump -d "$dump_dir"
...

Elevated privilege is for collection only. It does not make the resulting files safe to share.

4. Add only the context you need

Start with the basic dump. Add options for a specific diagnostic question, because each option increases collection time, output size or sensitivity:

For example, this asks for system and udev context without requesting PV metadata:

$ sudo lvmdump -s -u -d "$dump_dir"
$ du -sh "$dump_dir"
456K    /tmp/lvmdump.K7mQ2x

The size will vary. Check lvmdump.log and the command's exit status if a collection appears incomplete. Do not treat the presence of a file as proof that its contents were gathered successfully.

5. Review before transfer

List the tree and inspect the log, configuration names and message files locally. Look for hostnames, volume names, usernames, network details, paths, service activity and credentials accidentally written into configuration or logs:

$ find "$dump_dir" -type f -printf '%s bytes %p\n' | sort -n
$ sed -n '1,120p' "$dump_dir/lvmdump.log"
$ sed -n '1,80p' "$dump_dir/lvm/lvm.conf"

If you need a compressed artefact, the default mode creates a single compressed tarball in the current directory. Choose a private working directory first and verify its permissions before handing it to support. The -d mode is often easier to audit because each component remains visible.

Do not edit files inside the dump to redact them in place. Make a separate reviewed copy, record what was removed, and retain the original only where your retention policy permits. Avoid sending the raw dump if the support recipient does not need every component.

6. Remove the temporary collection

After transfer and retention decisions are complete, delete the temporary directory. This is destructive and cannot be undone, so confirm the path before running it:

$ printf 'about to remove: %s\n' "$dump_dir"
about to remove: /tmp/lvmdump.K7mQ2x
$ rm -rf -- "$dump_dir"
$ test ! -e "$dump_dir" && echo 'temporary dump removed'
temporary dump removed

This removal affects only the diagnostic files. lvmdump does not change LVM metadata, activate or deactivate volumes, restart a daemon, or alter the host configuration. If a service is currently stuck, investigate that condition separately rather than adding -a blindly.

Done means