Table of Contents
AIX Migrate PV
Summary: ALthough AIX is by now on version 7.3 I find these old pages so fascinating I decided to keep them. On this page I'll show you how to migrate data from one physical volume to another on AIX using the migratepv command.. This page is for AIX 5.3 and AIX 6.1.
Date: Between 2010-2013
Refactor: 21 December 2024: Checked formatting.
Introduction
This is an article about migrating data from one physical volume to another on AIX using the migratepv command.
This is the scenario:
- An AIX VIOS server with multiple LPARs on it
- All data is now on a old SAN
- There is a new SAN and we want to migrate all data to the new SAN without downtime
To do so, we'll start with migrating the LPARs and then the VIOS server. They can all be done using the migratepv command.
LPAR2
We start with LPAR2, which is an AIX 6.1 TL 6 FP 2 testmachine. It has one volume group consisting of 1 hdisk:
sjoerd@lpar2:/home/sjoerd>lsvg rootvg sjoerd@lpar2:/home/sjoerd>lsvg -p rootvg rootvg: PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION hdisk0 active 957 415 159..03..00..61..192
After creating the LUN on the new SAN and assigning it to the LPAR you can discover it:
root@lpar2:/home/root>cfgmgr root@lpar2:/home/root>lspv hdisk0 000a447a24a494e9 rootvg active hdisk1 none None
Note two things: I switched to root and there is a new available physical volume available.
Don't forget to add the new disk to the rootvg volume group, migratepv can only move data between physical volumes in the same volume group:
root@lpar2:/home/root>extendvg rootvg hdisk1 0516-1254 extendvg: Changing the PVID in the ODM. root@lpar2:/home/root>lsvg -p rootvg rootvg: PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION hdisk0 active 957 415 159..03..00..61..192 hdisk1 active 959 959 192..192..191..192..192
Migrating Data
Because the rootvg is the only volume group it is also the volume group that contains the boot image. In this case it's necessary to first move the logical volume that contains the boot image to the new disk.
First find the logical volume that holds the boot image:
root@lpar2:/home/root>lsvg -l rootvg rootvg: LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT hd5 boot 1 1 1 closed/syncd N/A ...<cut>...
Then migrate the data for the logical volume hd5:
root@lpar2:/home/root>migratepv -l hd5 hdisk0 hdisk1 0516-1246 migratepv: If hd5 is the boot logical volume, please run 'chpv -c hdisk0' as root user to clear the boot record and avoid a potential boot off an old boot image that may reside on the disk from which this logical volume is moved/removed. root@lpar2:/home/root> root@lpar2:/home/root>lsvg -p rootvg rootvg: PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION hdisk0 active 957 416 160..03..00..61..192 hdisk1 active 959 958 191..192..191..192..192
As you can see, there is one PP less in use on the old disk and one PP is in use on the new one. Now we have to run the command displayed in the message warning, to clear the old disk from the boot record:
root@lpar2:/home/root>chpv -c hdisk0
Now we define the new disk as the boot disk by rebuilding the boot image:
root@lpar2:/home/root>bosboot -a -d hdisk1 bosboot: Boot image is 45155 512 byte blocks.
And to make sure the server boots without interruption or intervention we'll also update the bootlist:
root@lpar2:/home/root>bootlist -m normal hdisk1
Now we're done with the boot image, we'll start the rest:
root@lpar2:/home/root>migratepv hdisk0 hdisk1
Check whether all data has been removed from hdisk0:
root@lpar2:/home/root>lsvg -p rootvg rootvg: PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION hdisk0 active 957 957 192..191..191..191..192 hdisk1 active 959 385 127..08..00..58..192
After migrating the data we can remove the old disk from the SAN:
root@lpar2:/home/root>reducevg rootvg hdisk0 0516-1734 reducevg: Warning, savebase failed. Please manually run 'savebase' before rebooting. root@lpar2:/home/root>savebase
Now you can remove the old disk and disconnect it from the SAN:
root@lpar2:/home/root>rmdev -dl hdisk0 hdisk0 deleted
Migrate LPAR1
LPAR 1 was a AIX 5.3 TL 12 FP 2 box and everything worked exactly the same.
Migrate VIOS Host
You can do the VIOS (Virtual IO Server) exactly the same way, except that you first have to issue the command “oem_setup_env” so you can use the normal AIX commands.