Online Storage Migration without ASM

Dec 6, 2013 / By Michael Dinh

Tags: , ,

I recently blogged about Playing with ASM Online Migration and still soul searching from not having jumped on the ASM band wagon.

How can online storage migration be performed before ASM came about? One option is using Logical Volume Manager (LVM) and I will demonstrate:

Display Volume Group

[root@lax ~]# vgdisplay –verbose vg02
Using volume group(s) on command line
Finding volume group “vg02″
— Volume group —
VG Name vg02
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 26
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size 5.00 GiB
PE Size 4.00 MiB
Total PE 1279
Alloc PE / Size 1250 / 4.88 GiB
Free PE / Size 29 / 116.00 MiB
VG UUID 5xIHp0-ch9d-tdE9-FygL-nSvc-TMfz-SZ3BaI

— Logical volume —
LV Path /dev/vg02/lv_data01
LV Name lv_data01
VG Name vg02
LV UUID pZ1yuz-fzYm-eCmW-qzzs-rBCQ-Vohl-bc3Z3z
LV Write Access read/write
LV Creation host, time lax.localdomain, 2013-12-05 18:26:59 -0800
LV Status available
# open 1
LV Size 4.88 GiB
Current LE 1250
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:2

— Physical volumes —
PV Name /dev/sdb
PV UUID 9lyp9r-w5cu-23u5-qIGj-AiLR-OuCk-Z5thvi
PV Status allocatable
Total PE / Free PE 1279 / 29

Display devices and Physical Volume

[root@lax ~]# ls /dev/sd*
/dev/sda /dev/sda1 /dev/sda2 /dev/sda3 /dev/sdb /dev/sdc
[root@lax ~]# pvdisplay /dev/sdb /dev/sdc
— Physical volume —
PV Name /dev/sdb
VG Name vg02
PV Size 5.00 GiB / not usable 4.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 1279
Free PE 29
Allocated PE 1250
PV UUID 9lyp9r-w5cu-23u5-qIGj-AiLR-OuCk-Z5thvi

“/dev/sdc” is a new physical volume of “5.00 GiB”
— NEW Physical volume —
PV Name /dev/sdc
VG Name
PV Size 5.00 GiB

Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID ycKP5Z-7BLc-209d-9nWk-M3fr-RilZ-SP0w0h

Create Physical Volume for disk /dev/sdc

[root@lax ~]# pvcreate /dev/sdc
Writing physical volume data to disk “/dev/sdc”
Physical volume “/dev/sdc” successfully created

Extend Volumne Group to include disk /dev/sdc

[root@lax ~]# vgextend vg02 /dev/sdc
Volume group “vg02″ successfully extended

While moving physical volume from one device to another, the follow PL/SQL block is run:

begin
for i in 1..1000000 loop
insert into t values (i);
end loop;
end;
/

Move Physical Volume from /dev/sdb to /dev/sdc

[root@lax ~]# pvmove /dev/sdb /dev/sdc
/dev/sdb: Moved: 0.6%
/dev/sdb: Moved: 3.6%
/dev/sdb: Moved: 8.7%
/dev/sdb: Moved: 10.5%
/dev/sdb: Moved: 13.0%
/dev/sdb: Moved: 15.7%
/dev/sdb: Moved: 17.1%
/dev/sdb: Moved: 18.6%
/dev/sdb: Moved: 24.0%
/dev/sdb: Moved: 25.8%
/dev/sdb: Moved: 29.1%
/dev/sdb: Moved: 31.0%
/dev/sdb: Moved: 33.0%
/dev/sdb: Moved: 34.6%
/dev/sdb: Moved: 40.9%
/dev/sdb: Moved: 49.6%
/dev/sdb: Moved: 58.2%
/dev/sdb: Moved: 67.0%
/dev/sdb: Moved: 75.9%
/dev/sdb: Moved: 84.6%
/dev/sdb: Moved: 92.9%
/dev/sdb: Moved: 100.0%

Drop from Volume Group /dev/sdb

[root@lax ~]# vgreduce vg02 /dev/sdb
Removed “/dev/sdb” from volume group “vg02″

Verify Volume Group

[root@lax ~]# vgdisplay –verbose vg02
Using volume group(s) on command line
Finding volume group “vg02″
— Volume group —
VG Name vg02
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 31
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size 5.00 GiB
PE Size 4.00 MiB
Total PE 1279
Alloc PE / Size 1250 / 4.88 GiB
Free PE / Size 29 / 116.00 MiB
VG UUID 5xIHp0-ch9d-tdE9-FygL-nSvc-TMfz-SZ3BaI

— Logical volume —
LV Path /dev/vg02/lv_data01
LV Name lv_data01
VG Name vg02
LV UUID pZ1yuz-fzYm-eCmW-qzzs-rBCQ-Vohl-bc3Z3z
LV Write Access read/write
LV Creation host, time lax.localdomain, 2013-12-05 18:26:59 -0800
LV Status available
# open 1
LV Size 4.88 GiB
Current LE 1250
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:2

— Physical volumes —
PV Name /dev/sdc
PV UUID eXJJD0-ISW1-P7gg-aCfs-VRvj-5cj0-9xsyx0
PV Status allocatable
Total PE / Free PE 1279 / 29

[root@lax ~]#

Verify Transaction Count

LAX:(HR@db02)> select count(*) from t;

COUNT(*)
———-
1000000

LAX:(HR@db02)>

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>