Questo contenuto non è disponibile nella lingua selezionata.

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.
Copy to Clipboard Toggle word wrap
# 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.
Copy to Clipboard Toggle word wrap
# 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.
Copy to Clipboard Toggle word wrap
# 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.
Copy to Clipboard Toggle word wrap
# 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.
Copy to Clipboard Toggle word wrap
# 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.
Copy to Clipboard Toggle word wrap
# 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 are also named lvol[456] or the logical volume size is more than 5 gigabytes.
Copy to Clipboard Toggle word wrap
# lvchange --addtag mytag -S '(role=origin && lv_name=~lvol[456]) || lv_size > 5g'
  Logical volume "root" changed.
  Logical volume "lvol5" changed.
Torna in cima
Red Hat logoGithubredditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi. Esplora i nostri ultimi aggiornamenti.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita il Blog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

Theme

© 2025 Red Hat, Inc.