Operating System - HP-UX
1833059 Members
2534 Online
110049 Solutions
New Discussion

Re: connecting pv to vg and lv(s)

 
Anthony Princing
Occasional Contributor

connecting pv to vg and lv(s)

Is there a way to find out what
volume group and logical volume(s) a physical volume is associated, from an application without fork/exec'ing one of the LVM utilities? Can /etc/lvmtab be accessed directly? A 1995 whitepaper on LVM mentioned a set of LVM ioctl() calls. Are these available? I am working on a multi-threaded application that fails when we use fork/exec.

Thanks,
Tony
6 REPLIES 6
Helen French
Honored Contributor

Re: connecting pv to vg and lv(s)

Hi,

# pvdisplay -v /dev/dsk/cxtydz - will give you the information. Not sure about any system calls which produce these outputs.

HTH,
Shiju
Life is a promise, fulfill it!
Helen French
Honored Contributor

Re: connecting pv to vg and lv(s)

Hi Again,

/etc/lvmtab can be accessed directly. If you want to read the content, use 'strings' command

# strings /etc/lvmtab

HTH,
Shiju
Life is a promise, fulfill it!
Jeff Schussele
Honored Contributor

Re: connecting pv to vg and lv(s)

Hi Anthony,

Well that's certainly an interesting multi-threaded program - can only thread itself, huh?

Well one problem you'll have is that lvmtab is NOT an ascii file. So you'd have to use a read call that handles binaries. Also be advised that it contains only VG & device info - I don't think any LV names are in there.

Good Luck,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Helen French
Honored Contributor

Re: connecting pv to vg and lv(s)

Hi Anthony,

I just saw the 1995 LVM white paper you mentioned. It says about the ioctl() calls, which are used by ststem ( open, read, write, close etc) for LVM management. But I don't think these calls can be used in a user application. And you will be taking a risk by trying these functions. Also /etc/lvmtab cannot be read/write by local on-screen functions and commands. You can only view the content by 'strings' command.

HTH,
Shiju
Life is a promise, fulfill it!
Sanjay_6
Honored Contributor

Re: connecting pv to vg and lv(s)

Hi,

"strings /etc/lvmtab" will allow you to see the contents of the the lvmtab file. "pvdisplay -v /dev/dsk/cxtydz" will tell what is the association of disk cxtydz with VG and lv.

Hope this helps.

Regds

Magdi KAMAL
Respected Contributor

Re: connecting pv to vg and lv(s)

Hi Tony,

#pvdisplay -v /dev/dsk/c#t#d# ?? more

Will display in which Volume Group this Physical Volume ( disk ) is attributed and all defined Logical Volume within it.

#strings /etc/lvmtab

Will display the list of Physical Volumes ( disks ) for each Volume Group.


Magdi