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:
- List all physical volumes on the VIOS:
$ lspv
- Add the newly attached storage device(s) by going to the root console of the
VIOS and entering# cfgmgr
twice. - Verify that the newly attached device(s) show up by listing the physical volumes again.
- Map out all of the physical volumes and make a note of the one(s) that need to be swapped:
$ lsmap -all
- Verify that the newly attached device(s) are the correct size:
$ lspv -free
- 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
====Attaching the Newly Added Disk(s) to a VIOS====
- List the physical volumes on the VIOS.
- Extend the rootvg partition to include the newly added storage device. From the root console:
# extendvg rootvg hdisk#
- Mirror the the rootvg to include the newly added device. From the root console:
# mirrorvg rootvg hdisk#
- Check which device the system was booted from last:
# bootinfo -b
- View all devices to check which ones are boot devices:
# ipl_varyon -i
- View the rootvg partition to verify the extend and mirror were successful:
# lsvg rootvg
# lsvg -l rootvg
# lsvg -p rootvg
- View the boot list:
# bosboot -m normal -o
- 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. - 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
- Modify the bootlist to make the new disk the only boot device and verify:
# bootlist -m normal hdisk#
# bootlist -m service hdisk#
- List the logical volumes associated with the rootvg:
# lsvg -l rootvg
- List the disks associated with each volume:
# lslv -m volume_name
- Check that the ipldevice and the newly added disk have the same numbers:
# ls -al /dev
- If everything is in order, break the mirror:
# unmirrorvg rootvg hdisk_old
- List the logical volumes now associated with the old disk and the new one:
# lspv -l disk#
(run on both disks). - Migrate any logical volumes still associated with the old disk (probably lg_dumplv):
# migratepv -l lg_dumplv hdisk_old hdisk#
- Reduce the rootvg partition:
# reducevg rootvg hdisk_old
- 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====
- 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
- On the VIO server(s), perform the following:
$ mkvdev -vdev hdisk# -vadapter vhost# -dev VTD_name
- On the VIO server(s), verify that the disks are mapped to the device correctly:
$ lsmap -vadapter vhost#
- List the volumes on the LPAR client to verify that they are displaying:
# lspv
- On the LPAR client, discover, extend, and mirror the rootvg:
# cfgmgr
# extendvg rootvg hdisk#
# mirrorvg rootvg hdisk#
- Check which device the system was booted from last:
# bootinfo -b
- View all devices to check which ones are boot devices:
# ipl_varyon -i
- View the rootvg partition to verify the extend and mirror were successful:
# lsvg rootvg
# lsvg -l rootvg
# lsvg -p rootvg
- View the boot list:
# bootlist -m normal -o
- 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. - 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
- Modify the bootlist to make the new disk the only boot device and verify:
# bootlist -m normal hdisk#
# bootlist -m service hdisk#
- List the logical volumes associated with the rootvg:
# lsvg -l rootvg
- List the disks associated with each volume:
# lslv -m volume_name
- Check that the ipldevice and the newly added disk have the same numbers:
# ls -al /dev
- If everything is in order, break the mirror:
# unmirrorvg rootvg hdisk_old
- List the logical volumes now associated with the old disk and the new one:
# lspv -l disk#
(run on both disks). - Migrate any logical volumes still associated with the old disk (probably lg_dumplv):
# migratepv -l lg_dumplv hdisk_old hdisk#
- Reduce the rootvg partition:
# reducevg rootvg hdisk_old
- Remove the disk:
rmdev -dl hdisk_old
- Remove the VTD associated with the disk from the VIO server(s):
$ rmvdev -vtd VTD_name_old
- 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