Operating System - HP-UX
1832777 Members
3200 Online
110045 Solutions
New Discussion

Re: Using vgcfgbackup to backup all Volume Groups

 
SOLVED
Go to solution
dictum9
Super Advisor

Using vgcfgbackup to backup all Volume Groups

I understand that vgcfgbackup takes a VG as an argument, but I would like to backup all Volume Groups, is there a script available for it?
14 REPLIES 14
Yang Qin_1
Honored Contributor
Solution

Re: Using vgcfgbackup to backup all Volume Groups

#!/usr/bin/ksh

for myvg in /dev/vg*
do vgcfgbackup $myvg
done

exit


Yang
Sandman!
Honored Contributor

Re: Using vgcfgbackup to backup all Volume Groups

# bdf | awk -F/ '$3~"vg" {print $3}' | uniq | xargs -n1 vgcfgbackup

~cheers
Ivan Krastev
Honored Contributor

Re: Using vgcfgbackup to backup all Volume Groups

If you have VG with different name that vgXX you will miss it.

better use :

#!/usr/bin/ksh
vgdisplay | grep -i "VG Name" > vgs.txt
cat vgs.txt | while read n1 n2 n3
do
vgcfgbackup $n3
done
rm vgs.txt


cheers,
ivan
Sandman!
Honored Contributor

Re: Using vgcfgbackup to backup all Volume Groups

In case your VG name is different than vgXX then use:

# bdf | awk -F/ '$0~"^/dev"{print $3}' | uniq | xargs -n1 vgcfgbackup

~cheers
A. Clay Stephenson
Acclaimed Contributor

Re: Using vgcfgbackup to backup all Volume Groups

One thing that you may not have grasped is that vgcfgbackup does not, in fact, backup a volume group -- or more accurately the data IN a VG but rather, it backs up the VG meta data --- the data ABOUT the VG.
If it ain't broke, I can fix that.
Rory R Hammond
Trusted Contributor

Re: Using vgcfgbackup to backup all Volume Groups

for arg in $(/etc/vgdisplay |grep "VG Name")
do
case $arg in
*dev*) /etc/vgcfgbackup $arg;;
*) continue;;
esac
done
There are a 100 ways to do things and 97 of them are right
dictum9
Super Advisor

Re: Using vgcfgbackup to backup all Volume Groups

I have been using bdf for a while and it's working good.
But how do I take vgcfgbackup of a VG that has not been activated? (Case in point, a BCV volume)
vgcfgbackup returns with an error.



Rick Garland
Honored Contributor

Re: Using vgcfgbackup to backup all Volume Groups

The VG needs to be activated, even if for a short time
dictum9
Super Advisor

Re: Using vgcfgbackup to backup all Volume Groups

How can I find out if a VG is activated or not?

Other than running vgcfgbackup and having it fail.
James R. Ferguson
Acclaimed Contributor

Re: Using vgcfgbackup to backup all Volume Groups

Hi:

> How can I find out if a VG is activated or not?

Given that you know the name of the VG, its *absence* in the output of 'vgdisplay' would indicate that is is *not* activated.

Regards!

...JRF...
dictum9
Super Advisor

Re: Using vgcfgbackup to backup all Volume Groups

I got a list of active VGs and a list of all VG's, I can find out the delta.

ll -d /dev/vg*

gives me the list of all VGs, active and not actived.
Peter Nikitka
Honored Contributor

Re: Using vgcfgbackup to backup all Volume Groups

Hi,

>>
got a list of active VGs and a list of all VG's, I can find out the delta.

ll -d /dev/vg*

gives me the list of all VGs, active and not actived.
<<

... but if a name of a VG is not of the form vg*, this will fail as well.
You could however look for the major number of all device files in /dev ...

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
dictum9
Super Advisor

Re: Using vgcfgbackup to backup all Volume Groups

My main issue right now is figuring out if a node is an active node in a SG cluster so I can active the non-activated VG for taking the vgcfgbackup.

cmviewcl gives too much output.
Deoncia Grayson_1
Honored Contributor

Re: Using vgcfgbackup to backup all Volume Groups

vgdisplay will give you the information you need in regards to if a volume group is active or not.
just issue vgdisplay | more and this will list all active volume groups and will state if a volume group is not activated on that server. it lists all volume groups, even the ones controlled by Serviceguard.
If no one ever took risks, Michelangelo would have painted the Sistine floor. -Neil Simon