summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* device usage based on devices filedev-dct-deviceid-10David Teigland2020-07-3137-43/+2891
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The devices file, e.g. /etc/lvm/devices/lvm_devices.dat, is a list of devices that lvm can use. The option --devicesfile can specify a different file 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. TODO: pvchange --deviceidupdate PV vgchange --deviceidupdate VG duplicate PV resolution using device_id vgimportclone needs to update device file (change to pvids) pvchange --uuid needs to update device file search for pvid when no wwid is available and PV is missing device_id_type for md devices shortsystemid crc of systemid and written in pv header use shortsystemid for new filter and orphan PV ownership dmeventd and lvmpolld with devices file
* pvcreate/pvremove: reimplement checksDavid Teigland2020-06-232-298/+230
|
* improve info about vgck updatemetadataDavid Teigland2020-06-033-2/+17
| | | | | Add man page info about this option, and add log messages pointing to this option.
* Change dev->bcache_fd default value from 0 to -1Zhao Heming2020-06-011-0/+1
| | | | | | This fix can avoid bcache_fd will mistakenly open/close in later. Signed-off-by: Zhao Heming <heming.zhao@suse.com>
* Revert "pvck: dump headers_only to skip metadata text"David Teigland2020-05-293-12/+3
| | | | | | This reverts commit 5410dd5441aa827b381ff64dfc6be6e4589d87a1. Accidental push.
* integrity: skip calling add when removing imagesDavid Teigland2020-05-291-1/+4
| | | | | | | When lvconvert is used to remove raid images, we can skip calling lv_add_integrity_to_raid(), which finds nothing to do, but the the blocksize validation would be called unnecessarily and trigger spurious errors.
* tests: integrity wait for syncDavid Teigland2020-05-291-13/+33
| | | | | | | | | | The test was using a raid+integrity LV without first waiting for the integrity sync, which could cause the test to fail (depending on init speed) where it depends on integrity to work in uninitialized areas. Also use cmp instead of diff.
* pvck: dump headers_only to skip metadata textDavid Teigland2020-05-283-3/+12
| | | | | | | | pvck --dump headers reads the metadata text area to compute the text metadata checksum to compare with the mda_header checksum. The new header_only will skip reading the metadata text and not validate the mda_header checksum.
* test: Warn and exit on problematic integrity device behaviorMarian Csontos2020-05-284-0/+32
| | | | | The first leg of integrity enabled raid device sometimes does not get recalculated.
* lvconvert: error when using existing cachevolDavid Teigland2020-05-222-0/+28
| | | | | Check if LV is an existing cachevol before attempting to use it again as a cachevol or cachepool.
* tests: also udev wait on clean-up pathZdenek Kabelac2020-05-211-4/+10
|
* test: Use printf to generate dataMarian Csontos2020-05-214-20/+12
| | | | ...to avoid unnecessary dependency on python
* tests: Use python single liner to generate dataMarian Csontos2020-05-214-12/+20
|
* build: make generateMarian Csontos2020-05-212-0/+116
|
* tests: add wait on udev processingZdenek Kabelac2020-05-201-1/+3
| | | | | Trying to avoid collision with udev watch rule preventing to succeed 'dmsetup remove' becuase it keeps device open.
* list: use container_ofZdenek Kabelac2020-05-202-6/+4
| | | | Reuse macro
* pvck: set dump on one callZdenek Kabelac2020-05-201-6/+2
| | | | | | | arg_str_value() has built-in arg_is_set(). Also this makes it obvious to coverity 'dump != NULL' & 'repair != NULL' at the branch code path.
* cov: lvconvert: missing check for function failureZdenek Kabelac2020-05-201-1/+2
|
* cov: check strdup for NULLZdenek Kabelac2020-05-201-4/+8
|
* cov: check for deactivation failureZdenek Kabelac2020-05-201-2/+7
|
* lvmcache: free vginfo lock_typeDavid Teigland2020-05-141-0/+2
|
* hints: free hint structs on exitDavid Teigland2020-05-132-0/+4
| | | | and free on a couple error paths.
* devs: add some checks for a dev with no path nameDavid Teigland2020-05-132-0/+6
| | | | | | | | It's possible for a dev-cache entry to remain after all paths for it have been removed, and other parts of the code expect that a dev always has a name. A better fix may be to remove a device from dev-cache after all paths to it have been removed.
* lvmlockd: use 4K sector size when any dev is 4KDavid Teigland2020-05-111-10/+4
| | | | | | | | | | When either logical block size or physical block size is 4K, then lvmlockd creates sanlock leases based on 4K sectors, but the lvm client side would create the internal lvmlock LV based on the first logical block size it saw in the VG, which could be 512. This could cause the lvmlock LV to be too small to hold all the sanlock leases. Make the lvm client side use the same sizing logic as lvmlockd.
* spec: Enable integrityMarian Csontos2020-05-051-0/+1
|
* lvmlockd: replace lock adopt info sourceDavid Teigland2020-05-045-187/+207
| | | | | | | The lock adopt feature was disabled since it had used lvmetad as a source of info. This replaces the lvmetad info with a local file and enables the adopt feature again (enabled with lvmlockd --adopt 1).
* remove vg_read_errorDavid Teigland2020-04-244-18/+2
| | | | Once converted results to error numbers but is now just a null check.
* use refresh_filters only where neededDavid Teigland2020-04-222-11/+3
| | | | | | Filters are changed and need refresh in only one place (vgimportclone), so avoid doing the refresh for every other command that doesn't need it.
* Fix scripts/lvmlocks.service.in using nonexistent --lock-opt autowaitMaxim Plotnikov2020-04-211-1/+1
| | | | | | The --lock-opt autowait was dropped back in 9ab6bdce01, and attempting to specify it has quite an opposite effect: no waiting is done, which makes the unit almost useless.
* lvmcache: rework handling of VGs with duplicate vgnamesDavid Teigland2020-04-218-327/+1264
| | | | | | The previous method of managing duplicate vgnames prevented vgreduce from working if a foreign vg with the same name existed.
* pass cmd struct through more functionsDavid Teigland2020-04-2110-33/+39
| | | | no functional change
* lvmcache_get_mda: remove unused functionDavid Teigland2020-04-212-35/+0
|
* vgrename: fix error value when name existsDavid Teigland2020-04-211-1/+1
|
* WHATS_NEW: integrity with raidDavid Teigland2020-04-151-0/+1
|
* Allow dm-integrity to be used for raid imagesDavid Teigland2020-04-1545-37/+3790
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dm-integrity stores checksums of the data written to an LV, and returns an error if data read from the LV does not match the previously saved checksum. When used on raid images, dm-raid will correct the error by reading the block from another image, and the device user sees no error. The integrity metadata (checksums) are stored on an internal LV allocated by lvm for each linear image. The internal LV is allocated on the same PV as the image. Create a raid LV with an integrity layer over each raid image (for raid levels 1,4,5,6,10): lvcreate --type raidN --raidintegrity y [options] Add an integrity layer to images of an existing raid LV: lvconvert --raidintegrity y LV Remove the integrity layer from images of a raid LV: lvconvert --raidintegrity n LV Settings Use --raidintegritymode journal|bitmap (journal is default) to configure the method used by dm-integrity to ensure crash consistency. Initialization When integrity is added to an LV, the kernel needs to initialize the integrity metadata/checksums for all blocks in the LV. The data corruption checking performed by dm-integrity will only operate on areas of the LV that are already initialized. The progress of integrity initialization is reported by the "syncpercent" LV reporting field (and under the Cpy%Sync lvs column.) Example: create a raid1 LV with integrity: $ lvcreate --type raid1 -m1 --raidintegrity y -n rr -L1G foo Creating integrity metadata LV rr_rimage_0_imeta with size 12.00 MiB. Logical volume "rr_rimage_0_imeta" created. Creating integrity metadata LV rr_rimage_1_imeta with size 12.00 MiB. Logical volume "rr_rimage_1_imeta" created. Logical volume "rr" created. $ lvs -a foo LV VG Attr LSize Origin Cpy%Sync rr foo rwi-a-r--- 1.00g 4.93 [rr_rimage_0] foo gwi-aor--- 1.00g [rr_rimage_0_iorig] 41.02 [rr_rimage_0_imeta] foo ewi-ao---- 12.00m [rr_rimage_0_iorig] foo -wi-ao---- 1.00g [rr_rimage_1] foo gwi-aor--- 1.00g [rr_rimage_1_iorig] 39.45 [rr_rimage_1_imeta] foo ewi-ao---- 12.00m [rr_rimage_1_iorig] foo -wi-ao---- 1.00g [rr_rmeta_0] foo ewi-aor--- 4.00m [rr_rmeta_1] foo ewi-aor--- 4.00m
* move pv_list code into libDavid Teigland2020-04-135-279/+296
|
* blkdeactivate: add support for VDO in blkdeactivate scriptPeter Rajnoha2020-04-093-1/+59
| | | | | | Make it possible to tear down VDO volumes with blkdeactivate if VDO is part of a device stack (and if VDO binary is installed). Also, support optional -o|--vdooptions configfile=file.
* WHATS_NEWS: updateZdenek Kabelac2020-04-081-0/+1
|
* test: repair of thin-pool used by foreign appsZdenek Kabelac2020-04-081-0/+72
|
* lvconvert: no validation for thin-pools not used by lvm2Zdenek Kabelac2020-04-081-1/+2
| | | | | | | | lvm2 supports thin-pool to be later used by other tools doing virtual volumes themself (i.e. docker) - in this case we shall not validate transaction Id - is this is used by other tools and lvm2 keeps value 0 - so the transationId validation need to be skipped in this case.
* post-releaseMarian Csontos2020-03-264-2/+8
|
* pre-releasev2_03_09Marian Csontos2020-03-264-6/+6
|
* vdo: make vdopool wrapping device is read-onlyZdenek Kabelac2020-03-231-1/+1
| | | | | | | When vdopool is activated standalone - we use a wrapping linear device to hold actual vdo device active - for this we can set-up read-only device to ensure there cannot be made write through this device to actual pool device.
* test: Fix previous commitMarian Csontos2020-03-181-1/+1
|
* test: Can not attach writecache to active volumeMarian Csontos2020-03-181-1/+4
|
* reduce device path error messsagesDavid Teigland2020-03-123-6/+13
| | | | | | When /dev entries or sysfs entries are changing due to concurrent lvm commands, it can cause warning/error messages about missing paths.
* man: lvm2-activation-generator fix vgchange commentDavid Teigland2020-03-101-1/+1
| | | | generated services use vgchange -aay (not -ay)
* lvmlockd: use transient LV lock when creating snapshotDavid Teigland2020-03-091-1/+1
| | | | | | | | | Creating a snapshot was using a persistent LV lock on the origin, so if the origin LV was inactive at the time of the snapshot the LV lock would remain. (Running lvchange -an on the inactive LV would clear the LV lock.) Use a transient LV lock so it will be dropped if it was not locked previously.
* writecache: require inactive LV to attachDavid Teigland2020-03-091-9/+10
| | | | | | | | Prevent attaching writecache to an active LV until we can determine the block size of the fs on the LV, and use that to enforce an appropriate writecache block size. Changing the block size under a mounted fs can cause panic/corruption.
* WHATS_NEW_DM: updateZdenek Kabelac2020-03-051-0/+2
|