1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00
lvm2/tools
David Teigland dc5e6a2cc1 device usage based on devices file
The devices file /etc/lvm/devices/system.devices
is a list of devices that lvm can use.
The option --devicesfile can specify a different file
name with a separate set of devices for lvm to use.
This option allows different applications to use
lvm on different sets of devices.

In most cases (with limited exceptions), lvm will not
read or use a device not listed in the devices file.
When the devices file is used, the filter-regex is
not used and the filter settings in lvm.conf are
ignored.  filter-deviceid is used when the devices
file is enabled and rejects any device that does not
match an entry in the devices file.

Set use_devicesfile = 0 in lvm.conf or set
--devicesfile "" on the command line to disable the
use of a devices file.  When disabled, lvm will see
and use any device on the system that passes the
regex filter.

A device_id, e.g. wwid or serial number from sysfs,
is a unique ID that identifies a device without
reading it.  Two devices with identical content
should have different device_ids in most common
cases.  The device_id is used in the devices file
and is included in VG metadata sections.

Each device_id has a device_id_type which indicates
where the device_id comes from, e.g. "sys_wwid"
means the device_id comes from the sysfs wwid file.
Others are sys_serial, mpath_uuid, loop_file, devname.
(devname is the device path which is a fallback when
no other proper device_id_type is available.)

filter-deviceid permits lvm to use only devices
on the system that have a device_id matching a
devices file entry.  Using the device_id, lvm can
determine the set of devices to use without reading
any devices, so the devices file will constrain lvm
in two ways:
1. it limits the devices that lvm will read.
2. it limits the devices that lvm will use.

In some uncommon cases, e.g. when devices have no
unique ID and device_id has to fall back to using
the devname, lvm may need to read all devices on the
system to determine which ones correspond to the
devices file entries.  In this case, the devices file
does not limit the devices that lvm reads, but it does
limit the devices that lvm uses.

pvcreate/vgcreate/vgextend are not constrained by
the devices file, and will look outside it to find
the new PV.  They assign the new PV a device_id
and add it to the devices file.  It is also possible
to explicitly add new PVs to the devices file before
using them in pvcreate/etc, in which case these commands
would not need to access devices outside the devices file.

vgimportdevices VG looks at all devices on the system
to find an existing VG and add its devices to the
devices file.  The command is not limited by an
existing devices file.  The command will also add
device_ids to the VG metadata if the VG does not yet
include device_ids.  vgimportdevices -a imports devices
for all accessible VGs.  Since vgimportdevices does not
limit itself to devices in an existing devices file, the
lvm.conf regex filter applies.  Adding --foreign will
import devices for foreign VGs, but device_ids are
not added to foreign VGs.  Incomplete VGs are not
imported.

The lvmdevices command manages the devices file.
The primary purpose is to edit the devices file,
but it will read PV headers to find/check PVIDs.
(It does not read, process or modify VG metadata.)

lvmdevices
. Displays devices file entries.
lvmdevices --check
. Checks devices file entries.
lvmdevices --update
. Updates devices file entries.
lvmdevices --adddev <devname>
. Adds devices_file entry (reads pv header).
lvmdevices --deldev <devname>
. Removes devices file entry.
lvmdevices --addpvid <pvid>
. Reads pv header of all devices to find <pvid>,
  and if found adds devices file entry.
lvmdevices --delpvid <pvid>
. Removes devices file entry.

The vgimportclone command has a new option --importdevices
that does the equivalent of vgimportdevices with the cloned
devices that are being imported.  The devices are "uncloned"
(new vgname and pvids) while at the same time adding the
devices to the devices file.  This allows cloned PVs to be
imported without duplicate PVs ever appearing on the system.

TODO:
device_id_type for other special devices (nbd, drbd, others?)
dmeventd run commands with --devicesfile dmeventd.devices

OTHER:
allow operations with duplicate pvs if device id and size match only one dev
shortsystemid crc of systemid and written in pv header
use shortsystemid for new filter and orphan PV ownership
command to set boot flag on devices file entries needed for boot
vgchange -ay option to use devices file entries with boot flag
2020-11-25 14:47:29 -06:00
..
.exported_symbols generate liblvm2cmd exported symbols too 2010-06-25 18:23:10 +00:00
.gitignore tools: add generated headers to .gitignore 2017-03-10 13:13:41 +00:00
args.h device usage based on devices file 2020-11-25 14:47:29 -06:00
cmdnames.h doc: change fsf address 2016-01-21 12:11:37 +01:00
command-lines.in device usage based on devices file 2020-11-25 14:47:29 -06:00
command.c man: more precise UNIT 2020-10-24 01:42:16 +02:00
command.h fix command definition for pvchange -a 2019-06-10 13:43:20 -05:00
commands.h device usage based on devices file 2020-11-25 14:47:29 -06:00
dumpconfig.c lvmconfig: Add options to produce file preamble 2017-08-05 16:23:34 +01:00
errors.h tools: Introduce exit code EINIT_FAILED. 2017-07-26 23:18:03 +01:00
formats.c doc: change fsf address 2016-01-21 12:11:37 +01:00
license.inc pre-release 2017-03-28 16:11:35 +01:00
lv_props.h Allow dm-integrity to be used for raid images 2020-04-15 12:10:32 -05:00
lv_types.h Allow dm-integrity to be used for raid images 2020-04-15 12:10:32 -05:00
lvchange.c lvchange: fix error for foreign vg activation 2020-11-17 09:22:40 -06:00
lvconvert_poll.c lvconvert_poll: ensure LV has snapshot type 2020-09-11 21:47:34 +02:00
lvconvert_poll.h build: Don't generate symlinks in include/ dir 2018-05-14 10:30:20 +01:00
lvconvert.c lvconvert: move log message to fix segfault 2020-10-02 09:23:25 -05:00
lvcreate.c cleanup: user force_t enums instead of ints 2020-09-01 17:57:50 +02:00
lvdisplay.c process_each_lv: add check_single_lv function 2017-02-13 08:20:10 -06:00
lvextend.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvm2cmd-static.c lvmcmdlib: lvm2_init_threaded 2020-10-20 22:22:52 +02:00
lvm2cmd.c lvmcmdlib: lvm2_init_threaded 2020-10-20 22:22:52 +02:00
lvm2cmd.h lvmcmdlib: lvm2_init_threaded 2020-10-20 22:22:52 +02:00
lvm2cmdline.h lvmcmdlib: lvm2_init_threaded 2020-10-20 22:22:52 +02:00
lvm-static.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvm.c lvm: add readline alternative editline 2020-09-29 10:13:24 +02:00
lvmcmdlib.c lvmcmdlib: lvm2_init_threaded 2020-10-20 22:22:52 +02:00
lvmcmdline.c device usage based on devices file 2020-11-25 14:47:29 -06:00
lvmdevices.c device usage based on devices file 2020-11-25 14:47:29 -06:00
lvmdiskscan.c remove unused full filter 2018-12-04 14:06:46 -06:00
lvpoll.c build: Don't generate symlinks in include/ dir 2018-05-14 10:30:20 +01:00
lvreduce.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvremove.c process_each_lv: add check_single_lv function 2017-02-13 08:20:10 -06:00
lvrename.c toollib: make it possible to also process internal VGs, add 'include_internal' switch to process_each_vg fn 2016-06-20 11:33:42 +02:00
lvresize.c lvextend: refresh shared LV remotely using dlm/corosync 2019-03-21 12:38:20 -05:00
lvscan.c Remove lvmetad 2018-07-11 11:26:42 -05:00
Makefile.in device usage based on devices file 2020-11-25 14:47:29 -06:00
polldaemon.c device usage based on devices file 2020-11-25 14:47:29 -06:00
pvchange.c device usage based on devices file 2020-11-25 14:47:29 -06:00
pvck.c device usage based on devices file 2020-11-25 14:47:29 -06:00
pvcreate.c device usage based on devices file 2020-11-25 14:47:29 -06:00
pvdisplay.c add device hints to reduce scanning 2019-01-15 10:23:47 -06:00
pvmove_poll.c pvmove: add missing synchronization 2019-08-20 12:44:39 +02:00
pvmove_poll.h doc: change fsf address 2016-01-21 12:11:37 +01:00
pvmove.c pvmove: check return value of top_level_lv_name() 2020-09-11 21:43:08 +02:00
pvremove.c pvcreate: call label scan prior to pvcreate_each_device 2019-04-30 14:10:27 -05:00
pvresize.c exported vg handling 2019-06-25 15:39:08 -05:00
pvscan.c device usage based on devices file 2020-11-25 14:47:29 -06:00
reporter.c cleanup: matching declaration order 2020-09-01 17:57:50 +02:00
segtypes.c doc: change fsf address 2016-01-21 12:11:37 +01:00
stub.h Remove vgconvert 2018-06-13 14:14:03 -05:00
tags.c doc: change fsf address 2016-01-21 12:11:37 +01:00
tool.h configure: avoid repeative inclusion of configure.h 2018-12-21 19:19:50 +01:00
toollib.c device usage based on devices file 2020-11-25 14:47:29 -06:00
toollib.h writecache: cachesettings in lvchange and lvs 2020-06-10 12:14:00 -05:00
tools.h device usage based on devices file 2020-11-25 14:47:29 -06:00
vals.h Revert "pvck: dump headers_only to skip metadata text" 2020-05-29 13:26:43 -05:00
vgcfgbackup.c improve reading and repairing vg metadata 2019-06-07 15:54:04 -05:00
vgcfgrestore.c locking: unify global lock for flock and lockd 2019-04-29 13:01:05 -05:00
vgchange.c cov: check for deactivation failure 2020-05-20 15:55:39 +02:00
vgck.c vgck: fix updatemetadata writing different descriptions 2019-10-11 12:57:32 -05:00
vgcreate.c device usage based on devices file 2020-11-25 14:47:29 -06:00
vgdisplay.c tidy: Add missing underscores to statics. 2017-10-18 15:58:13 +01:00
vgexport.c lvmlockd: primarily use vg_is_shared 2018-06-01 13:15:22 -05:00
vgextend.c device usage based on devices file 2020-11-25 14:47:29 -06:00
vgimport.c exported vg handling 2019-06-25 15:39:08 -05:00
vgimportclone.c device usage based on devices file 2020-11-25 14:47:29 -06:00
vgimportdevices.c device usage based on devices file 2020-11-25 14:47:29 -06:00
vgmerge.c remove vg_read_error 2020-04-24 11:14:29 -05:00
vgmknodes.c process_each_lv: add check_single_lv function 2017-02-13 08:20:10 -06:00
vgreduce.c add suggestion message for mirror LVs 2020-01-15 09:46:54 -06:00
vgremove.c exported vg handling 2019-06-25 15:39:08 -05:00
vgrename.c vgrename: fix error value when name exists 2020-04-21 09:33:56 -05:00
vgscan.c locking: unify global lock for flock and lockd 2019-04-29 13:01:05 -05:00
vgsplit.c vgsplit: support for VDO volumes 2020-09-25 22:51:50 +02:00