Re: Listing physical volumes in a volume group

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

[Index of Archives]     [Gluster Users]     [Kernel Development]     [Linux Clusters]     [Device Mapper]     [Security]     [Bugtraq]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]

  Powered by Linux