Friday 18 April 2014

Sync data using Veritas Volume Manager

I have been using rsync to do data migration, recently I need to do data migration again.

Since this time the data resides in Veritas volumes, I want to try the Veritas way.

My setup in the old server is like this:

# vxprint -g ftpdg
TY NAME         ASSOC        KSTATE   LENGTH   PLOFFS   STATE    TUTIL0  PUTIL0
dg ftpdg        ftpdg        -        -        -        -        -       -

dm ftpdg01      tagmastore-usp0_0 -   461350656 -       -        -       -
dm ftpdg02      tagmastore-usp0_1 -   31439616 -        -        -       -

v  volb         gen          ENABLED  461314816 -       ACTIVE   -       -
pl volb-01      volb         ENABLED  461314816 -       ACTIVE   -       -
sd ftpdg01-01   volb-01      ENABLED  461314816 0       -        -       -

v  vols         gen          ENABLED  31438848 -        ACTIVE   -       -
pl vols-01      vols         ENABLED  31438848 -        ACTIVE   -       -
sd ftpdg02-01   vols-01      ENABLED  31438848 0        -        -       -



I allocated two LUNs from storage, they are identified as tagmastore-usp0_2 and tagmastore-usp0_3.



To enable the new disks
# vxdctl enable

My privlen for old disks was 2048, so set the same value for new disks
# vxdisksetup -i tagmastore-usp0_2 privlen=2048
# vxdisksetup -i tagmastore-usp0_3 privlen=2048


Add the new disks to disk group:
# vxdg -g ftpdg adddisk ftpdg03=tagmastore-usp0_2
# vxdg -g ftpdg adddisk ftpdg04=tagmastore-usp0_3


Create sub disk and plex
# vxmake -g ftpdg sd ftpdg03-01 ftpdg03,0,461314816
# vxmake -g ftpdg plex volb-02

# vxmake -g ftpdg sd ftpdg04-01 ftpdg04,0,31438848
# vxmake -g ftpdg plex vols-02


Attach the plex to volumes
# vxplex -g ftpdg att volb volb-02
# vxplex -g ftpdg att vols vols-02


After attaching the plex, both old and new disks should have identical data, we can detach the new disks and add it to our new server.

Detach the new plex
# vxplex -g ftpdg det volb-02
# vxplex -g ftpdg det vols-02

Disassociate the new plex
# vxplex -g ftpdg dis volb-02
# vxplex -g ftpdg dis vols-02


Create new volume using the detached plex
# vxmake -g ftpdg vol newb plex=volb-02
# vxmake -g ftpdg vol news plex=vols-02


Split the diskgroup
# vxdg split ftpdg ftpdg2 newb news

At this step, we will have a diskgroup ftpdg2, inside it there are two volumes: newb and news.
We are planning to use the same volume names on new server, so rename the volumes in ftpdg2
# vxedit -g ftpdg2 rename newb volb
# vxedit -g ftpdg2 rename news vols

We can deport ftpdg2 from our old server:
# vxdg deport ftpdg2

On new server we can import ftpdg2 as ftpdg
# vxdg import -n ftpdg ftpdg2

We also need to start the volumes
# vxvol -g ftpdg start volb
# vxvol -g ftpdg start vols


The device path for the volumes are:
/dev/vx/dsk/ftpdg/volb
/dev/vx/dsk/ftpdg/vols


we can mount the volumes and start using it!