If you're planning to install fixes or filesets on your Virtual I/O (VIO) server, you can create a backup copy of the root volume group first using the VIO server command alt_root_vg. If your update of the VIO server fails for some reason, having the rootvg on an alternate disk provides a quick backout plan. If you need to, you can change the bootlist to use the backup disk and then reboot.
If you have two VIO servers in your configuration, you should be able to reboot one or the other VIO server without bringing down all the VIO client partitions. If you're unsure of the impact of rebooting a VIO server, check the VIO server documentation or refer to your next level of support.
Spare Disk
In order to create a clone of the VIO server rootvg, you need to find a spare disk. If your VIO rootvg has been mirrored, you may be happy to break the mirror for a short time so one of the disks can be used as the hot spare.
Log on to the VIO server as padmin, and check that you have a spare disk that is not a member of a volume group:
$ lspv
NAME PVID VG STATUS
hdisk0 00c5a47eb0bd79da rootvg active
hdisk1 00c5a47e02698ddf rootvg active
In this example, both disks belong to rootvg. This is because they were originally mirrored using the mirrorios command. If you have to break the mirror of the VIO server operating system to free up a disk, you can do that using unmirrorios. You can specify the Physical Volume you want to remove the mirror from, or just leave it blank and let unmirrorios choose. I'm going to remove the mirror copy from hdisk1, so that it can be used as the alternate rootvg disk.
For documentation on the mirrorios command and all the VIO server commands referred to in this article, see the resources section at the end of the article.
After the unmirrorios has been run, the physical volume needs to be removed from the root volume group.
$ reducevg rootvg hdisk1
$ lspv
NAME PVID VG STATUS
hdisk0 00c5a47eb0bd79da rootvg active
hdisk1 00c5a47e02698ddf None
When reducevg Fails
If the reducevg command fails, check for logical volumes that might still be using the disk. You can do that using the command lspv -lv hdiskN. Like most VIO server commands, the syntax is slightly different from the equivalent AIX lspv command.
You may need to move logical volumes off the disk you're planning as a spare. Look up the VIO server command migratepv for more details.
Creating the Clone
After running reducevg you should now have a free disk which is large enough to contain a clone of the rootvg. Creating the clone can be done with the alt_root_vg command. Remember, this command is run as the user padmin.
You’ll need to specify the target disk(s) you want to clone to. Use –target followed by the disk name.
alt_root_vg –target hdisk1
Here's what the output looks like:
alt_root_vg –target hdisk1
Calling mkszfile to create new /image.data file.
Checking disk sizes.
Creating cloned rootvg volume group and associated logical volumes.
Creating logical volume alt_hd5.
Creating logical volume alt_hd6.
Creating logical volume alt_paging00.
Creating logical volume alt_hd8.
Creating logical volume alt_hd4.
Creating logical volume alt_hd2.
Creating logical volume alt_hd9var.
Creating logical volume alt_hd3.
Creating logical volume alt_hd1.
Creating logical volume alt_hd10opt.
Creating logical volume alt_hd11admin.
Creating logical volume alt_livedump.
Creating logical volume alt_lg_dumplv.
Creating /alt_inst/ file system.
Creating /alt_inst/admin file system.
Creating /alt_inst/home file system.
Creating /alt_inst/opt file system.
Creating /alt_inst/tmp file system.
Creating /alt_inst/usr file system.
Creating /alt_inst/var file system.
Creating /alt_inst/var/adm/ras/livedump file system.
Generating a list of files
for backup and restore into the alternate file system...
Backing-up the rootvg files and restoring them to the alternate file system...
This can take quite a while. I created a clone of my newly installed VIO server, and it took just over an hour to copy from one SAS disk to another. The good news is that while the clone is being created, the original disk is still running a working VIO server, provided the VIO server isn't choked for I/O, CPU, or memory.
If you have a network connection to the VIO server, you can open a second session and watch progress using the df command. Each rootvg file system will have an alternative mount (prefixed with /alt_inst) and you can see how the restore is going.
Here's what the rest of that alt_root_vg command output looks like:
Modifying ODM on cloned disk.
Building boot image on cloned disk.
forced unmount of /alt_inst/var/adm/ras/livedump
forced unmount of /alt_inst/var/adm/ras/livedump
forced unmount of /alt_inst/var
forced unmount of /alt_inst/var
forced unmount of /alt_inst/usr
forced unmount of /alt_inst/usr
forced unmount of /alt_inst/tmp
forced unmount of /alt_inst/tmp
forced unmount of /alt_inst/opt
forced unmount of /alt_inst/opt
forced unmount of /alt_inst/home
forced unmount of /alt_inst/home
forced unmount of /alt_inst/admin
forced unmount of /alt_inst/admin
forced unmount of /alt_inst
forced unmount of /alt_inst
Changing logical volume names in volume group descriptor area.
Fixing LV control blocks...
Fixing file system superblocks...
Bootlist is set to the boot disk: hdisk1 blv=hd5
That last line shows that the bootlist is set to the alternate disk. If you want to boot off the original disk use the VIO server bootlist command. Once again, don't be trapped by the similarity to the AIX bootlist command. On the VIO server, you use -mode (not -m):
bootlist -mode normal hdisk0 hdisk1
You can list the bootlist with bootlist -ls. I wanted to verify the VIO server would boot off the alternate disk (hdisk1) so I didn't change the boot list.
At this point you should have two root volume groups:
# lspv
hdisk0 00c5a47eb0bd79da rootvg active
hdisk1 00c5a47e02698ddf altinst_rootvg
You can now start updates on the active rootvg, or reboot off whichever disk is first in the bootlist.
shutdown -restart
Shutting down the VIO Server could affect Client Partitions. Continue [y|n]?
y
After rebooting the VIO server off the alternate disk (hdisk1), the active rootvg disk is hdisk1, and the original disk is now called old_rootvg:
$ lspv
NAME PVID VG STATUS
hdisk0 00c5a47eb0bd79da old_rootvg
hdisk1 00c5a47e02698ddf rootvg active
Your VIO server now has a clone of the rootvg. This makes it easy to install updates on one or other rootvg. If you want to revert to the original disk, you can change the bootlist and then reboot the VIO server.
Reinstate Mirror
Once the updates or VIO server configuration changes are completed, you can remove references to the alternate rootvg and reinstate the mirror.
To remove the disk from the alternate volume group, use exportvg followed by the volume group name. You can then run the mirror of the volume group using mirrorios, but be warned: this automatically reboots the VIO server unless you use the -defer flag.
Resources:
Anthony English is an AIX / Power Systems engineer working in Sydney. Follow him on Twitter @AIXDownUnder.