linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] Listing physical volumes in a volume group
@ 2007-08-03 14:19 Steeve McCauley
  2007-08-03 15:46 ` Milan Broz
  0 siblings, 1 reply; 4+ messages in thread
From: Steeve McCauley @ 2007-08-03 14:19 UTC (permalink / raw)
  To: linux-lvm


I would like to know if there is a canonical way to list the
physical volumes in a volume group, specifically to extract
the uuid for those PVs in a bash script.  I am able to do
something along the lines of,

PVS=$(vgdisplay -vv 2>&1 | grep "PV UUID" | awk '{print $3}')
PVUUID=$(pvs -o pv_uuid --noheadings /dev/sdx | awk '{print $1}')

and then look for PVUUID in the list of PVS.

for uuid in $PVS; do
   [ "$uuid" != "$PVUUID" ] && continue
   ...
done

but this relies on the output format of 'vgdisplay -vv' and
I want to be sure that I will always get the expected result.

Thanks,

steeve

-- 
Steeve McCauley
:wq

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-08-07 20:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-03 14:19 [linux-lvm] Listing physical volumes in a volume group Steeve McCauley
2007-08-03 15:46 ` Milan Broz
2007-08-03 16:01   ` Steeve McCauley
2007-08-07 20:24     ` Alasdair G Kergon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).