Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script/program to rebuild LV/filesystems

Status
Not open for further replies.

garfield99us2000

Technical User
Jun 23, 2003
4
FI
Hi,

does anybody know a program or script, which is able to rebuild a LV/filesystem structure? It should be cabable to rebuild VGs, LVs and filesystems on the same disks from a certain configuration. I want to use it to rebuild the filesystem structure after a complete system-crash on the same machine.

Thank you for all hints and tips!
 
You should user "importvg" command.

example:
importvg -V 100 -y VGname hdiskX

or just:

importvg -y hdiskX


where hdiskX is one of the logical disks having this VG
 
of cource second example should be:


importvg -y VGname hdiskX
 
What do you mean for complete "system crash"?
Do you mean a system halt or the situation normally called "disaster" (for which are designed "disaster recovery" solutions)?
As ogniemi wisely said, you should only import VG data in case of rootvg distruction and you have to rebuild the vg from a savevg tape in case of other VGs distruction.

 
I built such a series of scripts for my own use a few years ago, although they generally require particular data be collected beforehand.
 
you will have to do the part where you make the vgs yourself, but i have a couple of scripts which would help you. for disaster recovery, you really should look at something more robust.

i use these to duplicate filesystem layouts. i use the fsgen script to gather the data into command files, then use the mklvfs script to do the creation. note mklvfs can be used to make a fs in one step, as long as you like the parameters it uses.


IBM Certified -- AIX 4.3 Obfuscation
 
Hi ,

You can use the savevg command to get your volumegroup ( lV, filesystems ) back on a system that has crashed, using the restvg command

1. Firstly you run savevg command , and you have to create exclude files for each volume group
e.g /etc/exclude.volumegroup1
/filesys1/
/filesys2

/etc/exclude.volumegroup2
/vg2filesys/

etc..

lsvg -o | grep -v rootvg | while read VG
do
# This file needs to contain a list of all filesystems (LV mt points)
# within the VG otherwise it will try and backup everything

rm -f /etc/exclude.${VG}
lsvg -l ${VG} | grep -v -e "LV NAME" -e "jfslog" -e "${VG}:" | awk '{print
$7}' | while read MTPT
do
echo "${MTPT}/" >> /etc/exclude.${VG}
done
if /usr/bin/savevg -iev -f${SAVEDIR}/${VG}.savevg ${VG}
then print "savevg of ${VG} successful"
else fail "An error occurred with savevg of ${VG}"
fi

done
}


The directory where your savevg files are logged are backed up onto tape.
So in case of disaster , you restore these files , and then
run the restvg command specifiying the disk and the savevg file. This will then create your volume group structure on the disk as long as there is enough space.


HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top