2017-02-11 01:20:19 +03:00
pvscan scans all supported LVM block devices in the system for PVs.
\fBScanning with lvmetad\fP
2015-05-01 21:44:31 +03:00
pvscan operates differently when used with the
.BR lvmetad (8)
daemon.
Scanning disks is required to read LVM metadata and identify LVM PVs.
Once read, lvmetad caches the metadata so that LVM commands can read it
without repeatedly scanning disks. This is helpful because scanning disks
is time consuming, and frequent scanning may interfere with the normal
work of the system and disks.
When lvmetad is not used, LVM commands revert to scanning disks to read
metadata. Any LVM command that needs metadata will scan disks for it;
running the pvscan command is not necessary for the sake of other LVM
commands.
When lvmetad is used, LVM commands avoid scanning disks by reading
metadata from lvmetad. When new disks appear, they must be scanned so
their metadata can be cached in lvmetad. This is done by the command
2017-03-27 17:45:48 +03:00
pvscan --cache, which scans disks and passes the metadata to lvmetad.
2015-05-01 21:44:31 +03:00
2017-03-27 17:45:48 +03:00
The pvscan --cache command is typically run automatically by system
2015-05-01 21:44:31 +03:00
services when a new device appears. Users do not generally need to run
this command if the system and lvmetad are running properly.
Many scripts contain unnecessary pvscan (or vgscan) commands for
historical reasons. To avoid disrupting the system with extraneous disk
2017-03-27 17:45:48 +03:00
scanning, an ordinary pvscan (without --cache) will simply read metadata
2015-05-01 21:44:31 +03:00
from lvmetad like other LVM commands. It does not do anything beyond
displaying the current state of the cache.
.IP \[bu] 2
2017-03-27 17:45:48 +03:00
When given specific device name arguments, pvscan --cache will only
2015-05-01 21:44:31 +03:00
read the named devices.
.IP \[bu] 2
2016-08-03 23:49:43 +03:00
LVM udev rules and systemd services are used to initiate automatic device
2015-05-01 21:44:31 +03:00
scanning.
.IP \[bu] 2
2017-03-27 17:45:48 +03:00
To prevent devices from being scanned by pvscan --cache, add them
2015-05-01 21:44:31 +03:00
to
.BR lvm.conf (5)
.B devices/global_filter.
The devices/filter setting does not
apply to system level scanning.
For more information, see:
.br
2017-03-27 17:45:48 +03:00
.B lvmconfig --withcomments devices/global_filter
2015-05-01 21:44:31 +03:00
.IP \[bu] 2
If lvmetad is started or restarted after devices are visible, or
if the global_filter has changed, then all devices must be rescanned
2017-03-27 17:45:48 +03:00
for metadata with the command pvscan --cache.
2015-05-01 21:44:31 +03:00
.IP \[bu] 2
2016-08-03 23:49:43 +03:00
lvmetad does not cache older metadata formats, e.g. lvm1, and will
be temporarily disabled if they are seen.
2015-05-01 21:44:31 +03:00
.IP \[bu] 2
To notify lvmetad about a device that is no longer present, the major and
minor numbers must be given, not the path.
2017-02-11 01:20:19 +03:00
.P
\fBAutomatic activation\fP
2015-05-01 21:44:31 +03:00
When event-driven system services detect a new LVM device, the first step
is to automatically scan and cache the metadata from the device. This is
2017-03-27 17:45:48 +03:00
done by pvscan --cache. A second step is to automatically activate LVs
2015-05-01 21:44:31 +03:00
that are present on the new device. This auto-activation is done by the
2017-09-18 18:56:39 +03:00
same pvscan --cache command when the option --activate ay is included.
2015-05-01 21:44:31 +03:00
Auto-activation of VGs or LVs can be enabled/disabled using:
.br
.BR lvm.conf (5)
.B activation/auto_activation_volume_list
For more information, see:
.br
2017-03-27 17:45:48 +03:00
.B lvmconfig --withcomments activation/auto_activation_volume_list
2015-05-01 21:44:31 +03:00
When this setting is undefined, all LVs are auto-activated (when lvm is
fully integrated with the event-driven system services.)
When a VG or LV is not auto-activated, traditional activation using
2017-09-18 18:56:39 +03:00
vgchange or lvchange --activate is needed.
2015-05-01 21:44:31 +03:00
.IP \[bu] 2
2017-03-27 17:45:48 +03:00
pvscan auto-activation can be only done in combination with --cache.
2015-05-01 21:44:31 +03:00
.IP \[bu] 2
2017-09-18 18:56:39 +03:00
Auto-activation is designated by the "a" argument in --activate ay.
2015-05-01 21:44:31 +03:00
This is meant to distinguish system generated commands from explicit user
commands, although it can be used in any activation command. Whenever it
is used, the auto_activation_volume_list is applied.
.IP \[bu] 2
Auto-activation is not yet supported for LVs that are part of partial or
clustered volume groups.