From: Milan Broz <mbroz@redhat.com>
To: LVM general discussion and development <linux-lvm@redhat.com>
Subject: Re: [linux-lvm] Listing physical volumes in a volume group
Date: Fri, 03 Aug 2007 17:46:36 +0200 [thread overview]
Message-ID: <46B34DDC.6020609@redhat.com> (raw)
In-Reply-To: <46B3395A.5020701@terrascale.net>
Hi,
this will not help for using in script ?
(comma separated list of PVS & PV UUID in VG)
vgs --separator , --noheadings -o pv_name,pv_uuid <vgname>
Milan
--
mbroz@redhat.com
Steeve McCauley wrote:
> 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
>
next prev parent reply other threads:[~2007-08-03 15:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-03 14:19 [linux-lvm] Listing physical volumes in a volume group Steeve McCauley
2007-08-03 15:46 ` Milan Broz [this message]
2007-08-03 16:01 ` Steeve McCauley
2007-08-07 20:24 ` Alasdair G Kergon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46B34DDC.6020609@redhat.com \
--to=mbroz@redhat.com \
--cc=linux-lvm@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).