1831353 Members
3191 Online
110024 Solutions
New Discussion

Re: programming lvm

 
Stefan Koch
Occasional Contributor

programming lvm

how can i get information about the location of a logical volume without using a systemcommand like lvdisplay. i need this for a small programm and i would not scan the output of a systemcommand.

thanks

stefan koch
7 REPLIES 7
MARTINACHE
Respected Contributor

Re: programming lvm

You can search under /dev/vgXX

Hope it helps

Patrice.
Patrice MARTINACHE
Richard Mertz
Regular Advisor

Re: programming lvm

Would you say a little more about why you don't want to use lvdisplay?

Richard
What anybody thinks of me is none of my business.
Steffi Jones_1
Esteemed Contributor

Re: programming lvm

Hi Stefan,

you can try

find /dev -name

that spits out only the line of the file eg.

/dev/vg00/lvol1

Steffi Jones
Stefan Koch
Occasional Contributor

Re: programming lvm

i want to know on which physical volume the known logical volume is located. i don't want to use a skript because i need this information in a c/c++-programm. i solved the same problem on AIX. there i can use systemcalls like "lvm_queryvg" or "lvm_querypv" i hope now you know what i mean

thanks for your help
John Palmer
Honored Contributor

Re: programming lvm

Hi Stefan,

Have you looked at the system call 'pstat_getlv'?

Regards,
John
Stefan Koch
Occasional Contributor

Re: programming lvm

now i have the problem if a logical volume is located on more than one physical volume. the systemcall pstat_getlv helps me very much, but for my problem it helps not enough

thanks john
Frederic Soriano
Honored Contributor

Re: programming lvm

You should have a look at Xvg (see attachment) and at its VgCollect script. Maybe this can help you.

You can always retrieve the latest version under :

ftp://contrib:9unsupp8@hprc.external.hp.com/sysadmin/xvg

Regards.