lvscan — quick reference
Scan and list
| When to use | Command |
|---|---|
| List all LVs on the system | sudo lvscan |
| Include internal LVs (mirror legs, thin metadata) | sudo lvscan -a |
| Show block device major:minor | sudo lvscan -b |
| Test mode — no metadata write, no activation changes | sudo lvscan -t |
| Read metadata without write locks | sudo lvscan --readonly |
| Scan without loading device-mapper tables | sudo lvscan --driverloaded n |
| Continue if locking fails (cluster edge cases) | sudo lvscan --ignorelockingfailure |
Related listing tools
| When to use | Command |
|---|---|
| Custom columns (script friendly) | sudo lvs |
| Full LV attributes | sudo lvdisplay |
| Activate/deactivate LVs | sudo lvchange -ay / -an |
Help and version
| When to use | Command |
|---|---|
| Show built-in usage | lvscan --help |
| Show LVM version | lvm version |
lvscan — command syntax
Synopsis from lvscan --help on Ubuntu 25.04 (LVM 2.03.27):
lvscan
[ -a|--all ]
[ -b|--blockdevice ]
[ --ignorelockingfailure ]
[ --readonly ]
[ COMMON_OPTIONS ]lvscan reads VG metadata and reports LV paths. With the default driver loaded, active LVs show as ACTIVE. Needs sudo for full visibility on multi-user hosts.
lvscan — command examples
Essential List every logical volume on the host
Run without arguments to see activation state, path, size, and allocation policy (last column).
sudo lvscanSample output:
ACTIVE '/dev/ubuntu-vg/ubuntu-lv' [58.41 GiB] inherit
ACTIVE '/dev/labvg/datalv' [64.00 MiB] inherit
ACTIVE '/dev/labvg/pctlv' [48.00 MiB] inheritACTIVE means the device-mapper node is loaded. inherit is the default allocation policy from the VG.
Common Read Original and Snapshot labels
Snapshot pairs show their role in the status column.
sudo lvscan | grep labvgSample output:
ACTIVE Original '/dev/labvg/datalv' [64.00 MiB] inherit
ACTIVE Snapshot '/dev/labvg/snaplv' [16.00 MiB] inheritThe snapshot row is the -s LV; Original is the source LV.
Common Include internal logical volumes with -a
Mirror, RAID, and thin-pool layouts expose hidden component LVs. -a lists them for debugging — they are not normally mounted directly.
sudo lvscan -a | head -20On a simple linear-only host you may see the same lines as plain lvscan. On mirrored LVs extra [_mimage_*] entries appear.
Common Compare lvscan with lvs and lvdisplay
lvs is column-oriented for scripts; lvdisplay is verbose; lvscan is the quick human scan line.
sudo lvs labvg
sudo lvdisplay labvg/datalv | head -15Sample lvs output:
LV VG Attr LSize
datalv labvg -wi-a----- 64.00mPick lvscan for a fast health check across all VGs.
Advanced Test scan without changing metadata
-t prints what would be scanned without updating cache files or activating volumes — safe for read-only inspection scripts.
sudo lvscan -t | grep labvgSample output:
TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
ACTIVE '/dev/labvg/datalv' [64.00 MiB] inheritThe leading TEST MODE line confirms no metadata write occurred.
Advanced Peek at metadata without locks
--readonly reads on-disk metadata without acquiring LVM write locks. LVs show as inactive because tables are not activated.
sudo lvscan --readonly | grep labvgSample output:
inactive '/dev/labvg/datalv' [64.00 MiB] inheritUseful when inspecting a disk image or clustered VG without joining the lock manager.
Advanced Scan with device-mapper driver unloaded
--driverloaded n skips device-mapper activation — everything reports inactive.
sudo lvscan --driverloaded n 2>&1 | head -5Sample output:
WARNING: Activation disabled. No device-mapper interaction will be attempted.
inactive '/dev/ubuntu-vg/ubuntu-lv' [58.41 GiB] inherit
inactive '/dev/labvg/datalv' [64.00 MiB] inheritExpect inactive even for root LVs — this is a diagnostic mode, not production state.
lvscan — when to use / when not
| Use lvscan when | Use something else when |
|---|---|
|
lvscan vs lvs vs lvdisplay
| lvscan | lvs | lvdisplay | |
|---|---|---|---|
| Output | One line per LV, activation focus | Configurable columns | Multi-field report |
| Best for | Quick audit | Scripts / monitoring | Troubleshooting detail |
Maps (-m) |
No | Via -o seg_pe_ranges |
lvdisplay -m |
Related commands
lvscan — interview corner
What does lvscan show?
Each line includes activation state (ACTIVE / inactive), device path, size, and allocation policy. Snapshot rows add Original or Snapshot labels.
A strong answer is:
"lvscan is the quick inventory of all logical volumes — path, size, active or not, and policy — across every volume group."
What does inactive mean in lvscan output?
The LV metadata exists but the device-mapper table is not loaded — often because lvchange -an was used, --readonly / --driverloaded n was passed, or the LV was never activated.
A strong answer is:
"inactive means the LV is known to LVM but not activated in device-mapper — check lvchange -ay if it should be active."
When use lvscan -t or --readonly?
-t is test mode for scripts that must not touch metadata. --readonly inspects disk metadata without locks — useful for VM images or broken locking.
A strong answer is:
"-t for dry-run scans; --readonly when I need metadata without acquiring LVM write locks."
lvscan or lvs for monitoring?
lvs -o lv_name,vg_name,lv_size,lv_attr is better for Prometheus-style metrics. lvscan is faster for an admin eyeballing the system.
A strong answer is:
"lvs with -o fields for monitoring; lvscan when I want a quick human-readable pass over every LV."
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| LV missing from output | Filtered VG inactive or foreign | vgs -a, vgchange -ay |
All LVs inactive with readonly |
Expected with --readonly |
Run plain lvscan for live state |
Failed to lock VG |
Another host holds cluster lock | --ignorelockingfailure or fix locking |
| Stale sizes | Cached metadata | vgscan --mknodes or lvchange --refresh |
