How to migrate a LVM to a different host in HP-UX?


This post describes how to migrate volume group to another server with vgexportand vgimport method on HP-UX.

At Source Machine:

Step 1: From the server which VG is imported.

  • Before start operations take a cfg2html.
  • Take a backup of File System
  • Close all applications
  • Be sure that there is no process on filesystem which is getting services the VG.
  • Unmount filesystems.

Step 2:Deactivate VG

#vgdisplay -v vgnew
— Volume groups —
VG Name /dev/vgnew
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 1
Open LV 1
Max PV 16
Cur PV 1
Act PV 1
Max PE per PV 5120
VGDA 2
PE Size (Mbytes) 4
Total PE 5119
Alloc PE 10
Free PE 5109
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0
VG Version 1.0
VG Max Size 320g
VG Max Extents 81920
— Logical volumes —
LV Name /dev/vgnew/lvnew
LV Status available/syncd
LV Size (Mbytes) 40
Current LE 10
Allocated PE 10
Used PV 1
— Physical volumes —
PV Name /dev/disk/disk58
PV Status available
Total PE 5119
Free PE 5109
Autoswitch On
Proactive Polling On 



The disk which ‘ll be migrate to other server is disk58;

#ls -ld /dev/vg*/group
crw-r—– 1 root sys 64 0x020000 Apr 12 2013 /dev/vg_asm_bscs/group
crw-r—– 1 root sys 64 0x030000 Apr 12 2013 /dev/vg_asm_rtx/group
crw-r—– 1 root sys 64 0x040000 Jan 18 2014 /dev/vgdeneme/group
crw-r—– 1 root sys 64 0x060000 Oct 21 15:26 /dev/vgnew/group
crw-r—– 1 root sys 64 0x010000 Apr 12 2013 /dev/vgora/group
crw-r—– 1 root sys 64 0x000000 Mar 19 2013 /dev/vgquorum/group
crw-r—– 1 root sys 128 0x000000 May 18 2012 /dev/vgroot/group
crw-r–r– 1 root sys 64 0x050000 Oct 21 15:23 /dev/vgtest/group
#vgchange -a n vgnew


Step 3: Export Volume Group with vgexport

#vgexport -p -s -m /tmp/vgnew.map /dev/vgnew
vgexport: Preview of vgexport on volume group “/dev/vgnew” succeeded.


Step 4: Check Volume group map file and copy it to destination server

#cat /tmp/vgnew.map
VGID bff7315156278466
1 lvnew[shell]
#scp /tmp/vgnew.map user@destinationmachine:/tmp/

 

At Destination Server:

Step 1: Check Map file and Disks.

#ioscan
#inqraid -fx -CLIWP /dev/rdisk/*|grep 200B // I used inqraid you can use another tool or script to find disk name which LUNID is 200B
disk133 50060b000030168a – CL4-A – 50211374 200B OPEN-V #
#cat /tmp/vgnew.map
VGID bff7315156278466
1 lvnew


Step 2: Create Volume Group files

#ls -ld /dev/vg*/group
crw-r–r– 1 root sys 64 0x040000 Jan 2 2015 /dev/xxx/group
crw-r—– 1 root sys 128 0x000000 Apr 11 2013 /dev/vgroot/group
crw-r–r– 1 root sys 64 0x010000 Oct 21 15:14 /dev/xxxx2/group
#mkdir /dev/vgnew
#mknod /dev/vgnew/group c 64 0x060000


Step 3: Import Volume group at destination server

There is two way to  import  VG with  map  file. First method  you don't  need to give disk information . With  this  method  it'll  use PVlink and you 'll see  alternate  path on PV information. Second method ,you can give  disk name  to avoid  using  pvlink method.
First      Method:

#vgimport -s -m /tmp/vgnew.map /dev/vgnew
Second Method:
#vgimport -m /tmp/vgnew.map /dev/vgnew /dev/dsk/disk133

Activate  Volume  Group:
#vgchange -a y vgnew
#vgdisplay -v vgnew
— Volume groups —
VG Name /dev/vgnew
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 1
Open LV 1
Max PV 16
Cur PV 1
Act PV 1
Max PE per PV 5120
VGDA 2
PE Size (Mbytes) 4
Total PE 5119
Alloc PE 10
Free PE 5109
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0
VG Version 1.0
VG Max Size 320g
VG Max Extents 81920
— Logical volumes —
LV Name /dev/vgnew/lvnew
LV Status available/syncd
LV Size (Mbytes) 40
Current LE 10
Allocated PE 10
Used PV 1
— Physical volumes —
PV Name /dev/dsk/c6t2d3
PV Name /dev/dsk/c8t2d3 Alternate Link
PV Status available
Total PE 5119
Free PE 5109
Autoswitch On
Proactive Polling On


Step 4: Mount Logical Volume and check fil

#mount /dev/vgnew/lvnew /mnt
#ls -ld /mnt/*
drwxr-xr-x 2 root root 96 Oct 21 14:27 /mnt/lost+found
drwxr-xr-x 2 root sys 96 Oct 21 14:27 /mnt/teshere
drwxr-xr-x 2 root sys 96 Oct 21 14:27 /mnt/test1

 

Tagged In:

I'm a IT Infrastructure and Operations Architect with extensive experience and administration skills and works for Turk Telekom. I provide hardware and software support for the IT Infrastructure and Operations tasks.

205 Total Posts
Follow Me