此内容没有您所选择的语言版本。
C.5. 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 volmes that are thin snapshots.
lvchange --setactivationskip n -S 'role=thinsnapshot'
# 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.
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 5g.
lvchange --addtag mytag -S '(role=origin && lv_name=~lvol[456]) || lv_size > 5g'
# lvchange --addtag mytag -S '(role=origin && lv_name=~lvol[456]) || lv_size > 5g'
Logical volume "root" changed.
Logical volume "lvol5" changed.