此内容没有您所选择的语言版本。
4.9. Customized Reporting for LVM
You can produce concise and customizable reports of LVM objects with the
pvs
, lvs
, and vgs
commands. The reports that these commands generate include one line of output for each object. Each line contains an ordered list of fields of properties related to the object. There are five ways to select the objects to be reported: by physical volume, volume group, logical volume, physical volume segment, and logical volume segment.
The following sections provide:
- A summary of command arguments you can use to control the format of the generated report.
- A list of the fields you can select for each LVM object.
- A summary of command arguments you can use to sort the generated report.
- Instructions for specifying the units of the report output.
4.9.1. Format Control 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
Whether you use the
pvs
, lvs
, or vgs
command determines the default set of fields displayed and the sort order. You can control the output of these commands with the following arguments:
- You can change what fields are displayed to something other than the default by using the
-o
argument. For example, the following output is the default display for thepvs
command (which displays information about physcial volumes).Copy to Clipboard Copied! Toggle word wrap Toggle overflow The following command displays only the physical volume name and size.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - You can append a field to the output with the plus sign (+), which is used in combination with the -o argument.The following example displays the UUID of the physical volume in addition to the default fields.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Adding the
-v
argument to a command includes some extra fields. For example, thepvs -v
command will display theDevSize
andPV UUID
fields in addition to the default fields.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - The
--noheadings
argument suppresses the headings line. This can be useful for writing scripts.The following example uses the--noheadings
argument in combination with thepv_name
argument, which will generate a list of all physical volumes.pvs --noheadings -o pv_name
# pvs --noheadings -o pv_name /dev/sdb1 /dev/sdc1 /dev/sdd1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - The
--separator separator
argument uses separator to separate each field.The following example separates the default output fields of thepvs
command with an equals sign (=).Copy to Clipboard Copied! Toggle word wrap Toggle overflow To keep the fields aligned when using theseparator
argument, use theseparator
argument in conjunction with the--aligned
argument.Copy to Clipboard Copied! Toggle word wrap Toggle overflow
You can use the
-P
argument of the lvs
or vgs
command to display information about a failed volume that would otherwise not appear in the output. For information on the output this argument yields, see Section 6.2, “Displaying Information on Failed Devices”.
For a full listing of display arguments, see the
pvs
(8), vgs
(8) and lvs
(8) man pages.
Volume group fields can be mixed with either physical volume (and physical volume segment) fields or with logical volume (and logical volume segment) fields, but physical volume and logical volume fields cannot be mixed. For example, the following command will display one line of output for each physical volume.