Appendix C. LVM Selection Criteria


As of Red Hat Enterpise Linux release 6.6, many LVM reporting commmands accept the -S or --select option to define selection criteria for those commands. As of Red Hat Enterprise Linux release 6.7, many processing commands support selection criteria as well. These two categories of commands for which you can define selection criteria are defined as follows:
  • 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.
    Specifying the -o selected option in addition to the -S option displays all rows and adds a "selected" column that shows 1 if the row matches the selection criteria and 0 if it does not.
  • 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 Section C.3, “Selection Criteria Fields”.
  • For a listing of allowed operators, see Section C.2, “Selection Criteria Operators”. The operators are also provided on 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/--select option of a reporting commands. For example, the following command displays the fields and possible operators for the lvs command.
    # lvs -S help
For the Red Hat Enterprise Linux 6.8 release, you can specify time values as selection criteria for fields with a field type of time. For information on specifying time values, see Section C.3.1, “Specifying Time Values”.

C.1. Selection Criteria Field Types

The fields you specify for selection criteria are of a particular type. The help output for each field display the field type enclosed in brackets. The following help output examples show the output indicating the field types string, string_list, number, percent, and size.
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]
Table C.1, “Selection Criteria Field Types” describes the selection criteria field types
Table C.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. For a listing of defined synonyms for field values, see Table C.14, “Selection Criteria Synonyms”.
Red Hat logoGithubRedditYoutubeTwitter

Lernen

Testen, kaufen und verkaufen

Communitys

Über Red Hat Dokumentation

Wir helfen Red Hat Benutzern, mit unseren Produkten und Diensten innovativ zu sein und ihre Ziele zu erreichen – mit Inhalten, denen sie vertrauen können.

Mehr Inklusion in Open Source

Red Hat hat sich verpflichtet, problematische Sprache in unserem Code, unserer Dokumentation und unseren Web-Eigenschaften zu ersetzen. Weitere Einzelheiten finden Sie in Red Hat Blog.

Über Red Hat

Wir liefern gehärtete Lösungen, die es Unternehmen leichter machen, plattform- und umgebungsübergreifend zu arbeiten, vom zentralen Rechenzentrum bis zum Netzwerkrand.

© 2024 Red Hat, Inc.