C.6. Selection Criteria Processing Examples This section provides a series of examples showing 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. The following command removes the skip activation flag from all logical volumes that are thin snapshots. 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. The following command shows the configuration of the logical volumes after an additional thin origin/snapshot volume has been created. The following command activates logical volumes that are both thin snapshot volumes and have an origin volume of lvol2 . 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. 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 are also named lvol[456] or the logical volume size is more than 5 gigabytes.

Commands:
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
lvchange --setactivationskip n -S 'role=thinsnapshot' Logical volume "lvol3" changed.
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
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
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
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
lvchange --addtag mytag -S '(role=origin && lv_name=~lvol[456]) || lv_size > 5g' Logical volume "root" changed. Logical volume "lvol5" changed.