Migrating the contents of a physical volume

To move the physical partitions belonging to one or more specified logical volumes from one physical volume to one or more other physical volumes in a volume group, use the following instructions. You can also use this procedure to move data from a failing disk before replacing or repairing the failing disk. This procedure can be used on physical volumes in either the root volume group or a user-defined volume group.

Attention: When the boot logical volume is migrated from a physical volume, the boot record on the source must be cleared or it could cause a system hang. When you execute the bosboot command, you must also execute the chpv -c command described in step 4 of the following procedure.
  1. If you want to migrate the data to a new disk, do the following steps. Otherwise, continue with step 2.
    1. Check that the disk is recognizable by the system and available by typing:
      lsdev -Cc disk
      The output resembles the following:
      hdisk0 Available 10-60-00-8,0  16 Bit  LVD  SCSI Disk Drive
      hdisk1 Available 10-60-00-9,0  16 Bit  LVD  SCSI Disk Drive
      hdisk2 Available 10-60-00-11,0 16 Bit  LVD  SCSI Disk Drive
    2. If the disk is listed and in the available state, check that it does not belong to another volume group by typing:
      lspv
      The output looks similar to the following:
      hdisk0          0004234583aa7879       rootvg         active
      hdisk1          00042345e05603c1       none           active
      hdisk2          00083772caa7896e       imagesvg       active
      In the example, hdisk1 can be used as a destination disk because the third field shows that it is not being used by a volume group.

      If the new disk is not listed or unavailable, you need to configure the disk or logical volume storage.

    3. Add the new disk to the volume group by typing:
      extendvg VGName diskname
      Where VGName is the name of your volume group and diskname is the name of the new disk. In the example shown in the previous step, diskname would be replaced by hdisk1.
  2. The source and destination physical volumes must be in the same volume group. To determine whether both physical volumes are in the volume group, type:
    lsvg -p VGname
    Where VGname is the name of your volume group. The output for a root volume group looks similar to the following:
    rootvg:                                                                       
    PV_NAME        PV STATE       TOTAL PPs   FREE PPs    FREE DISTRIBUTION 
    hdisk0         active         542         85          00..00..00..26..59
    hdisk1         active         542         306         00..00..00..00..06
    Note the number of FREE PPs.
  3. Check that you have enough room on the target disk for the source that you want to move:
    1. Determine the number of physical partitions on the source disk by typing:
      lspv SourceDiskName | grep "USED PPs"
      Where SourceDiskName is of the name of the source disk, for example, hdisk0. The output looks similar to the following:
      USED PPs:      159 (636 megabytes)
      In this example, you need 159 FREE PPs on the destination disk to successfully complete the migration.
    2. Compare the number of USED PPs from the source disk with the number of FREE PPs on the destination disk or disks (step 2). If the number of FREE PPs is larger than the number of USED PPs, you have enough space for the migration.
  4. Follow this step only if you are migrating data from a disk in the rootvg volume group.
    If you are migrating data from a disk in a user-defined volume group, proceed to step 5.
    Check to see if the boot logical volume (hd5) is on the source disk by typing:
    lspv -l SourceDiskNumber | grep hd5
    If you get no output, the boot logical volume is not located on the source disk. Continue to step 5.
    If you get output similar to the following:
    hd5            2   2   02..00..00..00..00   /blv
    then run the following command:
    migratepv -l hd5 SourceDiskName DestinationDiskName
    You will receive a message warning you to perform the bosboot command on the destination disk. You must also perform a mkboot -c command to clear the boot record on the source. Type the following sequence of commands:
    bosboot -a -d /dev/DestinationDiskName
    bootlist -m normal DestinationDiskName
    mkboot -c -d /dev/SourceDiskName
  5. Migrate your data by typing the following SMIT fast path:
    smit migratepv 
  6. List the physical volumes, and select the source physical volume you examined previously.
  7. Go to the DESTINATION physical volume field. If you accept the default, all the physical volumes in the volume group are available for the transfer. Otherwise, select one or more disks with adequate space for the partitions you are moving (from step 4).
  8. If you wish, go to the Move only data belonging to this LOGICAL VOLUME field, and list and select a logical volume. You move only the physical partitions allocated to the logical volume specified that are located on the physical volume selected as the source physical volume.
  9. Press Enter to move the physical partitions.
At this point, the data now resides on the new (destination) disk. The original (source) disk, however, remains in the volume group. If the disk is still reliable, you could continue to use it as a hot spare disk. Especially when a disk is failing, it is advisable to do the following steps:
  1. To remove the source disk from the volume group, type:
    reducevg VGNname SourceDiskName
  2. To physically remove the source disk from the system, type:
    rmdev -l SourceDiskName -d