Migrate rootvg on VIOS and on LPAR

Recently I was tasked to work on VIOS and LPAR and here is some notes for me to remember.
====Identifying the Newly Added Disk(s)====

NOTE: If this is a dual VIOS setup, the commands must be done on each VIOS unless noted otherwise.

On the VIO Server:

  1. List all physical volumes on the VIOS: $ lspv
  2. Add the newly attached storage device(s) by going to the root console of the
    VIOS and entering # cfgmgr twice.
  3. Verify that the newly attached device(s) show up by listing the physical volumes again.
  4. Map out all of the physical volumes and make a note of the one(s) that need to be swapped: $ lsmap -all
  5. Verify that the newly attached device(s) are the correct size: $ lspv -free
  6. Assign a PVID to the newly attached device(s) and list them again to take note of the PVID:
    $ chdev -dev hdisk# -attr pv=yes*
    $ lspv

*This command must be ran for each newly added storage device.

====Attaching the Newly Added Disk(s) to a VIOS====

  1. List the physical volumes on the VIOS.
  2. Extend the rootvg partition to include the newly added storage device. From the root console: # extendvg rootvg hdisk#
  3. Mirror the the rootvg to include the newly added device. From the root console:# mirrorvg rootvg hdisk#
  4. Check which device the system was booted from last: # bootinfo -b
  5. View all devices to check which ones are boot devices: # ipl_varyon -i
  6. View the rootvg partition to verify the extend and mirror were successful:
    # lsvg rootvg
    # lsvg -l rootvg
    # lsvg -p rootvg
  7. View the boot list: # bosboot -m normal -o
  8. Check the numbers on the newly added disk and on the ipldevice:
    # ls -l *hdisk#*
    # ls -l ipldevice
    rhdisk and ipldevice should be the same.
  9. Set the newly added disk as a boot device and verify that it is listed as such:
    # bosboot -ad /dev/hdisk#
    # lslv -m hd5 (or whatever the boot device is on the system).
    # ipl_varyon -i
  10. Modify the bootlist to make the new disk the only boot device and verify:
    # bootlist -m normal hdisk#
    # bootlist -m service hdisk#
  11. List the logical volumes associated with the rootvg: # lsvg -l rootvg
  12. List the disks associated with each volume: # lslv -m volume_name
  13. Check that the ipldevice and the newly added disk have the same numbers: # ls -al /dev
  14. If everything is in order, break the mirror: # unmirrorvg rootvg hdisk_old
  15. List the logical volumes now associated with the old disk and the new one:# lspv -l disk# (run on both disks).
  16. Migrate any logical volumes still associated with the old disk (probably lg_dumplv): # migratepv -l lg_dumplv hdisk_old hdisk#
  17. Reduce the rootvg partition: # reducevg rootvg hdisk_old
  18. If this is a dual VIOS setup, perform this on both VIOS: $ chdev -dev hdisk_old -attr pv=no
    $ chdev -dev hdisk# -attr pv=clear
    # rmdev -l hdisk_old

====Attaching the Newly Added Disk(s) to an LPAR====

  1. If there is more than one VIO server, perform the following to allow the device to be assigned from all VIO servers:
    $ chdev -dev hdisk# -attr reserve_policy=no_reserve
  2. On the VIO server(s), perform the following: $ mkvdev -vdev hdisk# -vadapter vhost# -dev VTD_name
  3. On the VIO server(s), verify that the disks are mapped to the device correctly: $ lsmap -vadapter vhost#
  4. List the volumes on the LPAR client to verify that they are displaying: # lspv
  5. On the LPAR client, discover, extend, and mirror the rootvg:
    # cfgmgr
    # extendvg rootvg hdisk#
    # mirrorvg rootvg hdisk#
  6. Check which device the system was booted from last: # bootinfo -b
  7. View all devices to check which ones are boot devices: # ipl_varyon -i
  8. View the rootvg partition to verify the extend and mirror were successful:
    # lsvg rootvg
    # lsvg -l rootvg
    # lsvg -p rootvg
  9. View the boot list: # bootlist -m normal -o
  10. Check the numbers on the newly added disk and on the ipldevice:
    # ls -l *hdisk#*
    # ls -l ipldevice
    rhdisk and ipldevice should be the same.
  11. Set the newly added disk as a boot device and verify that it is listed as such:
    # bosboot -ad /dev/hdisk#
    # lslv -m hd5 (or whatever the boot device is on the system).
    # ipl_varyon -i
  12. Modify the bootlist to make the new disk the only boot device and verify:
    # bootlist -m normal hdisk#
    # bootlist -m service hdisk#
  13. List the logical volumes associated with the rootvg: # lsvg -l rootvg
  14. List the disks associated with each volume: # lslv -m volume_name
  15. Check that the ipldevice and the newly added disk have the same numbers: # ls -al /dev
  16. If everything is in order, break the mirror: # unmirrorvg rootvg hdisk_old
  17. List the logical volumes now associated with the old disk and the new one:# lspv -l disk# (run on both disks).
  18. Migrate any logical volumes still associated with the old disk (probably lg_dumplv): # migratepv -l lg_dumplv hdisk_old hdisk#
  19. Reduce the rootvg partition: # reducevg rootvg hdisk_old
  20. Remove the disk: rmdev -dl hdisk_old
  21. Remove the VTD associated with the disk from the VIO server(s): $ rmvdev -vtd VTD_name_old
  22. Perform cleanup for the removed disk on the VIO server(s): $ chdev -dev hdisk_old -attr pv=no
    $ chdev -dev hdisk# -attr pv=clear
    # rmdev -l hdisk_old