List all physical volumes associated to a volume group

5

3

Maybe I'm missing something obvious but I do not see it listed in vgdisplay.

Belmin Fernandez

Posted 2010-11-09T18:55:24.587

Reputation: 2 691

Answers

5

You can try this format:

# pvdisplay -C --separator '  |  ' -o pv_name,vg_name

You get something like what I think you're looking for:

  PV  |  VG
  /dev/sda2  |  vg_c6srv3
  /dev/sdb2  |  vg_c6srv3
  /dev/sdc2  |  vg_c6srv3
  /dev/sdd1  |  vg_ora112
  /dev/sdd2  |  
  /dev/sdd3  |  vg_ora112
  /dev/sdd5  |  vg_ora101
  /dev/sde1  |  vg_ora112
  /dev/sde2  |  vg_ora112
  /dev/sde3  |  
  /dev/sde4  |  vg_ora101
  /dev/sdf1  |  vg_ora112
  /dev/sdf2  |  
  /dev/sdf3  |  vg_ora112
  /dev/sdf5  |  vg_ora101

Hope that helps.

user251320

Posted 2010-11-09T18:55:24.587

Reputation: 66

6

pvdisplay shows the VG each PV belongs to.

Ignacio Vazquez-Abrams

Posted 2010-11-09T18:55:24.587

Reputation: 100 516

I've been doing pvs | grep volume_group but I thought I might be missing something better suited for this. – Belmin Fernandez – 2010-11-09T19:07:25.807

2And so does pvs, if one wants a more concise form. – Gabriel – 2014-01-07T18:43:50.887

0

to answer the question, it is just as simple as:

pvdisplay -S vgname=YOUR_VOLUME_GROUP_NAME

but if you want a simple overview of all physical volumes with its related volume groups:

pvdisplay -C -o pv_name,vg_name or even simpler just pvs

or that overview filtered on a specific volume group:

pvdisplay -C -o pv_name,vg_name -S vgname=YOUR_VOLUME_GROUP_NAME

where:

-C|--columns
              Display output in columns, the equivalent of vgs(8).  Options listed are the same as options given in vgs(8).
-o|--options String
              Comma-separated, ordered list of fields to display in columns.
-S|--select String
              Select objects for processing and reporting based on specified criteria.

Example output:

# pvdisplay -C -o pv_name,vg_name -S vgname=vg_home
  PV         VG
  /dev/sdb   vg_home

vchrizz

Posted 2010-11-09T18:55:24.587

Reputation: 11

0

vgdisplay -v <volume_group_name> 2> /dev/null | awk '/PV Name/ {print $3}'

Craig

Posted 2010-11-09T18:55:24.587

Reputation: 1

2Can you elaborate? Just pasting a commandline input isn't always easy to understand. – K.A.Monica – 2014-01-07T04:46:35.387