Tanti Technology

My photo
Bangalore, karnataka, India
Sandeep Kumar | Founder, Tanti Technologies At Tanti Technologies, I share practical knowledge, hands-on tutorials, and real-world solutions across Python, SQL, Docker, Kubernetes, CI/CD, AWS, Azure, Machine Learning, Generative AI, and Agentic AI. My mission is to simplify complex technologies and provide actionable insights that help developers, engineers, and businesses learn faster, build better, automate smarter, and innovate with confidence. šŸš€ Learn • Build • Automate • Innovate Follow Tanti Technologies for practical technology insights and next-generation AI solutions.

Wednesday, 11 December 2013

Backing up your VIOS configuration with viosbr



I got to know about this command from Chris Gibson's blog, i would recommend all you AIX folks to visit his site once

Purpose of this command.

Performs the operations for backing up the virtual and logical configuration, listing the configuration, and restoring the configuration of the Virtual I/O Server.
 The viosbr command can be run only by the padmin user.

Pre –Reqs

This vios version should be at 2.1 with fixpack 22 applied on the server.
$ ioslevel
2.1.2.10-FP-22

For more information about the viosbr please check the man page, this will give you the default backup location and user defined location with the options.

$ viosbr -view -list
/home/padmin/cfgbackups/ not found


$ mkdir cfgbackups

$ viosbr -backup -file bvio83_vios_config_bkp

$ viosbr -view -list bvio83_vios_config_bkp.tar.gz
 A tar/gzipped file was created in the cfgbackups directory.
  

$ viosbr -view -file /tmp/bvio83_vios_config_bkp.tar.gz

 Controllers:
============
Name                Phys Loc
----                --------
iscsi0
sissas0             U78A5.001.WIH074C-P1-T5
pager0              U7998.61X.10071FA-V1-C7-L0-L0
vasi0               U7998.61X.10071FA-V1-C7
usbhc0              U78A5.001.WIH074C-P1
usbhc1              U78A5.001.WIH074C-P1
vbsd0               U7998.61X.10071FA-V1-C7-L0
usbhc2              U78A5.001.WIH074C-P1
sata0               U78A5.001.WIH074C-P1-T5
lhea0               U78A5.001.WIH074C-P1
ibmvmc0             U7998.61X.10071FA-V1-C2
ati0                U78A5.001.WIH074C-P1-C5-T1
fcs0                U78A5.001.WIH074C-P1-C6-T1
fcs1                U78A5.001.WIH074C-P1-C6-T2
vts0                U7998.61X.10071FA-V1-C10
fscsi0              U78A5.001.WIH074C-P1-C6-T1
ent0                U78A5.001.WIH074C-P1-T6
fscsi1              U78A5.001.WIH074C-P1-C6-T2
ent1                U78A5.001.WIH074C-P1-T7
ent2                U7998.61X.10071FA-V1-C3-T1
ent3                U7998.61X.10071FA-V1-C4-T1
ent4                U7998.61X.10071FA-V1-C5-T1
ent5                U7998.61X.10071FA-V1-C6-T1
sas0                U78A5.001.WIH074C-P1-T5

Physical Volumes:
=================
Name                Phys Loc
----                --------
hdisk0              U78A5.001.WIH074C-P1-D1
hdisk1              U78A5.001.WIH074C-P1-C6-T1-W500507630608059A-L4000402D00000000
hdisk2              U78A5.001.WIH074C-P1-C6-T1-W500507630608059A-L4000404B00000000
hdisk3              U78A5.001.WIH074C-P1-C6-T1-W500507630608059A-L4001404B00000000
hdisk4              U78A5.001.WIH074C-P1-C6-T1-W500507630608059A-L4001404C00000000
hdisk5              U78A5.001.WIH074C-P1-C6-T1-W500507630608059A-L4000408000000000
hdisk6              U78A5.001.WIH074C-P1-C6-T1-W500507630608059A-L4001408000000000

Optical Devices:
================
Name                Phys Loc
----                --------
cd0

Tape Devices:
=============
Name                Phys Loc
----                --------

Ethernet Interfaces:
====================
Name
----
en0
en1
en2
en3
en4
en5
en6

Storage Pools:
==============
SP Name                       PV Name
-------                       -------
rootvg                        hdisk0


Shared Ethernet Adapters:
=========================
Name                Physical Adapter    Default Adapter     Virtual Adapters
----                ----------------    ---------------     ----------------
ent6                ent0                ent2                ent2


Virtual Server Adapters:
========================
SVSA                Phys Loc                      VTD
----                --------                      ---
vhost0              U7998.61X.10071FA-V1-C11      vtscsi2
                                              vtscsi1
                                                                      vtscsi0

 The –mapping flag provided me with VTD and SEA mappings
(same as lsmap –all and lsmap –all –net)


 $ viosbr -view -file /tmp/bvio83_vios_config_bkp.tar.gz -mapping

SVSA                Physloc                            Client Partition ID
------------------- ---------------------------------- --------------------
vhost0              U7998.61X.10071FA-V1-C11           0x00000003
VTD                      vtscsi0
Status                   Available
LUN                      0x8200000000000000
Backing Device           hdisk1
Physloc                  U78A5.001.WIH074C-P1-C6-T1-W500507630608059A-L4000402D00000000

SVSA                Physloc                            Client Partition ID
------------------- ---------------------------------- --------------------
vhost0              U7998.61X.10071FA-V1-C11           0x00000003 VTD                      vtscsi1
Status                   Available
LUN                      0x8400000000000000
Backing Device           hdisk2
Physloc                  U78A5.001.WIH074C-P1-C6-T1-W500507630608059A-L4000404B00000000

SVSA                Physloc                            Client Partition ID
------------------- ---------------------------------- --------------------
vhost0              U7998.61X.10071FA-V1-C11           0x00000003 VTD                      vtscsi2
Status                   Available
LUN                      0x8100000000000000
Backing Device           hdisk5
Physloc                  U78A5.001.WIH074C-P1-C6-T1-W500507630608059A-L4000408000000000

SVEA    Physloc
------- ---------------------------------------
ent2    U7998.61X.10071FA-V1-C3-T1  
VTD                      ent6
Status                   Available
Backing Device           ent0
Physloc                  U78A5.001.WIH074C-P1-T6

 The –detail flag provided extended configuration information.
 $ viosbr -view -file /tmp/bvio83_vios_config_bkp.tar.gz -detail

Controllers:
============
Name                Phys Loc
----                --------
iscsi0
Attribute Name      Attribute Value
--------------      ---------------
initiator_name      iqn.bvio83.hostid.0a03496c

sissas0             U78A5.001.WIH074C-P1-T5
Attribute Name      Attribute Value
--------------      ---------------
bus_io_addr         0x80000000
intr_lsi            289
dual_init_cfg       default
serial_number       YL3000000001

pager0              U7998.61X.10071FA-V1-C7-L0-L0
vasi0               U7998.61X.10071FA-V1-C7
usbhc0              U78A5.001.WIH074C-P1
..etc..


The –type flag allows you to select details for a particular type of device for example, just SEA configuration information.

$ viosbr -view -file /tmp/bvio83_vios_config_bkp.tar.gz -type sea

Shared Ethernet Adapters:
=========================
Name                Physical Adapter    Default Adapter     Virtual Adapters
----                ----------------    ---------------     ----------------
ent6                ent0                ent2                ent2

 $ viosbr -view -file /tmp/bvio83_vios_config_bkp.tar.gz -type svsa

Virtual Server Adapters:
========================
SVSA                Phys Loc                      VTD
----                --------                      ---
vhost0              U7998.61X.10071FA-V1-C11      vtscsi2
                                                  vtscsi1
                                                  vtscsi0
Listing PV only information.

$ viosbr -view -file /tmp/bvio83_vios_config_bkp.tar.gz -type pv

Physical Volumes:
=================
Name                Phys Loc
----                --------
hdisk0              U78A5.001.WIH074C-P1-D1
hdisk1              U78A5.001.WIH074C-P1-C6-T1-W500507630608059A-L4000402D00000000
hdisk2              U78A5.001.WIH074C-P1-C6-T1-W500507630608059A-L4000404B00000000
hdisk3              U78A5.001.WIH074C-P1-C6-T1-W500507630608059A-L4001404B00000000
hdisk4              U78A5.001.WIH074C-P1-C6-T1-W500507630608059A-L4001404C00000000
hdisk5              U78A5.001.WIH074C-P1-C6-T1-W500507630608059A-L4000408000000000
hdisk6              U78A5.001.WIH074C-P1-C6-T1-W500507630608059A-L4001408000000000


The –restore and –validate flags validate the devices on the server against the devices in the backup file.

$ viosbr -restore -file bvio83_vios_config_bkp.tar.gz -validate

Dev name during BACKUP                  Is Valid?      Is Deployable?
======================                  =========      ==============
iscsi0                                  YES            NO
sissas0                                 YES            NO
pager0                                  YES            NO
vasi0                                   YES            NO
usbhc0                                  YES            NO
usbhc1                                  YES            NO
vbsd0                                   YES            NO
usbhc2                                  YES            NO
sata0                                   YES            NO
lhea0                                   YES            NO
ibmvmc0                                 YES            NO
ati0                                    YES            NO
fcs0                                    YES            NO
fcs1                                    YES            NO
vts0                                    YES            NO
fscsi0                                  YES            NO
ent0                                    YES            NO
fscsi1                                  YES            NO
ent1                                    YES            NO
ent2                                    YES            NO
ent3                                    YES            NO
ent4                                    YES            NO
ent5                                    YES            NO
sas0                                    YES            NO
hdisk0                                  YES            NO
hdisk1                                  YES            NO
hdisk2                                  YES            NO
hdisk3                                  YES            NO
hdisk4                                  YES            NO
hdisk5                                  YES            NO
hdisk6                                  YES            NO
en6                                     YES            NO
ent6                                    YES            NO
rootvg                                  YES            NO
vhost0                                  YES            YES

This tool looks like a great way to backup and restore your VIOS configuration.
 
Of course backupios will also do this but it will take an image of the entire system not just the virtual and logical mappings.
 
Maybe we could automate the configuration of a VIOS using this tool.

Patch Management in AIX

1 Preamble

2 Preinstallation checks
2.1 Check consistency and TL/ML
2.2 Check for applicability
2.3 Check rootvg
2.4 Check for cluster
3 Preinstallation tasks
3.1 Backup methods
3.2 Backup with alt_disk_install
3.3 Backup to tape
3.4 Backup to TSM
4 Installation of ML/TL, Service pack and APAR
5 Final notes
6 Conclusions

Preamble

This manual is directed to give some ideas and some framework for process of management of patches for AIX. In all the cases, not cover in this manual you should contact your local UNIX guru or search for help from consultant. Information in this article is based of AIX 5L v5.2 and 5.3. For Your version please refer appropriate manuals.

Preinstallation checks

Check consistency and TL/ML

Let's 1st check if packages, installed on the machine are OK

# lppchk -v

If you get report of something wrong try to get more info about the case and resolve the problem before continue with installation

# lppchk -v -m3

Check the current installed ML/TL

# instfix -i|grep ML
or
# instfix -i |grep TL

Keep the above information in file (not on the server, please)

Check for applicability

Check if APAR you want to install is applicable to your system. Check if fileset, mentioned in APAR is installed on your system

# lslpp -L

If not you can skip the rest of the document and feel happy, because it's need to do nothing on this machine :-) But if fileset is installed check if APAR is installed

# insfix -ivk

If it's installed be happy and jump to the next server, otherwise check if software is in use. For example you have installed drivers for ATM card, but you have no such card in the server or have installed software for IPsec, but not configured and not in use. In this case you can (again) be happy and continue with other task. Otherwise continue with steps in this document

Check rootvg
See if rootvg is mirrored and all lv's are mirrored correctly (excluding dump and boot volumes). If your rootvg is not mirrored you can skip later in document part for alt_disk_install, but in generally you should thing twice if situation like this is OK for business

# lsvg -p rootvg # lsvg rootvg # lsvg -l rootvg

Check for cluster

Check if the server is node of the cluster, because some of the operations can disrupt the proper work of cluster software

# smit hacmp

Check if the cluster processes are active

# lssrc -g cluster

Check if cluster software is installed

# lslpp -l | grep -i cluster   


Preinstallation tasks

Create a new LV to keep ML/TL, Service pack and APAR's you will download from IBM web site. Be aware this file system can need up to 3.6 gigabytes. If you do not have enough free LP you can use any (almost) already existing partition on the server or arrange some disk space on other machine and export it via NFS. After finish the installation do not forget to remove the LV or directory if you do not need the files for other installation. In case of usage of NFS you should be aware process of installation is slower and any network problem can disrupt your installation and put you in situation of recovery system from backup or alternate disk installation. Upload (download) in this directory TL (last one), Service pack (only last one) and APARs for prepare the installation. Extract them in current directory. because they normally come as tar.gz file use this trick to keep some diskpace

# gzip -d -c TL...tar.gz|tar xvf -

Sound's good to extract and install Service pack separately (in different directory)

Backup methods

For safe yourself from problems after installation, boot problems, etc you have few opportunities. I personaly know 3:
  • Make alternate disk installation. This is actually process of splitting mirrored rootvg, create "copy" of current installation to unused disk and add the second this in boot list to be sure you have working copy of your operating system in case of problem
  • if you have tape device on your server use mksysb to backup you rootvg on the tape and use this backup in case of problem
  • if you have in the network TSM (Tivoli Storage Manager) and NIM (Network Installation manager) servers installed you can backup system on the TSM and in case of problem reinstall operating system from NIM server

If you can't use any of the above methods you should be prepared for installation from CD/DVD of the entire operating system and recover it to the level to the situation before installation of APAR. Honestly speaking you can use mksysb, saving backup file on NFS mounted directory, but this will be no so helpful for easy and fast restore of the system

Backup with alt_disk_install

So lets start with the 1st method - alternate disk installation Remove the secondary dump device. On normal systems with mirrored rootvg exist 2 different dump devices. So to free one of the disks we should remove the dump device, resided on that disk. First we should find this device. To see the name of the secondary dump device

# lsvg -l rootvg | grep dump  

Then let's change the settings for secondary dump device to /dev/sysdumpnull . Do not use /dev/null

# smit dump
And now we can remove the dump Logical Volume

# smit lvm
Next step is to unmirror the rootvg. To do this we need to check which physical disks are included in rootvg. Here and below we assume disks, included in our rootvg are hdisk0 and hdisk1. In case of more that 2 disks in your rootvg process of doing this operation become more complex and it's out of scope of this document. The similar is the situation if you have many unmirrored LV in rootvg and the can't be allocated only to one PV.

# lsvg -p rootvg

Choose what disk to be leaved in rootvg based on free space, boot list and logical volumes that resign on only one of the disks

# lspv hdisk0 ; lspv hdisk1 ; lspv -l hdisk0 ; lspv -l hdisk1 

See the current bootlist

# bootlist -m normal -o

Remove the second disk from the mirror

# unmirrorvg rootvg hdisk1

Check if there are any LVs left on the second disk

# lspv -l hdisk1

And if exist migrate the remaining LVs to the first disk.

# migratepv hdisk1 hdisk0

Remove the second disk from the root VG. For do this it's need to clear the boot record of the second PV

# chpv -c hdisk1   

Check if the bootlist is set first to the disk with the current rootvg, and on second place the disk with the altinst_rootvg (and optionally cd0, if exist in current bootlist)

# bootlist -m normal hdisk0 hdisk1 
Add new boot image to the first PV to have “fresh” boot record and be not afraid of not boot from rootvg

# bosboot -ad /dev/hdisk0 

Removes the second PV from rootvg

# reducevg  rootvg hdisk1

Now we have one free PV on with we can create alternative disk installation. Now is time to check the existing FS and exclude the unnecessary ones from the backup, including the FS created for the download of the TL/ML. You can check if there is already an exclude list made for tape backup

# lsvg -l rootvg
# cat /etc/exclude.rootvg
# cp /etc/exclude.rootvg /etc/exclude.altdisk
# vi  /etc/exclude.altdisk

The file should look like this

/opt/myfiles/tmp/*

Do not put in exclude list /tmp, /var/tmp and similar directories, because this can cause problems if you will need to use alternate disk installation for recovery purpose. If you have names of LV more that 11 characters you should rename them to be no more that 11, because of limitation of software for alternate disk installation. To do this you should first unmount the filesystem, rename the LV and mount it again. You also should avoid naming VG, LV and devices starting with letters “alt” to avoid modification, deletion or damage the items mentioned above. The command to create alternate disk installation is sample, but you should be careful of syntax, because the results can be catastrophic

# nohup alt_disk_install -BC -e /etc/exclude.altdisk hdisk1 &
We put all in background to avoid disruption of operation in case of network problems. If you do not have/use exclude files you can omit -e key and path to exlude file. For more information about the command, please see “Commands Reference, Volume 1, a – c” of AIX OS. To monitoring the process of creation use

# tail -f nohup.out

After successful end of above operation you can test alternate disk installation (using wakeup key)

# alt_disk_install -W hdisk1

List the content of PV

# lspv -l hdisk1

And if everything is ok put the installation in “sleep”

# alt_disk_install -S

Backup to tape

The second way to backup our rootvg is to use mksysb utility. To do this we should be sure have tape device in the macine

# lsdev -Cc tape

And we have tape in to device

# tctl -f /dev/rmt0 rewind
or
# tctl -f /dev/rmt0 status

Alternatively you can use mt instead of tctl. Then we can create exclude list for filesystems we do not want to exist on the tape image

# vi  /etc/exclude.rootvg
After this we can run the backup from command line or via smit

#  smit mksysb

#  nohup mksysb -m -e -i /dev/rmt0 &

If your tape device is not /dev/rmt0 change it in above command. If you want to create image on NFS mounted directory do the above operations, changing the target device to file instead of tape device

# smit mksysb
# nohup /usr/bin/mksysb  '-m' '-e'  '-i' '-X' /backup/image_date  &

Backup to TSM

If You want to use TSM for backup use command

# smit sysback

For the rest of process consult your local storage/backup administrator and/or documentation


Installation of ML/TL, Service pack and APAR

Check for some processes you should stop by hand in time of installation to avoid problems and crashes like Oracle Database server, Tivoli Gateway or TEC server. Before start installation you should commit all the software, installed on the server to make easy roll-back in case of problem in time of installation

# smit commit
or
# installp -c all

Before install TM/ML and Service pack is wise to install installp software itself to have better overview later when you try to preview the process of installation of TL/ML

# smit install  -  bos.rte.install
or
# installp -a -g bos.rte.install

Next step is to update all the software from TL/ML and Service pack

# smit update_all

Do not forget to set only apply the package, but not commit and keep the copy of replaced files. After installation of packages check again your system:
# lppchk -v

# oslevel -r

# instfix -i|grep ML
or
# instfix -i|grep TL

# instfix -i|grep SP

# errpt |more

# bootlist –m normal -o

And if everything looks fine reboot your server

# shutdown -Fr

Final notes

Recreate the mirror of rootvg
After few days of stable work and some tests from application users it's time to recreate mirror of rootvg (if you are using this way of backup). Let's destroy alternate disk installation

# alt_disk_install -X

Check which harddisk was previously included in rootvg, and add it

# extendvg -f rootvg hdisk1

Recreate secondary dump device. Extract the name and size of the primary dump device

# lsvg –l rootvg

Calculate the size of the necessary paging space with the command (in some cases is good idea to consult with your application administrators and to increase the size of secondary dump device):

# sysdumpdev -e

Create LV similar to the first one with type of LV sysdump

# smit lvm

Do not forget to change the secondary dump device from /dev/sysdumpnull to freshly created one

# smit dump  

Then you can mirror rootvg. To avoid “locking” of your terminal set process in background

# smit lvm

# nohup mirrorvg  '-S'  rootvg  hdisk1 &

Create boot image on hdisk1

# bosboot -ad /dev/hdisk1

Add hdisk1 to bootlist

# bootlist -m normal hdisk0 hdisk1

Please check the bootlist you get when you check the machine before installation and add other devices to the bootlist if it's necessary. Synchronize LVs on both disks

# nohup syncvg  -v rootvg &

Conslusion

This manual is not directed to replace your company policies/procedures, but give you tested way to do the work :-)