Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Red Hat Enterprise Linux 9 Essentials Book now available.

Purchase a copy of Red Hat Enterprise Linux 9 (RHEL 9) Essentials

Red Hat Enterprise Linux 9 Essentials Print and eBook (PDF) editions contain 34 chapters and 298 pages

Preview Book

4.8.2. Object Selection

This section provides a series of tables that list the information you can display about the LVM objects with the pvs, vgs, and lvs commands.
For convenience, a field name prefix can be dropped if it matches the default for the command. For example, with the pvs command, name means pv_name, but with the vgs command, name is interpreted as vg_name.
Executing the following command is the equivalent of executing pvs -o pv_free.
# pvs -o +free
  PFree
  17.14G
  17.09G
  17.14G

The pvs Command

Table 4.1, “pvs Display Fields” lists the display arguments of the pvs command, along with the field name as it appears in the header display and a description of the field.
Table 4.1. pvs Display Fields
Argument Header Description
dev_size DevSize The size of the underlying device on which the physical volume was created
pe_start 1st PE Offset to the start of the first physical extent in the underlying device
pv_attr Attr Status of the physical volume: (a)llocatable or e(x)ported.
pv_fmt Fmt The metadata format of the physical volume (lvm2 or lvm1)
pv_free PFree The free space remaining on the physical volume
pv_name PV The physical volume name
pv_pe_alloc_count Alloc Number of used physical extents
pv_pe_count PE Number of physical extents
pvseg_size SSize The segment size of the physical volume
pvseg_start Start The starting physical extent of the physical volume segment
pv_size PSize The size of the physical volume
pv_tags PV Tags LVM tags attached to the physical volume
pv_used Used The amount of space currently used on the physical volume
pv_uuid PV UUID The UUID of the physical volume

The pvs command displays the following fields by default: pv_name, vg_name, pv_fmt, pv_attr, pv_size, pv_free. The display is sorted by pv_name.
# pvs
  PV         VG     Fmt  Attr PSize  PFree
  /dev/sdb1  new_vg lvm2 a-   17.14G 17.14G
  /dev/sdc1  new_vg lvm2 a-   17.14G 17.09G
  /dev/sdd1  new_vg lvm2 a-   17.14G 17.13G
Using the -v argument with the pvs command adds the following fields to the default display: dev_size, pv_uuid.
# pvs -v
    Scanning for physical volume names
  PV         VG     Fmt  Attr PSize  PFree  DevSize PV UUID
  /dev/sdb1  new_vg lvm2 a-   17.14G 17.14G  17.14G onFF2w-1fLC-ughJ-D9eB-M7iv-6XqA-dqGeXY
  /dev/sdc1  new_vg lvm2 a-   17.14G 17.09G  17.14G Joqlch-yWSj-kuEn-IdwM-01S9-XO8M-mcpsVe
  /dev/sdd1  new_vg lvm2 a-   17.14G 17.13G  17.14G yvfvZK-Cf31-j75k-dECm-0RZ3-0dGW-tUqkCS
You can use the --segments argument of the pvs command to display information about each physical volume segment. A segment is a group of extents. A segment view can be useful if you want to see whether your logical volume is fragmented.
The pvs --segments command displays the following fields by default: pv_name, vg_name, pv_fmt, pv_attr, pv_size, pv_free, pvseg_start, pvseg_size. The display is sorted by pv_name and pvseg_size within the physical volume.
# pvs --segments
  PV         VG         Fmt  Attr PSize  PFree  Start SSize
  /dev/hda2  VolGroup00 lvm2 a-   37.16G 32.00M     0  1172
  /dev/hda2  VolGroup00 lvm2 a-   37.16G 32.00M  1172    16
  /dev/hda2  VolGroup00 lvm2 a-   37.16G 32.00M  1188     1
  /dev/sda1  vg         lvm2 a-   17.14G 16.75G     0    26
  /dev/sda1  vg         lvm2 a-   17.14G 16.75G    26    24
  /dev/sda1  vg         lvm2 a-   17.14G 16.75G    50    26
  /dev/sda1  vg         lvm2 a-   17.14G 16.75G    76    24
  /dev/sda1  vg         lvm2 a-   17.14G 16.75G   100    26
  /dev/sda1  vg         lvm2 a-   17.14G 16.75G   126    24
  /dev/sda1  vg         lvm2 a-   17.14G 16.75G   150    22
  /dev/sda1  vg         lvm2 a-   17.14G 16.75G   172  4217
  /dev/sdb1  vg         lvm2 a-   17.14G 17.14G     0  4389
  /dev/sdc1  vg         lvm2 a-   17.14G 17.14G     0  4389
  /dev/sdd1  vg         lvm2 a-   17.14G 17.14G     0  4389
  /dev/sde1  vg         lvm2 a-   17.14G 17.14G     0  4389
  /dev/sdf1  vg         lvm2 a-   17.14G 17.14G     0  4389
  /dev/sdg1  vg         lvm2 a-   17.14G 17.14G     0  4389
You can use the pvs -a command to see devices detected by LVM that have not been initialized as LVM physical volumes.
# pvs -a
  PV                             VG     Fmt  Attr PSize  PFree
  /dev/VolGroup00/LogVol01                   --       0      0
  /dev/new_vg/lvol0                          --       0      0
  /dev/ram                                   --       0      0
  /dev/ram0                                  --       0      0
  /dev/ram2                                  --       0      0
  /dev/ram3                                  --       0      0
  /dev/ram4                                  --       0      0
  /dev/ram5                                  --       0      0
  /dev/ram6                                  --       0      0
  /dev/root                                  --       0      0
  /dev/sda                                   --       0      0
  /dev/sdb                                   --       0      0
  /dev/sdb1                      new_vg lvm2 a-   17.14G 17.14G
  /dev/sdc                                   --       0      0
  /dev/sdc1                      new_vg lvm2 a-   17.14G 17.09G
  /dev/sdd                                   --       0      0
  /dev/sdd1                      new_vg lvm2 a-   17.14G 17.14G

The vgs Command

Table 4.2, “vgs Display Fields” lists the display arguments of the vgs command, along with the field name as it appears in the header display and a description of the field.
Table 4.2. vgs Display Fields
Argument Header Description
lv_count #LV The number of logical volumes the volume group contains
max_lv MaxLV The maximum number of logical volumes allowed in the volume group (0 if unlimited)
max_pv MaxPV The maximum number of physical volumes allowed in the volume group (0 if unlimited)
pv_count #PV The number of physical volumes that define the volume group
snap_count #SN The number of snapshots the volume group contains
vg_attr Attr Status of the volume group: (w)riteable, (r)eadonly, resi(z)eable, e(x)ported, (p)artial and (c)lustered.
vg_extent_count #Ext The number of physical extents in the volume group
vg_extent_size Ext The size of the physical extents in the volume group
vg_fmt Fmt The metadata format of the volume group (lvm2 or lvm1)
vg_free VFree Size of the free space remaining in the volume group
vg_free_count Free Number of free physical extents in the volume group
vg_name VG The volume group name
vg_seqno Seq Number representing the revision of the volume group
vg_size VSize The size of the volume group
vg_sysid SYS ID LVM1 System ID
vg_tags VG Tags LVM tags attached to the volume group
vg_uuid VG UUID The UUID of the volume group

The vgs command displays the following fields by default: vg_name, pv_count, lv_count, snap_count, vg_attr, vg_size, vg_free. The display is sorted by vg_name.
# vgs
  VG     #PV #LV #SN Attr   VSize  VFree
  new_vg   3   1   1 wz--n- 51.42G 51.36G
Using the -v argument with the vgs command adds the following fields to the default display: vg_extent_size, vg_uuid.
# vgs -v
    Finding all volume groups
    Finding volume group "new_vg"
  VG     Attr   Ext   #PV #LV #SN VSize  VFree  VG UUID
  new_vg wz--n- 4.00M   3   1   1 51.42G 51.36G jxQJ0a-ZKk0-OpMO-0118-nlwO-wwqd-fD5D32

The lvs Command

Table 4.3, “lvs Display Fields” lists the display arguments of the lvs command, along with the field name as it appears in the header display and a description of the field.
Table 4.3. lvs Display Fields
Argument Header Description
chunksize
chunk_size
Chunk Unit size in a snapshot volume
copy_percent Copy% The synchronization percentage of a mirrored logical volume; also used when physical extents are being moved with the pv_move command
devices Devices The underlying devices that make up the logical volume: the physical volumes, logical volumes, and start physical extents and logical extents
lv_attr Attr The status of the logical volume. The logical volume attribute bits are as follows:
Bit 1: Volume type: (m)irrored, (M)irrored without initial sync, (o)rigin, (p)vmove, (s)napshot, invalid (S)napshot, (v)irtual
Bit 2: Permissions: (w)riteable, (r)ead-only
Bit 3: Allocation policy: (c)ontiguous, (n)ormal, (a)nywhere, (i)nherited. This is capitalized if the volume is currently locked against allocation changes, for example while executing the pvmove command.
Bit 4: fixed (m)inor
Bit 5: State: (a)ctive, (s)uspended, (I)nvalid snapshot, invalid (S)uspended snapshot, mapped (d)evice present without tables, mapped device present with (i)nactive table
Bit 6: device (o)pen
lv_kernel_major KMaj Actual major device number of the logical volume (-1 if inactive)
lv_kernel_minor KMIN Actual minor device number of the logical volume (-1 if inactive)
lv_major Maj The persistent major device number of the logical volume (-1 if not specified)
lv_minor Min The persistent minor device number of the logical volume (-1 if not specified)
lv_name LV The name of the logical volume
lv_size LSize The size of the logical volume
lv_tags LV Tags LVM tags attached to the logical volume
lv_uuid LV UUID The UUID of the logical volume.
mirror_log Log Device on which the mirror log resides
modules Modules Corresponding kernel device-mapper target necessary to use this logical volume
move_pv Move Source physical volume of a temporary logical volume created with the pvmove command
origin Origin The origin device of a snapshot volume
regionsize
region_size
Region The unit size of a mirrored logical volume
seg_count #Seg The number of segments in the logical volume
seg_size SSize The size of the segments in the logical volume
seg_start Start Offset of the segment in the logical volume
seg_tags Seg Tags LVM tags attached to the segments of the logical volume
segtype Type The segment type of a logical volume (for example: mirror, striped, linear)
snap_percent Snap% Current percentage of a snapshot volume that is in use
stripes #Str Number of stripes or mirrors in a logical volume
stripesize
stripe_size
Stripe Unit size of the stripe in a striped logical volume

The lvs command displays the following fields by default: lv_name, vg_name, lv_attr, lv_size, origin, snap_percent, move_pv, mirror_log, copy_percent. The default display is sorted by vg_name and lv_name within the volume group.
# lvs
  LV         VG     Attr   LSize  Origin Snap%  Move Log Copy%
  lvol0      new_vg owi-a- 52.00M
  newvgsnap1 new_vg swi-a-  8.00M lvol0    0.20
Using the -v argument with the lvs command adds the following fields to the default display: seg_count, lv_major, lv_minor, lv_kernel_major, lv_kernel_minor, lv_uuid.
# lvs -v
    Finding all logical volumes
  LV         VG     #Seg Attr   LSize  Maj Min KMaj KMin Origin Snap%  Move Copy%  Log LV UUID
  lvol0      new_vg    1 owi-a- 52.00M  -1  -1 253  3                                  LBy1Tz-sr23-OjsI-LT03-nHLC-y8XW-EhCl78
  newvgsnap1 new_vg    1 swi-a-  8.00M  -1  -1 253  5    lvol0    0.20                 1ye1OU-1cIu-o79k-20h2-ZGF0-qCJm-CfbsIx
You can use the --segments argument of the lvs command to display information with default columns that emphasize the segment information. When you use the segments argument, the seg prefix is optional. The lvs --segments command displays the following fields by default: lv_name, vg_name, lv_attr, stripes, segtype, seg_size. The default display is sorted by vg_name, lv_name within the volume group, and seg_start within the logical volume. If the logical volumes were fragmented, the output from this command would show that.
# lvs --segments
  LV       VG         Attr   #Str Type   SSize
  LogVol00 VolGroup00 -wi-ao    1 linear  36.62G
  LogVol01 VolGroup00 -wi-ao    1 linear 512.00M
  lv       vg         -wi-a-    1 linear 104.00M
  lv       vg         -wi-a-    1 linear 104.00M
  lv       vg         -wi-a-    1 linear 104.00M
  lv       vg         -wi-a-    1 linear  88.00M
Using the -v argument with the lvs --segments command adds the following fields to the default display: seg_start, stripesize, chunksize.
# lvs -v --segments
    Finding all logical volumes
  LV         VG     Attr   Start SSize  #Str Type   Stripe Chunk
  lvol0      new_vg owi-a-    0  52.00M    1 linear     0     0
  newvgsnap1 new_vg swi-a-    0   8.00M    1 linear     0  8.00K
The following example shows the default output of the lvs command on a system with one logical volume configured, followed by the default output of the lvs command with the segments argument specified.
# lvs
  LV    VG     Attr   LSize  Origin Snap%  Move Log Copy%
  lvol0 new_vg -wi-a- 52.00M
# lvs --segments
  LV    VG     Attr   #Str Type   SSize
  lvol0 new_vg -wi-a-    1 linear 52.00M

 
 
  Published under the terms of the Creative Commons License Design by Interspire