SHIFT

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


aixmigratepv
Differences

This shows you the differences between two versions of the page.

Link to this comparison view

aixmigratepv [2013/02/03 15:00] (current)
sjoerd created
Line 1: Line 1:
 += AIX Migrate PV =
 +This is an article about migrating data from one physical volume to another on AIX using the migratepv command. ​
 +\\
 +This is the scenario:
 +* An [[aixvios]] 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:
 +<​code>​
 +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
 +</​code>​
 +
 +After creating the LUN on the new SAN and assigning it to the LPAR you can discover it:
 +<​code>​
 +root@lpar2:/​home/​root>​cfgmgr
 +root@lpar2:/​home/​root>​lspv
 +hdisk0 ​         000a447a24a494e9 ​                   rootvg ​         active
 +hdisk1 ​         none                                None
 +</​code>​
 +
 +> 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:
 +<​code>​
 +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
 +</​code>​
 +
 +== 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:
 +<​code>​
 +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>​...
 +</​code>​
 +
 +Then migrate the data for the logical volume hd5:
 +<​code>​
 +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
 +</​code>​
 +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:
 +<​code>​
 +root@lpar2:/​home/​root>​chpv -c hdisk0
 +</​code>​
 +Now we define the new disk as the boot disk by rebuilding the boot image:
 +<​code>​
 +root@lpar2:/​home/​root>​bosboot -a -d hdisk1
 +
 +bosboot: Boot image is 45155 512 byte blocks.
 +</​code>​
 +And to make sure the server boots without interruption or intervention we'll also update the bootlist:
 +<​code>​
 +root@lpar2:/​home/​root>​bootlist -m normal hdisk1
 +</​code>​
 +Now we're done with the boot image, we'll start the rest:
 +<​code>​
 +root@lpar2:/​home/​root>​migratepv hdisk0 hdisk1
 +</​code>​
 +Check whether all data has been removed from hdisk0:
 +<​code>​
 +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
 +</​code>​
 +After migrating the data we can remove the old disk from the SAN:
 +<​code>​
 +root@lpar2:/​home/​root>​reducevg rootvg hdisk0
 +0516-1734 reducevg: Warning, savebase failed. ​ Please manually run '​savebase'​ before rebooting.
 +root@lpar2:/​home/​root>​savebase
 +</​code>​
 +Now you can remove the old disk and disconnect it from the SAN:
 +<​code>​
 +root@lpar2:/​home/​root>​rmdev -dl hdisk0
 +hdisk0 deleted
 +</​code>​
 +
 += 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 [[aixvios|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.
 +
 +{{tag>​aix storage}}
aixmigratepv.txt ยท Last modified: 2013/02/03 15:00 by sjoerd