All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steeve McCauley <steeve@terrascale.net>
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 12:01:13 -0400	[thread overview]
Message-ID: <46B35149.6090604@terrascale.net> (raw)
In-Reply-To: <46B34DDC.6020609@redhat.com>


Milan,

Ah, I didn't realise one could use the pv_ column names
with the vgs utility.

That's much better.

Thanks,

steeve

Milan Broz wrote:
> 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
>>
> 
> _______________________________________________
> linux-lvm mailing list
> linux-lvm@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
> 

-- 
Steeve McCauley
Director of Research and Development
Rackable Systems
407 McGill Street, Suite 1002
Montreal, Quebec, H2Y 2G3 (Canada)
Tel: 514-288-3343
http://www.rackable.com
:wq

  reply	other threads:[~2007-08-03 16:01 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
2007-08-03 16:01   ` Steeve McCauley [this message]
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=46B35149.6090604@terrascale.net \
    --to=steeve@terrascale.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.