Operating System - HP-UX
1833619 Members
3425 Online
110062 Solutions
New Discussion

/etc/lvmtab vs. vgdisplay

 
SOLVED
Go to solution
andi_1
Frequent Advisor

/etc/lvmtab vs. vgdisplay

Hi guys,

Does anyone know how reliable /etc/lvmtab file is? I couldn't find man page for that file. Sometimes, it is necessary for me to know whether a specific vg exists on the system. Currently, I use the following logic:
strings /etc/lvtmab |grep vgname

Maybe, it is better to use vgdisplay vgname and check for the return code?

Thank you!
14 REPLIES 14
PIYUSH D. PATEL
Honored Contributor
Solution

Re: /etc/lvmtab vs. vgdisplay

Hi,

It is a very important file and you should always keep a backup of this file. Whenever you create or remove a volume group and add a disk to the VG then this file gets updated. Always do a vgcfgbackup of the volume group which you modify. By default vgcfgbackup is always done when you make some changes to a volume group.

You can always list the contents of /dev

ll /dev/vg* and that will give you the volumegroup that are set in your system. Then you can use the vgdisplay command to display the configuration of the volumegroup.

piyush
harry d brown jr
Honored Contributor

Re: /etc/lvmtab vs. vgdisplay

LZ,

do a man on "vgscan". You can change the name and then run a vgscan and it will rebuild it:

cd /etc
mv lvmtab orig_lvmtab
vgscan

live free or die
harry
Live Free or Die
Christopher McCray_1
Honored Contributor

Re: /etc/lvmtab vs. vgdisplay

Hello,

The lvmtab is reliable in most cases, but it is possible to have an entry for a vg that is not activated. I would just do the following

# for i in /dev/vg*
> do
> vgdisplay (-v) $i
> done

Hope this helps

Chris
It wasn't me!!!!

Re: /etc/lvmtab vs. vgdisplay

vgdisplay gets its infor from lvmtab anyway. vgdisplay is going to give you information about volume groups *only if they are active*. It will still tell you about the existence of all VGs though - try:

vgdisplay -v | grep "VG Name" | sort | uniq

On a correctly running system you can rely on the information in lvmtab... however if I were to disconnect a bunch of disks that make up a VG, then they would still be in lvmtab (and vgdisplay would still report them)

HTH

Duncan

I am an HPE Employee
Accept or Kudo
Helen French
Honored Contributor

Re: /etc/lvmtab vs. vgdisplay

You can either do a vgdisplay or strings /etc/lvmtab. The only difference will be if the VG is not activated. All configured VG information will be available from the lvmtab file. There is no specific man page for this file, but a possible match will be this:

# man vgscan

Life is a promise, fulfill it!
PIYUSH D. PATEL
Honored Contributor

Re: /etc/lvmtab vs. vgdisplay

Hi,

You can also check the /etc/fstab to find out or bdf to find out whether the volumegroup is in use or not. Then you can use the vgdisplay to check which disks are included in the volumegroup.

Piyush
S.K. Chan
Honored Contributor

Re: /etc/lvmtab vs. vgdisplay

I usually use "vgdisplay" for this purpose. Too many cases of lvmtab file getting corrupted.
my $0.02
Sridhar Bhaskarla
Honored Contributor

Re: /etc/lvmtab vs. vgdisplay

You can use strings /etc/lvmtab to get the VG information. As mentioned by others, on a failover node in a mc/service guard cluster, you wont' get information about the serviceguarded vgs from vgdisplay command. If you have an empty directory in /dev and if you have serviceguard setup, then it is difficult to differentiate the inactive vs empty cases.

So, I would say 'strings /etc/lvmtab |grep vg' is a better way. This is the reason we want to append vg to every volume group name. 'strings lvmtab' may display junk characters sometimes but I have not seen them clobbering the volume group and disk entries.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try

Re: /etc/lvmtab vs. vgdisplay

The danger with anything like:

ll /dev/vg*

Is that volume groups *don't* have to be in directories called /dev/vg If you wanted to create a volume group called 'elephant' then:

mkdir /dev/elephant
mknod /dev/elephant/group c 64 0x090000
vgcreate /dev/elephant /dev/dsk/c1t1d0

Would work.

Stick to vgdisplay and lvmtab

HTH

Duncan

I am an HPE Employee
Accept or Kudo
MANOJ SRIVASTAVA
Honored Contributor

Re: /etc/lvmtab vs. vgdisplay

Hi Lz


/etc/lvmtab is the file which the systems looks at the time of starting to mount acticvate the volume groups and mount them ,this file is created when you doa vgscan too , and is genrally modified whever any vg operations are done.

vgdisplay uses lvmtab to display the inforamtion of volume group , lvmtabb is just used for this and when the vg's are mounted or activated this fiel is not used.

man vgscan

Manoj Srivastava
Jon Finley
Honored Contributor

Re: /etc/lvmtab vs. vgdisplay

I use "strings" on /etc/lvmtab, and

vgdisplay -v | grep /dev

to get additional VG info.


Jon
"Do or do not. There is no try!" - Yoda
Wayne Yu_1
Frequent Advisor

Re: /etc/lvmtab vs. vgdisplay

VG information is stored on the begining of each hard disk. If you lost the lvmtab file (server crash), you can most time reconstrust lvmtab by running vgscan. However, if something went wrong with the disk, it is better not remove the lvmtab file. string on the lvmtab file will list the contents of VGs. Compare /dev/vg?? contents also help determine which one is telling the accurate information.
Martin Johnson
Honored Contributor

Re: /etc/lvmtab vs. vgdisplay

I use "vgdisplay". I believe vgdisplay uses /etc/lvmtab to determine what vgs to display.


Marty
Nick Wickens
Respected Contributor

Re: /etc/lvmtab vs. vgdisplay

I know its not foolproof but I usually just use the command "ll /dev/*/group" to get a quick list of all Volume groups on the system (handy also for getting the minor numbers right).
Hats ? We don't need no stinkin' hats !!