Red Hat Training

A Red Hat training course is available for RHEL 8

Chapter 16. LVM selection criteria

You can use the -S or --select option with many LVM reporting and processing commands to define selection criteria for those commands:

Reporting commands

Display only the lines that satisfy the selection criteria. Examples of reporting commands for which you can define selection criteria include pvs, vgs, lvs, pvdisplay, vgdisplay, lvdisplay, lvm devtypes, and dmsetup info -c.

To show all rows, including those that do not satisfy the selection criteria, specify the -o selected option in addition to the -S option. All rows are displayed and a "selected" column that shows 1 if the row matches the selection criteria and 0 if it does not is added.

Processing commands
Process only the items that satisfy the selection criteria. Examples of processing commands for which you can define selection criteria include pvchange, vgchange, lvchange, vgimport, vgexport, vgremove, and lvremove.

Selection criteria are a set of statements that use comparison operators to define the valid values for particular fields to display or process. The selected fields are, in turn combined by logical and grouping operators.

When specifying which fields to display using selection criteria, there is no requirement for the field which is in the selection criteria to be displayed. The selection criteria can contain one set of fields while the output can contain a different set of fields:

  • For a listing of available fields for the various LVM components, see Selection criteria fields.
  • For a listing of allowed operators, see Selection criteria operators or the lvm(8) man page.
  • You can also see full sets of fields and possible operators by specifying the help (or ?) keyword for the -S or --select option of a reporting commands. For example, the following command displays the fields and possible operators for the lvs command.

    # lvs -S help
  • You can specify time values as selection criteria for fields with a field type of time. For information on specifying time values, see Specifying time values.

16.1. Selection criteria field types

The fields you specify for selection criteria are of a particular type. The help output for each field displays the filed type inside the brackets. The following help output examples show the output indicating the field types string, string_list, number, percent, size and time.

lv_name             - Name. LVs created for internal use are enclosed in brackets.[string]
lv_role             - LV role. [string list]
raid_mismatch_count - For RAID, number of mismatches found or repaired. [number]
copy_percent        - For RAID, mirrors and pvmove, current percentage in-sync. [percent]
lv_size             - Size of LV in current units. [size]
lv_time             - Creation time of the LV, if known [time]

The following table describes the selection criteria field types.

Table 16.1. Selection criteria field types

Field typeDescription

number

Non-negative integer value.

size

Floating point value with units, m unit used by default if not specified.

percent

Non-negative integer with or without % suffix.

string

Characters quoted by ` or " or unquoted.

string list

Strings enclosed by [ ] or { } and elements delimited by either "all items must match" or "at least one item must match" operator.

The values you specify for a field can be the following:

  • Concrete values of the field type.
  • Regular expressions that include any fields of the string field type, such as "+~" operator.
  • Reserved values, for example -1, unknown, undefined, undef are all keywords to denote an undefined numeric value.
  • Defined synonyms for the field values, which can be used in selection criteria for values just as for their original values.

16.2. Selection criteria operators

The following table describes the selection criteria grouping operators.

Table 16.2. Selection criteria grouping operators

Grouping operatorDescription

( )

Used for grouping statements

[ ]

Used to group strings into a string list (exact match)

{ }

Used to group strings into a string list (subset match)

The following table describes the selection criteria comparison operators and the field types with which you can use them.

Table 16.3. Selection criteria comparison operators

Comparison operatorDescriptionField type

=~

Matching regular expression

regex

!~

Not matching regular expression

regex

=

Equal to

number, size, percent, string, string list, time

!~

Not equal to

number, size, percent, string, string list, time

>=

Greater than or equal to

number, size, percent, time

>

Greater than

number, size, percent, time

<=

Less than or equal to

number, size, percent, time

<

Less than

number, size, percent, time

since

Since specified time (same as >=)

time

after

After specified time (same as >)

time

until

Until specified time (same as <=)

time

before

Before specified time (same as <)

time

The following table describes the selection criteria logical and grouping operators.

Table 16.4. Selection criteria logical and grouping operators

Logical and grouping operatorDescription

&&

All fields must match

,

All fields must match (same as &&)

||

At least one field must match

#

At least one field must match (same as ||)

!

Logical negation

(

Left parenthesis (grouping operator)

)

Right parenthesis (grouping operator)

[

List start (grouping operator)

]

List end (grouping operator)

{

List subset start (grouping operator)

}

List subset end (grouping operator)

16.3. Selection criteria fields

There are different logical and physical volume selection criteria fields you can specify. The following examples describe them.

Table 16.5. Logical volume fields

Logical volume fieldDescriptionField type

lv_uuid

Unique identifier

string

lv_name

Name (logical volumes created for internal use are encclosed in brackets)

string

lv_full_name

Full name of logical volume group, namely VG/LV

string

lv_path

Full pathname for logical volume (blank for internal logical volumes)

string

lv_dm_path

Internal device mapper pathname for logical volume (in /dev/mapper directory)

string

lv_parent

For logical volumes that are components of another logical volume, the parent logical volume

string

lv_layout

logical volume layout

string list

lv_role

logical volume role

string list

lv_initial_image_sync

Set if mirror/RAID images underwent initial resynchronization

number

lv_image_synced

Set if mirror/RAID image is synchronized

number

lv_merging

Set if snapshot logical volume is being merged to origin

number

lv_converting

Set if logical volume is being converted

number

lv_allocation_policy

logical volume allocation policy

string

lv_merge_failed

Set if snapshot merge failed

number

lv_snapshot_invalid

Set if snapshot logical volume is invalid

number

lv_skip_activation

Set if logical volume is skipped on activation

number

lv_when_full

For thin pools, behavior when full

string

lv_active

Active state of the logical volume

string

lv_major

Persistent major number or -+ if not persistent

number

lv_minor

Persistent minor number or -+ if not persistent

number

lv_read_ahead

Read ahead setting in current units

size

lv_size

Size of logical volume in current units

size

lv_metadata_size

For thin and cache pools, the size of the logical volume that holds the metadata

size

seg_count

Number of segments in logical volume

number

origin

For snapshots and thins, the origin device of this logical volume

size

origin_uuid

For snapshots and thins, the UUID of origin device of this LV.

string

origin_size

For snapshots, the size of the origin device of this logical volume

size

data_percent

For snapshot and thin pools and volumes, the percentage full if logical volume is active

percent

snap_percent

For snapshots, the percentage full if logical volume is active

percent

metadata_percent

For cache and thin pools, the percentage of metadata full if logical volume is active

percent

copy_percent

For Cache, RAID, mirrors, and pvmove, current percentage in-sync

percent

sync_percent

For Cache, RAID, mirrors, and pvmove, current percentage in-sync

percent

raid_mismatch_count

For RAID, number of mismatches found or repaired

number

raid_sync_action

For RAID, the current synchronization action being performed

string

raid_write_behind

For RAID1, the number of outstanding writes allowed to write mostly devices

number

raid_min_recovery_rate

For RAID1, the minimum recovery I/O load in kiB/sec/disk

number

raid_max_recovery_rate

For RAID1, the maximum recovery I/O load in kiB/sec/disk

number

raidintegritymode

The integrity mode

string

raidintegrityblocksize

The integrity block size

number

integritymismatches

The number of integrity mismatches

number

kernel_discards

For thin pools, how discards are handled in kernel

string

move_pv

For pvmove, source physical volume of temporary logical volume create by pvmove

string

data_lv

For thin and cache pools, the logical volume holding the associated data

string

metadata_lv

For thin and cache pools, the logical volume holding the associated metadata

string

pool_lv

For thin volumes, the thin pool logical volume for this volume

string

lv_tags

Tags, if any

string list

lv_profile

Configuration profile attached to this logical volume

string

Table 16.6. Logical volume device combined info and status fields

Logical volume fieldDescriptionField type

lv_attr

Selects according to both logical volume device info and logical volume status

string

Table 16.7. Logical volume device info fields

Logical volume fieldDescriptionField type

lv_kernel_major

Currently assigned major number or -1 if logical volume is not active

number

lv_kernel_minor

Currently assigned minor number or -1 if logical volume is not active

number

lv_suspended

Set if logical volume is suspended

number

lv_device_open

Set if logical volume device is open

number

Table 16.8. Logical volume device status fields

Logical volume fieldDescriptionField type

cache_total_blocks

Total cache blocks

number

cache_used_blocks

Used cache blocks

number

cache_dirty_blocks

Dirty cache blocks

number

cache_read_hits

Cache read hits

number

cache_read_misses

Cache read misses

number

cache_write_hits

Cache write hits

number

cache_write_misses

Cache write misses

number

writecache_block_size

The writecache block size

number

writecache_total_blocks

Total writecache blocks

number

writecache_free_blocks

Total writecache free blocks

number

writecache_writeback_blocks

Total writecache writeback blocks

number

lv_health_status

logical volume health status

string

Table 16.9. Physical volume label fields

Physical volume fieldDescriptionField type

pv_uuid

Unique identifier

string

dev_size

Size of underlying device in current units

size

pv_name

Name

string

pv_major

Device major number

number

pv_minor

Device minor number

number

pv_mda_free

Free metadata area space on this device in current units

size

pv_mda_size

Size of smallest metadata area on this device in current units

size

Table 16.10. Physical volume fields

Physical volume fieldDescriptionField type

pe_start

Offset to the start of data on the underlying device

number

pv_size

Size of physical volume in current units

size

pv_free

Total amount of unallocated space in current units

size

pv_used

Total amount of allocated space in current units

size

pv_attr

Various attributes

string

pv_missing

Set if this device is missing in system

number

pv_pe_count

Total number of physical extents

number

pv_pe_alloc_count

Total number of allocated physical extents

number

pv_tags

Tags, if any

string list

pv_mda_count

Number of metadata areas on this device

number

pv_mda_used_count

Number of metadata areas in use on this device

number

pv_device_id

Device ID such as the WWID

number

pv_device_id_type

Type of device ID such as WWID

string

Table 16.11. Volume group fields

Volume group fieldDescriptionField type

vg_uuid

Unique identifier

string

vg_name

Name

string

vg_attr

Various attributes

string

vg_exported

Set if volume group is exported

number

vg_autoactivation

Set if VG autoactivation is enabled

number

vg_partial

Set if volume group is partial

number

vg_shared

Set if VG is shared

number

vg_size

Total size of volume group in current units

size

vg_free

Total amount of free space in current units

size

vg_systemid

System ID of the volume group indicating which host owns it

string

vg_extent_size

Size of physical extents in current units

size

vg_extent_count

Total number of physical extents

number

vg_free_count

Total number of unallocated physical extents

number

vg_missing_pv_count

Number of PVs in VG which are missing

number

vg_seqno

Revision number of internal metadata that increments whenever it changes

number

vg_tags

Tags, if any

string list

vg_profile

Configuration profile attached to this volume group

string

vg_mda_count

Number of metadata areas on this volume group

number

vg_mda_used_count

Number of metadata areas in use on this volume group

number

vg_mda_free

Free metadata area space for this volume group in current units

size

vg_mda_size

Size of the smallest metadata area for this volume group in current units

size

vg_mda_copies

Target number of in use metadata areas in the volume group

number

Table 16.12. Logical volume segment fields

Logical volume segment fieldDescriptionField type

segtype

Type of logical volume segment

string

stripes

Number of stripes or mirror legs

number

data_stripes

Number of data stripes or mirror/raid1 legs

number

stripe_size

For stripes, amount of data placed on one device before switching to the next

size

region_size

For mirrors, the unit of data copied when synchronizing devices

size

chunk_size

For snapshots, the unit of data used when tracking changes

size

thin_count

For thin pools, the number of thin volumes in this pool

number

discards

For thin pool, how discards are handled

string

cache_mode

For cache pools, how writes are cached

string

zero

For thin pools, if zeroing is enabled

number

transaction_id

For thin pools, the transaction id

number

thin_id

For thin volumes, the thin device id

number

devices

Underlying devices used with starting extent numbers

string

seg_monitor

dmeventd monitoring status of the segment

string

cache_policy

The cache policy (cached segments only)

string

cache_settings

Cache settings or parameters (cached segments only)

string list

Table 16.13. Physical volume segment fields

Physical volume segment fieldDescriptionField type

pvseg_start

Physical extent number of start of segment

number

pvseg_size

Number of extents in segment

number

You can use the synonyms listed in the following table for field values. These synonyms are usable in selection criteria as well as for values just like their original values. In this table, a field value of "" indicates a blank string, which can be matched by specifying -S 'field_name=""'.

In this table, a field indicated by 0 or 1 indicates a binary value. You can specify a --binary option for reporting tools which causes binary fields to display 0 or 1 instead of what is indicated in this table as "some text" or "".

Table 16.14. Selection criteria synonyms

Field

Field value

Synonyms

pv_allocatable

allocatable

1

pv_allocatable

""

0

pv_exported

exported

1

pv_exported

""

0

pv_missing

missing

1

pv_missing

""

0

vg_extendable

extendable

1

vg_extendable

""

0

vg_exported

exported

1

vg_exported

""

0

vg_partial

partial

1

vg_partial

""

0

vg_clustered

clustered

1

vg_clustered

""

0

vg_permissions

writable

rw, read-write

vg_permissions

read-only

r, ro

vg_mda_copies

unmanaged

unknown, undefined, undef, -1

lv_initial_image_sync

initial image sync

sync, 1

lv_initial_image_sync

""

0

lv_image_synced

image synced

synced, 1

lv_image_synced

""

0

lv_merging

merging

1

lv_merging

""

0

lv_converting

converting

1

lv_converting

""

0

lv_allocation_locked

allocation locked

locked, 1

lv_allocation_locked

""

0

lv_fixed_minor

fixed minor

fixed, 1

lv_fixed_minor

""

0

lv_active_locally

active locally

active, locally, 1

lv_active_locally

""

0

lv_active_remotely

active remotely

active, remotely, 1

lv_active_remotely

""

0

lv_active_exclusively

active exclusively

active, exclusively, 1

lv_active_exclusively

""

0

lv_merge_failed

merge failed

failed, 1

lv_merge_failed

""

0

lv_snapshot_invalid

snapshot invalid

invalid, 1

lv_snapshot_invalid

""

0

lv_suspended

suspended

1

lv_suspended

""

0

lv_live_table

live table present

live table, live, 1

lv_live_table

""

0

lv_inactive_table

inactive table present

inactive table, inactive, 1

lv_inactive_table

""

0

lv_device_open

open

1

lv_device_open

""

0

lv_skip_activation

skip activation

skip, 1

lv_skip_activation

""

0

zero

zero

1

zero

""

0

lv_permissions

writable

rw, read-write

lv_permissions

read-only

r, ro

lv_permissions

read-only-override

ro-override, r-override, R

lv_when_full

error

error when full, error if no space

lv_when_full

queue

queue when full, queue if no space

lv_when_full

""

undefined

cache_policy

""

undefined

seg_monitor

""

undefined

lv_health_status

""

undefined

16.4. Specifying time values

When specifying time values for LVM selection, you can use either a standardized time specification format or a more free-form specification, as described in Standard time selection format and Time specification formats sections.

You can specify the way time values are displayed with the report/time format configuration option in the /etc/lvm/lvm.conf configuration file. Information on specifying this option is provided in the lvm.conf file. When specifying time values, you can use the comparison operator aliases since, after, until, and before.

16.4.1. Standard time selection format

You can specify time values for LVM selection in the following format:

date time timezone

Table 16.15. Time specification formats

FieldField value

date

YYYY-MM-DD

YYYY-MM, default DD=1

YYYY, default MM=01 and DD=01

time

hh:mm:ss

hh:mm, default ss=0

hh, default mm=0, default ss=0

timezone (always with + or - sign)

+hh:mm or -hh:mm

+hh or -hh

The full date/time specification is YYYY-MM-DD hh:mm:ss. Users are able to leave date/time parts from right to left. Whenever these parts are left out, a range is assumed automatically with second granularity. For example:

  • "2015-07-07 9:51" means range of "2015-07-07 9:51:00" - "2015-07-07 9:51:59"
  • "2015-07" means range of "2015-07-01 0:00:00" - "2015-07-31 23:59:59"
  • "2015" means range of "2015-01-01 0:00:00" - "2015-12-31 23:59:59"

The following examples show the date/time specification as used in selection criteria:

lvs -S 'time since "2015-07-07 9:51"'
lvs -S 'time = "2015-07""
lvs -S 'time = "2015"'

16.4.2. Freeform time selection format

You can specify the date/time specification in LVM selection criteria using the following entitles.

  • weekday names ("Sunday" - "Saturday" or abbreviated as "Sun" - "Sat")
  • labels for points in time ("noon", "midnight")
  • labels for a day relative to current day ("today", "yesterday")
  • points back in time with relative offset from today (N is a number)
  • ( "N" "seconds"/"minutes"/"hours"/"days"/"weeks"/"years" "ago")
  • ( "N" "secs"/"mins"/"hrs" …​ "ago")
  • ( "N" "s"/"m"/"h" …​ "ago")
  • time specification either in hh:mm:ss format or with AM/PM suffixes
  • month names ("January" - "December" or abbreviated as "Jan" - "Dec")

The following examples the show the freeform date/time specification as used in selection criteria:

lvs -S 'time since "yesterday 9AM"'
lvs -S 'time since "Feb 3 years 2 months ago"'
lvs -S 'time = "February 2015"'
lvs -S 'time since "Jan 15 2015" &&  time until yesterday'
lvs -S 'time since "today 6AM"'

16.5. Selection criteria display examples

A series of examples in this section show you how to use selection criteria for LVM display commands. The examples in this section use a system configured with LVM volumes that yield the following output when selection criteria are not used.

# lvs -a -o+layout,role
  LV              VG Attr       LSize   Pool Origin Data%  Meta%  Layout      Role
  root            f1 -wi-ao----   9.01g                           linear      public
  swap            f1 -wi-ao---- 512.00m                           linear      public
  [lvol0_pmspare] vg ewi-------   4.00m                           linear      private,   \
                                                                              pool,spare
  lvol1           vg Vwi-a-tz--   1.00g pool        0.00          thin,sparse public
  lvol2           vg Vwi-a-tz--   1.00g pool        0.00          thin,sparse public,    \
                                                                              origin,    \
                                                                              thinorigin
  lvol3           vg Vwi---tz-k   1.00g pool lvol2                thin,sparse public,    \
                                                                              snapshot,  \
                                                                              thinsnapshot
  pool            vg twi-aotz-- 100.00m             0.00   1.07   thin,pool   private
  [pool_tdata]    vg Twi-ao---- 100.00m                           linear      private,   \
                                                                              thin,pool, \
                                                                              data
  [pool_tmeta]    vg ewi-ao----   4.00m                           linear      private,   \
                                                                              thin,pool, \
                                                                              metadata

The following command displays all logical volumes with lvol[13] in their name, using a regular expression to specify this.

# lvs -a -o+layout,role -S 'lv_name=~lvol[13]'
  LV    VG   Attr       LSize Pool Origin Data%  Layout      Role
  lvol1 vg   Vwi-a-tz-- 1.00g pool        0.00   thin,sparse public
  lvol3 vg   Vwi---tz-k 1.00g pool lvol2         thin,sparse public,snapshot,thinsnapshot

The following command displays all logical volumes greater than 500 megabytes in size.

# lvs -a -o+layout,role -S 'lv_size>500m'
  LV    VG Attr       LSize   Pool Origin Data%  Layout      Role
  root  f1 -wi-ao----   9.01g                    linear      public
  swap  f1 -wi-ao---- 512.00m                    linear      public
  lvol1 vg Vwi-a-tz--   1.00g pool        0.00   thin,sparse public
  lvol2 vg Vwi-a-tz--   1.00g pool        0.00   thin,sparse public,origin,thinorigin
  lvol3 vg Vwi---tz-k   1.00g pool lvol2         thin,sparse public,snapshot,           \
                                                             thinsnapshot

The following command displays all logical volumes that include thin as a logical volume role, indicating that the logical volume is used in constructing a thin pool. This example uses braces ({}) to indicate a subset in the display.

# lvs -a -o+layout,role -S 'lv_role={thin}'
  LV           VG   Attr       LSize   Layout     Role
  [pool_tdata] vg   Twi-ao---- 100.00m linear     private,thin,pool,data
  [pool_tmeta] vg   ewi-ao----   4.00m linear     private,thin,pool,metadata

The following command displays all usable top-level logical volumes, which are the logical volumes with a role of public. If you do not specify braces ({}) in a string list to indicate a subset, it is assumed by default; specifying lv_role=public is equivalent to specifying lv_role={public}.

# lvs -a -o+layout,role -S 'lv_role=public'
  LV    VG Attr       LSize   Pool Origin Data%  Layout      Role
  root  f1 -wi-ao----   9.01g                    linear      public
  swap  f1 -wi-ao---- 512.00m                    linear      public
  lvol1 vg Vwi-a-tz--   1.00g pool        0.00   thin,sparse public
  lvol2 vg Vwi-a-tz--   1.00g pool        0.00   thin,sparse public,origin,thinorigin
  lvol3 vg Vwi---tz-k   1.00g pool lvol2         thin,sparse public,snapshot,thinsnapshot

The following command displays all logical volumes with a thin layout.

# lvs -a -o+layout,role -S 'lv_layout={thin}'
  LV    VG Attr       LSize   Pool Origin Data% Meta% Layout      Role
  lvol1 vg Vwi-a-tz--   1.00g pool        0.00        thin,sparse public
  lvol2 vg Vwi-a-tz--   1.00g pool        0.00        thin,sparse public,origin,          \
                                                                  thinorigin
  lvol3 vg Vwi---tz-k   1.00g pool lvol2              thin,sparse public,snapshot,        \
                                                                  thinsnapshot
  pool  vg twi-aotz-- 100.00m             0.00  1.07  thin,pool   private

The following command displays all logical volumes with a layout field that matches sparse,thin exactly. Note that it is not necessary to specify the string list members for the match to be positive.

# lvs -a -o+layout,role -S 'lv_layout=[sparse,thin]'
  LV    VG   Attr       LSize Pool Origin Data%  Layout      Role
  lvol1 vg   Vwi-a-tz-- 1.00g pool        0.00   thin,sparse public
  lvol2 vg   Vwi-a-tz-- 1.00g pool        0.00   thin,sparse public,origin,thinorigin
  lvol3 vg   Vwi---tz-k 1.00g pool lvol2         thin,sparse public,snapshot,thinsnapshot

The following command displays the logical volume names of the logical volumes that are thin, sparse logical volumes. Note that the list of fields used for selection criteria do not need to be the same as the list of fields to display.

# lvs -a -o lv_name -S 'lv_layout=[sparse,thin]'
  LV
  lvol1
  lvol2
  lvol3

16.6. Selection criteria processing examples

The following series of examples show how to use selection criteria in commands that process LVM logical volumes.

This example shows the initial configuration of a group of logical volumes, including thin snapshots. Thin snapshots have the skip_activation flag set by default. This example also includes the logical volume lvol4, which also has the skip_activation flag set.

# lvs -o name,skip_activation,layout,role
  LV    SkipAct         Layout      Role
  root                  linear      public
  swap                  linear      public
  lvol1                 thin,sparse public
  lvol2                 thin,sparse public,origin,thinorigin
  lvol3 skip activation thin,sparse public,snapshot,thinsnapshot
  lvol4 skip activation linear      public
  pool                  thin,pool   private

The following command removes the skip_activation flag from all logical volumes that are thin snapshots.

# lvchange --setactivationskip n -S 'role=thinsnapshot'
  Logical volume "lvol3" changed.

The following command shows the configuration of the logical volumes after executing the lvchange command. Note that the skip_activation flag has not been unset from the logical volume that is not a thin snapshot.

# lvs -o name,active,skip_activation,layout,role
  LV    Active SkipAct         Layout      Role
  root  active                 linear      public
  swap  active                 linear      public
  lvol1 active                 thin,sparse public
  lvol2 active                 thin,sparse public,origin,thinorigin
  lvol3                        thin,sparse public,snapshot,thinsnapshot
  lvol4 active skip activation linear      public
  pool  active                 thin,pool   private

The following command shows the configuration of the logical volumes after an additional thin origin/snapshot volume has been created.

# lvs -o name,active,skip_activation,origin,layout,role
  LV    Active SkipAct         Origin Layout      Role
  root  active                        linear      public
  swap  active                        linear      public
  lvol1 active                        thin,sparse public
  lvol2 active                        thin,sparse public,origin,thinorigin
  lvol3                        lvol2  thin,sparse public,snapshot,thinsnapshot
  lvol4 active skip activation        linear      public
  lvol5 active                        thin,sparse public,origin,thinorigin
  lvol6                        lvol5  thin,sparse public,snapshot,thinsnapshot
  pool  active                        thin,pool   private

The following command activates logical volumes that are both thin snapshot volumes and have an origin volume of lvol2.

# lvchange -ay -S 'lv_role=thinsnapshot && origin=lvol2'

# lvs -o name,active,skip_activation,origin,layout,role
  LV    Active SkipAct         Origin Layout      Role
  root  active                        linear      public
  swap  active                        linear      public
  lvol1 active                        thin,sparse public
  lvol2 active                        thin,sparse public,origin,thinorigin
  lvol3 active                 lvol2  thin,sparse public,snapshot,thinsnapshot
  lvol4 active skip activation        linear      public
  lvol5 active                        thin,sparse public,origin,thinorigin
  lvol6                        lvol5  thin,sparse public,snapshot,thinsnapshot
  pool  active                        thin,pool   private

If you execute a command on a whole item while specifying selection criteria that match an item from that whole, the entire whole item is processed. For example, if you change a volume group while selecting one or more items from that volume group, the whole volume group is selected. This example selects logical volume lvol1, which is part of volume group vg. All of the logical volumes in volume group vg are processed.

# lvs -o name,vg_name
  LV    VG
  root  fedora
  swap  fedora
  lvol1 vg
  lvol2 vg
  lvol3 vg
  lvol4 vg
  lvol5 vg
  lvol6 vg
  pool  vg

# vgchange -ay -S 'lv_name=lvol1'
  7 logical volume(s) in volume group "vg" now active

The following example shows a more complex selection criteria statement. In this example, all logical volumes are tagged with mytag if they have a role of origin and either are named lvol[456] or the logical volume size is more than 5 gigabytes.

# lvchange --addtag mytag -S '(role=origin && lv_name=~lvol[456]) || lv_size > 5g'
  Logical volume "root" changed.
  Logical volume "lvol5" changed.