Wednesday, April 29, 2009

AIX - LVM - Export Volume Group

AIX - LVM - Export Volume Group

Using exportvg command we can export VG (including all the PV’s) from one server to another server.

If you have ServerA, in this server has DATAVG with two PV’s. Now we want export DATAVG to ServerB

Before exporting the DATAVG, we should Varryoff the DATAVG, i.e. DATAVG is moved to offline.

#varryoff DATAVG (Varryoff the DATAVG)
#exportvg DATAVG (VG information removed from ODM)

Now DATAVG is exported from the ServerA, after this run the following command to verify the export.

#lsvg

It won’t show DATAVG name. Because DATAVG is exported.

Then you should remove PV from the configuration

#rmdev –dl hdisk3
#rmdev –dl hdisk4

After that we can remove the PV’s from ServerA for import DATAVG to ServerB.

AIX - LVM - Migrate Logical Volume

AIX - LVM - Migrate Logical Volume

Using migratepv command we can migrate lv from PV to PV

If we want to migrate single LV

#migratepv –l testlv hdisk1 hdisk2

After executing above command testlv LV is moved hdisk2.

AIX - LVM - Migrate Physical Volume

AIX - LVM - Migrate Physical Volume

Using migratepv command we can move full PV data or single LV from one PV to another PV. This is not copy just cut and past method

If we want to migrate data from PV to PV

#migratepv hdisk1 hdisk2

After executing above command hdisk1 data is moved to hdisk2.

AIX - LVM - UnMirror Volume Group

AIX - LVM - Unmirror Volume Group

Using Unmirror command we can Unmirror the VG

#unmirrorvg rootvg hdisk1

PV hdisk1 is removed from rootvg mirror.

AIX - LVM - Synchronize Volume Group

AIX - LVM - Synchronize Volume Group

Using Syncvg command we can sync the mirrored Vg and LV copy information’s

If we want to sync lvcopy

#syncvg –l lvname

#syncvg –l testlv

After executing the above command, testlv copy get sync with lv copied PV

If we want to sync mirrored PV’s

#syncvg –v rootvg

The above sync the mirrored PV’s in rootvg

AIX - LVM - Mirror Volume Group

AIX - LVM - Mirror Volume Group

We can do mirroring in AIX, using mirrorvg command and we can create max of three copy of mirror.

If we have two PV’s in rootvg, now we want mirror, Data and OS installed in hdisk0 and now we want to mirror hdisk0 to hdisk1. Then your command will be

#mirrorvg –S –m rootvg hdisk1

S – Backgroup mirror
-m - exact (force) mirror

NOTE: in mirrored VG quorum should be off line because quorum is not recommended for mirror.

AIX - LVM - Repair File System

AIX - LVM - Repair File System

Using fsck command we can repair the problematic FS or corrupted FS

If you want check /data FS

#fsck /data

Or directly we can repair the LV

#fsck –Y n /dev/datalv (To fsck the FS associated to /dev/datalv assuming response “Yes”

#fsck –p /dev/datalv (To restore superblock from backup superblock)