Operating System - HP-UX
1833323 Members
2979 Online
110051 Solutions
New Discussion

Copying logical volume information

 
Subbu Krishna
Occasional Advisor

Copying logical volume information

Hello,

I have two systems both of them are N4000s
connected to a storage array. These systems
are in a different location.

System A
========
vg01 <100 Lvs>
vg02 <100 Lvs>

We are trying to migrate data from System A to System B. I need to re-create logical volumes on system B to what I have on system B.

Is there a better way of doing this without having to manually create the logical volumes on System B.

In effect System A will need to be like System B. I will not be able to mirror across WAN.

Thanks.

Subbu
9 REPLIES 9
harry d brown jr
Honored Contributor

Re: Copying logical volume information

Are both systems connected to the same storage array?
Live Free or Die
Sachin Patel
Honored Contributor

Re: Copying logical volume information

Hi Krishna,
I don't think so. How does os will know that that physical disk has valid file sytem until you will create it.
You might know the sequence to create filesystem but I am typing it anyway

#pvcreate /dev/rdsk/c?t?d?
#mkdir /dev/vg??
#mknod /dev/vg??/group c 64 0x0n0000
#chmod 644 /dev/vg??/group
#vgcreate vg?? /dev/dsk/c?t?d?
#lvcreate -l numberofPV -n name /dev/vg?? (and more)
#newfs options (do man newfs for options)

Sachin
Is photography a hobby or another way to spend $
A. Clay Stephenson
Acclaimed Contributor

Re: Copying logical volume information

Hi:

If it were me and I had to recreate 100+ Lvols on another system, I would write a script which
does a strings /etc/lvmtab | grep vg to get each volume group. I would then do a vgdisplay -v for each volume group and use awk or perl to parse for disks and logical volumes.

This does assume that you have the same physical devices. My other approach would be to explore using Ignite.
If it ain't broke, I can fix that.
James R. Ferguson
Acclaimed Contributor

Re: Copying logical volume information

Hi Subbu:

If by "migrate", you mean move the data one-time, I'd do a 'vgexport' from system-A with mapfiles and a 'vgimport' on system-B.

See the man pages for 'vgexport' and 'vgimport'.

Regards!

...JRF...
linuxfan
Honored Contributor

Re: Copying logical volume information

Hi Subbu,

Looking at what you have said so far, machines are in different locations and not sharing the disk devices, the only option is to create new LVs on the new machine and then copy the data.

As far as creating the new LVs is concerned, you are better of writing a small script to get the configuration of the LVs from node 1 and then creating them on the new node.

-Regards
Ramesh
They think they know but don't. At least I know I don't know - Socrates
Santosh Nair_1
Honored Contributor

Re: Copying logical volume information

Unfortunately, unless the two systems share the same array or unless you're planning on moving the array from systemA to systemB, you have little choice but to re-create the LVs on systemB. Probably your best bet would be write a script as Clay suggested...I have something I started on some time ago...may be useful(?). I can't verify its correctness as I haven't played around with this script in a long time.

-Santosh
Life is what's happening while you're busy making other plans
Sridhar Bhaskarla
Honored Contributor

Re: Copying logical volume information

Subbu,

YOu need to write scripts to do this for you.
An example is to do something like this.

on system A, write a script to generate a map file something like this

lvol1:30
lvol2:200
lvol3:1000

You can write a script say 'vgshow vg_name' as below

for LV in `vgdisplay $1|grep "LV Name" |awk '{print $3}'`
do
SZ=`lvdisplay $LV |grep "LV Size" |awk '{print $4}'`
LVNAME=$LV
echo $LVNAME:$SZ >> $1.map
done

Now take this map onto system B and then write another script to create lvols for you.

for i in `cat vg01.map`
do
LV=`echo $i |awk '{FS=":";print $1}'|sed 's/\/dev\/vg01\///' `
SZ=`echo $i |awk '{FS=":";print $2}'`
lvcreate -n $LV -L $SZ vg01

YOu can do this for other volume groups. This script may not work straight. But you can use this logic.

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

Re: Copying logical volume information

As the others have mentioned, a script approach with normal LVM commands is probably best.

Only if the LVM configuration of System B will be exactly the *same*, i.e. not just similar, as that of System A, then you could use vgcfgbackup and vgcfgrestore (and vgexport (-m -p) and vgimport).

Scott Van Kalken
Esteemed Contributor

Re: Copying logical volume information

Couple of ideas spring to mind.

Ignite could do this for you. Just re-ignite the system.

The other option that immeditately springs to mind is to do a vgcfgbackup for vg01 and vg02 - then do a vgcfgrestore for vg01 and vg02:

#vgcfgbackup vg01
#vgcfgbackup vg02

then restore to other system using
#vgcfgbackup -f

if you want data as well, do this and then run restore/vxrestore as needed.

I'd do it via ignite though because it's automagical.

I'm guessing this is for a DR site?