Operating System - HP-UX
1825780 Members
3093 Online
109687 Solutions
New Discussion

How to clone LVM settings /configurations to a brand new disk?

 
SOLVED
Go to solution
Tuan Nguyen_2
Frequent Advisor

How to clone LVM settings /configurations to a brand new disk?

We are going to move our data (boot are on internal disks) from eva5000 active-passive to eva8000 active-active, for that case I need to transfer all the LVM confs on the data disk to a new environments.

So how to ”record” the old settings (with all lvols include) and then ”play” it back on the new disk?

I'd try with vgcfgbackup/vgcfgrestore but no success… many tries and many errors, just like:

vgcfgrestore: Volume group "/dev/vg22" does not exist in the "/etc/lvmtab" file.
(vgcfgrestore -f /vg22-test /dev/rdsk/c3t2d0) ; vg22-test is from ” vgcfgbackup -f vg22-test vg22”

vgchange: Warning: Couldn't attach to the volume group physical volume "/dev/dsk/c3t2d0": Cross-device link
(vgchange -a y /dev/vg22)

vgexport,vgimport,vgscan can not do it. Do you have an idea or a procedure how I can do it?

Many thanks
Tuan
10 REPLIES 10
James R. Ferguson
Acclaimed Contributor

Re: How to clone LVM settings /configurations to a brand new disk?

Hi Tuan:

You could try to 'vgcreate' a new volume group on the new SAN and *then* overlay it with a 'vgcfgrestore' using the appropriate file from a 'vgcfgbackup' of the *old* volume group. You may have to 'vgextend' additional volumes into the new volume group at the onset too. In this fashion, the 'etc/lvmtab' will have entitites when the 'vgcfgrestore' is done.

Regards!

...JRF...
Mustafa Gulercan
Respected Contributor

Re: How to clone LVM settings /configurations to a brand new disk?

hi;
1- configure eva8000;
create virtual disk,disk group,present vdisks to the host with LUN id.(be carefull that your new vdisks size is equal or larger than old ones.)

2-do pvcreate at new server
3-at old server;
take a vg map with vgcreate with -p option. like;
#vgcreate -s -v -p -m /dev/vgabc /tmp/vgabc.map

4-before importing do following;
#cd /dev
#mkdir vgabc
#mknod /dev/vgabc/group c 64 0x010000

0x010000 is just an example.
you can see minor numbers with

#ll /dev/vg*/group
command.

you should choose an unused minor number.But if it is possible use old server's volume group's minor numbers.
5-And then import your vgmaps to the new server with vgexport command.
it will create lvols'

regards,
mustafa
Tuan Nguyen_2
Frequent Advisor

Re: How to clone LVM settings /configurations to a brand new disk?

hi James,

That was what I thought in the beginning (pvcreate, mknod, vgcreate). Yes the vgcfgrestore went perfectly through, but when I did a vgchange I got "Cross-device link"

Thanks,
Tuan
Tuan Nguyen_2
Frequent Advisor

Re: How to clone LVM settings /configurations to a brand new disk?

Hi Mustafa,

Many thanks, it was the one I tried yesterday. Now I did it again to give you the
reason.

To simulate/test it I use the one and only disk c3t2d0 on the same server.

*old conf: vg22 with lvol221 & lvol222. vg22 is only a volume I create for this test.

##I export as you suggest (yes I can save many "remove" steps by not using -p in vgexport)
vgchange -a n /dev/vg22
vgexport -v -p -m /dev/vg22 /tmp/vg22.map
vgchange -a y /dev/vg22
lvremove /dev/vg22/lvol221
lvremove /dev/vg22/lvol222
vgremove /dev/vg22
pvremove /dev/rdsk/c3t2d0

##to simulate a new disk, override all LVM data (if there is any)
newfs -F vxfs -o largefiles /dev/rdsk/c3t2d0

##now I import back to the "new disk"
mars1_root # vgimport -v -m /tmp/vg22.map /dev/vg22 /dev/dsk/c3t2d0
Beginning the import process on Volume Group "/dev/vg22".
Physical Volume "/dev/dsk/c3t2d0" contains no LVM information

##what about a pvcreat...maybe it helps...
pvcreate -f /dev/rdsk/c3t2d0
mars1_root # vgimport -v -m /tmp/vg22.map /dev/vg22 /dev/dsk/c3t2d0
Beginning the import process on Volume Group "/dev/vg22".
Physical Volume "/dev/dsk/c3t2d0" is not part of a Volume Group

##what about a vgcreat... at this point already too many works...
mars1_root # vgimport -v -m /tmp/vg22.map /dev/vg22 /dev/dsk/c3t2d0
Beginning the import process on Volume Group "/dev/vg22".
vgimport: Volume group "/dev/vg22" already exists in the "/etc/lvmtab" file.

...still not help

I think vgexport/vgimport is only for when transfering a LVM disk from one system to another,

meaning all the PVRA, VGRA must be "intact" on that disk device. In this case we are talking
about a brand new disk.

So is it possible to playback the LVM settinngs on a BRAND NEW disk?

Thanks
Tuan
Patrick Wallek
Honored Contributor
Solution

Re: How to clone LVM settings /configurations to a brand new disk?

There is no way that I know of to take LVM settings (PE SIZE, max pe per pv, LVs and sizes, etc) and "play them back" on a new server with new disks.

The manual way is the only way I know of (vgcreate, lvcreate, newfs).

Tuan Nguyen_2
Frequent Advisor

Re: How to clone LVM settings /configurations to a brand new disk?

hi Patrick,

A shame it is not possible, the first time I saw "vgexport/vgimport" and "vgcfgbackup/vgrestore" I think they are my rescue for just kind of task.

Unfortunately the name did not reflected the way an administrator (just like me) though it is. Let hope HP will do some improve for "vgcfgbackup/vgrestore" (including the man pages) or implicit write it (that clone is not possible) on the man page.

Personally, I prefer they give the commands another name :-)

Thanks
BR Tuan
Tuan Nguyen_2
Frequent Advisor

Re: How to clone LVM settings /configurations to a brand new disk?


...More testing (with both vgexport/import and vgcfgbackup/vgcfgrestore involded).

...I am success to clone a new disk...but ONLY for getting the volumes (vg) informations, not any lvols informations. So the vg22.conf (vgcfgrestore uses it) is the header for a LVM disk and vgimport for updating the /etc/lvmtab and ??

..Now I know what HP means, "vg"cfgbackup means that the command ONLY takes a backup of the volume informations, nothing else. I wonder if HP makes a "lvcfgbackup/lvcfgrestore", then we can clone the "lv" settings on a new disk too :-) (..just kidding, of course I wish a more simple methode).

For those who interest for the test, please download the attached file.

BR
Tuan

Steve Lewis
Honored Contributor

Re: How to clone LVM settings /configurations to a brand new disk?

Whats the point of trying to create logical volume information without the volume contents?

vgcfgrestore is used typically to recover volume group and lvol information onto a replacement for a failed disk. It won't copy any data - vgsync does that. However vgcfgrestore also expects your new luns to have all the other LUNS/disks in place as well.

vgexport/vgimport are nothing to do with what you are trying to achieve - these commands read the LVM data from the disks themselves. Because your new disks are blank of course you will not read anything.

What you really need to do is this:

Create your luns on the EVA8000 the same size as your old ones.

Unplug one piece of fibre from the EVA5000 (I assume you have 2 paths) and plug it into the EVA8000. If you have a SAN switch, then add the EVA8000 into the same zone as the 5000/server.

So your old server sees both sets of LUNs on both EVAs.

Then you simply use Mirrordisk/UX to lvextend each logical volume onto the EVA8000's luns.

pvcreate the luns on the EVA8000.
vgextend the volume group to the new luns.
lvextend -m 1 each logical volume to the new EVA8000 luns.

Hope that you don't reach maxpv per vg!

Otherwise, use some SAN volume copy software or a completely different method such as file copy or database backup/restore.


Steve Lewis
Honored Contributor

Re: How to clone LVM settings /configurations to a brand new disk?

I forgot to add this.

Once you have mirrored your storage, you can eventually drop the original EVA5000 luns from your volume group; then unzone or unplug the old server.

If you are migrating to a new server, then once you have mirrored the data over to the EVA8000, you then use vgexport/vgimport to read the LVM data off the EVA8000's disks into the lvmtab on the new server.

Its not beginner's stuff but it can be done.
Tuan Nguyen_2
Frequent Advisor

Re: How to clone LVM settings /configurations to a brand new disk?

Hi Steve,

>>Whats the point of trying to create logical volume information without the volume contents?
I am only interest in the lvols because we have a "lot" of them and I dont like do it manually. When getting the metadata (LVM settings) we will use our backup (or maybe rsync from an another server running on eva5000 with the OLD LUNs) to restore the datas.

On rx4640 (Itanium) you can probably see LUN's on both eva5000 and 8000 with active-active mode, but on rp3410 (PA) it is out of question, Securepath 3.0f SP2 does not support active-passiv on those server. (our conf are running with active-passiv on eva5000 at the moment on both of the mention models). Until now I am not able to test it (coexist between eva5M og 8M) with rx4640 because waiting of the SW. On rp3410 I have plan to use pvlinks instead of SP.

>>vgcfgrestore is used typically to recover volume group and lvol information onto a replacement for a failed disk

I am trying to simulate a corrupt lvol221, but are not able to recover it from my LVM backup myvg22.conf, can you show me how.

>>vgexport/vgimport are nothing to do with what you are trying to achieve
As I wrote in my test and the other thread, it is only for "putty'ing" the VG in lvmtab.

Thanks for the mirror tips; no problem with maxpv, we had readadjust it for a while ago:-)

Again, I am not "so" interesting in the data, I am only interest in howto reuse the metadata of LVM..but now I know I must recreate them manually (or with a script).

Thanks,
Tuan