Site icon UnixArena

RedhatLinux SAN Migration using LVM

What would be the best way to do the SAN Migration in Redhat Linux LVM? Would the pvmove work? I would recommend you to go for LVM mirroring since its a safest method and zero downtime to perform this activity. First, you need to add the new SAN LUNS in the volume group and mirror the volume using those new disks. Once the synchronization is done, you can remove old LUNS from the volume group.

 

1. Assume your disk group name is “lin” and volume name is lvol0(Mirrored) and /dev/sdb & /dev/sdc coming from same storage.
[root@mylinz ~]# pvs -a -o +devices
PV VG Fmt Attr PSize PFree Devices
/dev/sda2 vg_mylinz lvm2 a- 19.51g 0 /dev/sda2(0)
/dev/sda2 vg_mylinz lvm2 a- 19.51g 0 /dev/sda2(4234)
/dev/sdb lin lvm2 a- 508.00m 508.00m
/dev/sdc lin lvm2 a- 508.00m 508.00m
/dev/sdd lin lvm2 a- 508.00m 508.00m
/dev/sde lvm2 a- 512.00m 512.00m
[root@mylinz ~]# vgs
VG #PV #LV #SN Attr VSize VFree
lin 3 0 0 wz--n- 1.49g 1.49g
vg_mylinz 1 2 0 wz--n- 19.51g 0

 

2. Assume lvol0 is mirrored and this volume used sdb & sdc from old SAN box.
[root@mylinz ~]# lvs -a -o +devices
LV VG Attr LSize Origin Snap% Move Log Copy% Convert Devices
lvol0 lin mwi-a- 52.00m 100.00 lvol0_mimage_0(0),lvol0_mimage_1(0)
[lvol0_mimage_0] lin iwi-ao 52.00m /dev/sdb(0)
[lvol0_mimage_1] lin iwi-ao 52.00m /dev/sdc(0)
lv_root vg_mylinz -wi-ao 16.54g /dev/sda2(0)
lv_swap vg_mylinz -wi-ao 2.97g /dev/sda2(4234)

 

 

Here I am removing one lun which is coming from old storage as removing /dev/sdb.

Assume Device:/dev/sdd from new storage.
[root@mylinz ~]# lvconvert -m0 --mirrorlog core /dev/lin/lvol0 /dev/sdb
Logical volume lvol0 converted.
[root@mylinz ~]# lvs -a -o +devices
LV VG Attr LSize Origin Snap% Move Log Copy% Convert Devices
lvol0 lin -wi-a- 52.00m /dev/sdc(0)
lv_root vg_mylinz -wi-ao 16.54g /dev/sda2(0)
lv_swap vg_mylinz -wi-ao 2.97g /dev/sda2(4234)

 

Here I am mirroring volume with new LUN which is coming from new SAN.
[root@mylinz ~]# lvconvert -m1 --mirrorlog core /dev/lin/lvol0 /dev/sdd
lin/lvol0: Converted: 100.0%
[root@mylinz ~]# lvs -a -o +devices
LV VG Attr LSize Origin Snap% Move Log Copy% Convert Devices
lvol0 lin mwi-a- 52.00m 100.00 lvol0_mimage_0(0),lvol0_mimage_1(0)
[lvol0_mimage_0] lin iwi-ao 52.00m /dev/sdc(0)----------------------------> Now we can remove this one.
[lvol0_mimage_1] lin iwi-ao 52.00m /dev/sdd(0)
lv_root vg_mylinz -wi-ao 16.54g /dev/sda2(0)
lv_swap vg_mylinz -wi-ao 2.97g /dev/sda2(4234)

 

Now we can remove the LUN which is coming from old SAN as removing /dev/sdc.
[root@mylinz ~]# lvconvert -m0 --mirrorlog core /dev/lin/lvol0 /dev/sdc
Logical volume lvol0 converted.
[root@mylinz ~]# lvs -a -o +devices
LV VG Attr LSize Origin Snap% Move Log Copy% Convert Devices
lvol0 lin -wi-a- 52.00m /dev/sdd(0)
lv_root vg_mylinz -wi-ao 16.54g /dev/sda2(0)
lv_swap vg_mylinz -wi-ao 2.97g /dev/sda2(4234)
Now your volume is completely migrated to new SAN. You may think this somewhat lengthy process but very safe. Repeat the same for other volumes.

Thank you for reading this article.
Please leave a comment if you have any doubt, i will get back to you as soon as possible.
Exit mobile version