Operating System - HP-UX
1752790 Members
6399 Online
108789 Solutions
New Discussion юеВ

Re: Script for transferring LVM Configuration to different server in DR

 
SOLVED
Go to solution
Mike McAlpine
New Member

Script for transferring LVM Configuration to different server in DR

I'm looking for a script that would automate the process of rebuilding the LVM confirguration of one system over to a new system. Example would be for DR, I will have my make_sys_image output, will reload the OS on new hardware at DR site and need to configure the new system's LVM layout to resemble the old. A script to export, import, or both would be helpful. Thanks in advance.
5 REPLIES 5
Sundar_7
Honored Contributor
Solution

Re: Script for transferring LVM Configuration to different server in DR

In the source system

vgdisplay 2>/dev/null | grep "VG Name" | awk '{print $3}' | xargs -n1 | while read VGDIR
do
VG=$(echo "$VGDIR" | sed 's/\/dev\//')
vgexport -p -s -m /root/MAPS/$VG.map $VGDIR
echo "$VG\t$(ls -lrt $VGDIR/group | awk '{print $6}')" >> /root/MAPS/grouplist
done

/root/MAPS directory from the source system should be made available in the DR system.

In the DR system

cat /root/MAPS/grouplist | while read VG MINOR
do
mkdir /dev/$VG
mknod /dev/$VG/group c 64 $MINOR
done

for MAP in $(ls /root/MAPS/*.map)
do
VG=$(echo "$MAP" | sed 's/\.map//')
vgimport -v -s -m $MAP $VG
done

The above script assumes all the volume groups are active in the source system.

and it is just an off-the-fly script, so needs some testing before implementation :-).

Learn What to do ,How to do and more importantly When to do ?
Patrick Wallek
Honored Contributor

Re: Script for transferring LVM Configuration to different server in DR

A vgexport and vgimport will do you absolutely no good at a DR site. The export/import assumes that you already have disks set up in a VG. That will not be the case at a DR site.

The best bet for you will be to write your own script that will pvcreate the appropriate disks, create the VGs, create the LVs, newfs the LVs, etc.

You would also have to make sure that you had an input file with the appropriate disk devices listed for the pvcreate and vgcreate commands. You would need to know the size of the disks as well so that you can use the appropriate number of disks to create the VG the size that you need.

There really is no cut-and-dried method for doing this. No script out there will know everything that you need to really automate this, unless you customize it yourself.

I honestly prefer doing a lot of these steps manually, or just have a bare bones script that you can modify once you know disk names and sizes.
Sundar_7
Honored Contributor

Re: Script for transferring LVM Configuration to different server in DR

I presumed there is some kind of remote mirroring available in the DR site that replicates the data from the primary site ?
Learn What to do ,How to do and more importantly When to do ?
Michael Tully
Honored Contributor

Re: Script for transferring LVM Configuration to different server in DR

Your are better off making sure that the procedures you have written actually work.

To simply this, the hardware should be at least compatible with what you have and you should also make sure that your current backup methodology will work at the DR site, disk array of a similar type type, switches if needed and compatible tape drive hardware. As stated by Patrick you can't used vgimport/vgexport unless you plan on shipping the same disk array or use some sort of SRDF (remote data facility)
Anyone for a Mutiny ?
Prashant Zanwar_4
Respected Contributor

Re: Script for transferring LVM Configuration to different server in DR

Hi,
I will prefer what Sunder has suggested as it saves your pains of looking into all VG's and their configuration and that can be automated too..Whenever you do changes on local site servers, run this script so that changes are reflected on secondary.
Thanks
Prashant\
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."