Friday, April 24, 2020

how to enable the failed path in aix?

How to enable the failed path in aix?



The below script (For Loop) will be used to Enabled the failed disk path in aix. 
You no need to worry about the disk name/number and then fscsi/vscsi details. You can simply execute the below script and the script itself can able to fetch the failed disks and its fscsi/vscsi details on the server and then enabled it smoothly.


for s in `lspath|grep -i failed|awk '{print $2'}`
do
chpath -l $s -p `lspath -l $s|grep -i failed|awk '{print $3'}` -s Enabled
done

(or)

for s in `lspath|grep -i failed|awk '{print $2'}`; do chpath -l $s -p `lspath -l $s|grep -i failed|awk '{print $3'}` -s Enabled; done


Thursday, April 23, 2020

WPAR cheat sheet in iax

WPAR cheat sheet in aix?


Action
Commands
To list wpar
# lswpar  (and)    # lswpar <wpar_name>
To list the detailed info about wpar
# lswpar -L <wpar_name>
To read the network info of wpar from GE
# lswpar -d '|' -N <wpar_name>
To view inf oabout devices that are exported and allocated to vwpar
# lswpar -D <wpar_name>
to list the longs outpout of vwpar from GE
# lswpar -L
To list the exported disk details to vwpar from GE
# lswpar -L|grep -p "DEVICE EXPORTS"
To list the important info about vwpar
# lswpar -G
To list out the flag details for the vwpar In lswpar
# lswpar -a
To stop system wpar in same way that shutdown command
# stopwpar -F <wpar_name>
To reboot vwpa
# stopwpar -F -r <wpar_name>
To rebooot vwpar from vwpar itself
 # reboot
To remove wpar
# rmwpar <wpar_name>
To stop a wpar before removing it
# rmwpar -s <wpar_name>
To confirm whether we are in GE or vwpar
# uname -W   (Value is 0 means GE, numeric value means vwpar)
To view wpar identification and processor information
# lparstat -w
To display the UUID of a WPAR
# lswpar -a UUID <wpar_name>
To login to the vwpar
# clogin <wpar_name>
To log into a system WPAR for different user
# clogin <wpar_name> -l username
To take backup
# /opt/rbos/networker/bin/lbackup-ge -pre
To take savewpar backup of vwpar
# savewpar -f /vwp01/<wpar_name>/backup/<wpar_name>.vwbck -I -e -x <wpar_name>
To restore vwpar from backup
# restwpar -f 'backup/<wpar_name>.vwbck' '-s' '-A'
To list out the processes details consuming for vwpar
# ps -ef@ <wpar_name>
How to take alt_disk for GE in wpar
# alt_disk_copy -B -u -d hdiskX
How to create ISO image from backup
# mkcd -L -S -I /repos/savevg/lparname/iso -m /repos/savevg/lparname/<backup_name>
How to create a filesystem in wpar from GE
# crfs -v jfs2 -g testvg -u testwpar -A no -a size=10M -m /wpars/testwpar/datafs
How to create a shared FS which can e used by GE and wpar
# crfs -v namefs -d /myfs -m /wpars/mywpar/myfs -u mywpar 
How to list the FS information of wpars from GE
# lswpar  #lswpar -M <wpar-name>
what is the configuration file for the vwpar
/vwp01/<vwpar_name>/etc
what is the location for devmap
# ls -l /etc/wpars/devmap
How to create a wpar
#mkwpar -n testwpar -h testwpar -N interface=en0 address=<ip_addr> 
netmask=255.255.255.0 -r -R shares_CPU=10 CPU=6%-30%,45%
 shares_memory=20 memory=5%-10%,20% totalProcesses=128 totalThreads=512 -A -s



Monday, April 20, 2020

New lpp_source creation using the old lpp_source in aix?

New lpp_source creation using the old lpp_source in aix?


The below steps clearly explain, how to create a new lpp_source with the help of existing lpp_source.
Here, I am planning to create a lpp_source for AIX 71TL05SP02 using the old lpp_source AIX71 TL04SP05.


Download the AIX 7.1.5.2 patch files (*.bff) from aix fixcentral and keep it on our server.
===========================================================================================
cd /patching/aix7152    --> (Here we can keep the AIX 7.1.5.2 path files (.bff) format))
inutoc .
ls -l .toc

Create a separate filesytem for the lppsource
==============================================
mklv -y lpplv -t jfs2 migrationvg 120
crfs -v jfs2 -d lpplv -A yes -m /export/lpp_source/aix7152_lppsource -a logname=INLINE -a logsize=245
mount /export/lpp_source/aix7152_lppsource

 Copy all the files from the current lpp_source which is aix7145_lppsource to the new created FS
================================================================================================
cp -rp /export/lpp_source/aix7145_lppsource* /export/lpp_source/aix7152_lppsource
cd /export/lpp_source/aix7152_lppsource/installp/ppc
chown root:system *
chmod 644 *

Define the new lpp_source directory as an lpp_source resource
==============================================================
nim -o define -t lpp_source -a server=master -a location=/export/lpp_source/aix7152_lppsource aix7152_lppsource

 Upgrade the lpp_source using the patch directory as a source of patches
=======================================================================
nim -o update -a packages=all -a source=/patching/aix7152 aix7152_lppsource
cd /export/lpp_source/aix7152_lppsource/installp/ppc
chown root:system *
chmod 644 *

 Remove the duplicate software and any superseded updates from new lpp_source
=============================================================================
nim -o lppmgr -a lppmgr_flgs="-bu -x -r -e" aix7152_lppsource
lsnim -l aix7152_lppsource  (** check the "Rstate" equals "Ready for use" and "simages" equals "yes"**)


**NOW UPGRADE THE SERVER USING THE NEWLY CREATED LPP_SOURCE and MAKE SURE ALL THE FILESETS ARE IN CONSISTENT STATE**


 Create SPOT from LPP_SOURCE
===========================
 Define spot
============
nim -o define -t spot -a server=master -a locatioin=/export/spot --a source=aix7152_lppsource aix7152_spot
lsnim -l aix7152_spot

Check if bos.alt_disk_install.rte is in spot
===========================================
nim -o showres aix7152_spot|grep -i bos.alt_disk_install.rte

Execute only if bos.alt_disk_install.rte not in spot
=====================================================
nim -o cust -a lpp_source=aix7152_lppsource -a filesets=bos.alt_disk_install.rte aix7152_spot

Check bos.alt_disk_install.rte installed now in spot
=====================================================
nim -o showres aix7152_spot|grep -i bos.alt_disk_install.rte



Saturday, April 18, 2020

How to get the status and configuration details of the SEA in aix?

How to get the status and configuration details of the SEA in aix?


Using the following commands, we can easily identify the configuration details and status of the SEA (Shared Ethernet Adapter) in aix.

# lsdev -cadapter


# entstat -d ent20 |grep -i state
# entstat -d ent20 |grep -i priority
# entstat -d ent20 |grep -i vlan
# entstat -d ent20 |grep -i pvid
# entstat -d ent20 |grep -i real
# entstat -d ent20 |grep -i link
# entstat -d ent20 |grep -i media
# entstat -d ent20 |grep -i trunk
 (or)
entstat -d ent20|egrep -i 'state|priority|vlan|pvid|real|link|media|trunk'


To Set ha_mode to standby on primary vios:

# chdev -l entX -a ha_mode=standby    (or)     $ chdev -dev entX -attr ha_mode=standby


To Reset it back to auto and the SEA should failback to the primary vios

# chdev -l entX -a ha_mode=auto   (or)    $ chdev -dev entX -attr ha_mode=auto


How to take the backupios command in aix?

How to take the backupios command in aix?


/usr/ios/cli/ioscli mount nimserver:/export/mksysbs /mnt 

/usr/ios/cli/ioscli backupios -file /mnt/viosbackup -mksysb

If you want to redirect the output to a file you must use the "tee" command instead of the ">"

Example: 

/usr/ios/cli/ioscli backupios -file /mnt/viosbackup -mksysb | tee /home/padmin/backupiosissues.log

How to change the padmin passwor in vio?

How to change the padmin passwor in vio?


The bootable media should be as the same version and release as the system.

Welcome to the Base OS Menu
start maintenance mode from the system recovery (3rd option)
Access root volume group (1st option)
Select 0 to continue
Select the proper vios rootvg for the vio partition
Access this volume group and start a shell (1st option)

Now you will get the prompt
passwd: padmin
padmin new passwd:
enter the new passwd again:
sync;sync;sync;reboot

Note: The bootable media can be "bootable vios installation cd-rom / bootable vios install tape / non_autoinstall mksysb.

How to change the reserve_policy to no_reserve to the secondary vios?

How to change the reserve_policy to no_reserve to the secondary vios?


On Client:

unmount /fs
varyoff datavg
rmdev -l hdisk2  (We need to set the disk as defined state)


Target VIO server:

lsmap -vadapter vhostX
rmvdev -vtd <vtd_name>
lsdev -dev hdiskX -attr
chdev -dev hdiskX -attr reserve_policy=no_reserve
lsdev -dev hdiskX -attr   (Now the reserve policy set to no_reserve)
mkvdev -vdev hdiskX -vadapter vhostX -dev <vtd_name>

On client:

cfgmgr
lsdev -Cc disk   (hdiskX should back available)
varyonvg datavg
mount /fs

Thursday, April 9, 2020

How to create a lppsource and spot on the nim server in aix?

How to create a lppsource on the nim server in aix?


The below steps clearly explains you to create a lppsource (aix71_TL4SP2_lppsource ) on the nim server using the similiar lppsource (which is already created succesfully) from some other nim servers.
so what we can do is, we can copy the content of the lppsource from other nim server and paste it on our target servers' filesystem and then define it as a lppsource resource.


create a separate filesystem for the lppsource in our target server
=========================================================

# mklv -y lpplv -t jfs2 testvg 120
# crfs -v jfs2 -d lpplv -A yes -m /lpp_source/aix71_TL4SP2_lppsource -a logname=INLINE -a logsize=245
# mount /lppsource/aix71_TL4SP2_lppsource
# df -gt /lppsource/aix71_TL4SP2_lppsource


Mount the similar aix71_TL4SP2_lppsource from another NIM server (named testnim) to our target Nim server
=======================================================================================

# mount testnim:/lpp_source/aix71_TL4SP2_lppsource /mnt


Copy all the files from the mounted lpp_source into the newly created filesystem
==================================================================

# cp -rp /mnt/aix71_TL4SP2_lppsource/* /lpp_source/aix71_TL4SP2_lppsource
# cd /lpp_source/aix71_TL4SP2_lppsource/installp/ppc
# chown root:system *
# chmod 644 *


Define the new lpp_source directory as an LPP_SOURCE resource
=====================================================
# nim -o define -t lpp_source -a server=master -a locatioin=/lpp_source/aix71_TL4SP2_lppsource aix71_TL4SP2_lppsource

# lsnim -l aix71_TL4SP2_lppsource   (** check the "Rstate" equals "ready for use" and "simages" equals yes**)



CREATE SPOT FROM NEW LPP_SOURCE
================================
 Define SPOT
===========

# nim -o define -t spot -a server=master -a location=/export/spot -a source=aix71_TL4SP2_lppsource aix71_TL4SP2_spot

# lsnim -l aix71_TL4SP2_spot    -> make sure the spot resource has been created.

 
Check if bos.alt_disk_install.rte is in spot
=============================================
# nim -o showres aix71_TL04SP2_spot|grep -i bos.alt_disk_install.rte

 "Execute only if bos.alt_disk_install.rte not in spot"  
#nim -o cust -a lpp_source=aix71_TL4SP2_lppsource -a filesets=bos.alt_disk_install.rte aix71_TL4SP2_spot

# nim -o showres aix71_TL4SP2_spot|grep -i bos.alt_disk_install.rte
# lsnim -l aix71_TL4SP2_spot


Migration concepts - How to update the existing lpp source with any additional filesets from the ISO iamges / DVD media in aix?

Migration concepts - How to update the existing lpp source with any additional filesets from the  ISO images in aix?


Implementation steps:

First copy the AIX710402 base iso images files to the target nim server using SCP.

  AIX_7.1_Base_7100-04-02_DVD_1_of_2_17226.iso
  AIX_7.1_Base_7100-04-02_DVD_2_of_2_17226.iso


1. Mount the iso images:
  # loopmount -i AIX_7.1_Base_7100-04-02_DVD_1_of_2_17226.iso -o "-V cdrfs -o ro" -m /mnt

2. Update the existing lpp source with any additonal filesets from the dvd media:
  # nim -o update -a show_progress=yes -a packages=all -a source=/mnt aix71_TL04_lppsource
  # cd /export/lpp_source/aix71_TL04_lppsource/installp/ppc
  # chown root:system *
  # chmod 644 *

(or)

smitty nim - perform nim admin tasks - manage resources - perform operations on resoruce - select aix71_TL04_lppsource - select "update=add or remove software to or from an lpp_source" -  select "Add" and enter the software media  source  
(Target lpp_source=aix71_TL04_lppsource; sources of software to add=/mnt; software packages to add: all)


Note down the list of packages that are being added to the lpp_source. We need this list if we were to backout.

3. Repeat step 1 and 2 for the second DVD image

4. Remove any duplicate software and superseded updates.

   # nim -o lppmgr -a lppmgr_glags="-bu-x-r" aix71_TL04_lppsource

(or)

# smitty nim - perform nim admin tasks - manage resources - perform operations on resoruce - select aix71_TL04_lppsource - select "lppmgr=eliminate unnecessasry software in an lpp_source"
(target lpp_source=aix71_TL04_lppsource; preview only:no; Remove duplicate software:yes; Remove superseded software:yes; Remove language software:no; Preserve lang: [C];  Remove non-simage software: no; Save removed files: no; directory for storing save files[]; Extend filesystem if space needed: yes)

5. Check the source "Rstate" equals "Ready for use" and "simages" equals "yes"

   # lsnim -l aix71_TL04_lppsource.

6. Update the SPOT resource (To make sure SPOT is in right state, check the SPOT resource and if required update or recreate it)

   # nim -o check -a show_progress=yes aix71_TL04_spot  
   # nim -o lppchk -a show_progress=yes aix71_TL04_spot
   # nim -o cust -a lpp_source=aix71_TL04_lppsource aix71_TL04_spot

if any of the above operation fails or give errors, remove the SPOT resource and recreate it from the updated lpp_source.

   # nim -o remove aix71_TL04_spot
   # nim -o define -t spot -a show_progress=yes -a server=master -a location=/export/spot/aix71_TL04_spot -a installp_flags=aQg -a source=aix71_TL04_lppsource aix71_TL04_spot


7. Check the source "Rstate" equals "Ready for use" and correct OS levels are reported.

    #lsnim -l aix71_TL04_spot


Wednesday, April 8, 2020

Migration issues - After the OS migration done, we could not able to ssh to the server?

Migration issues - After the OS migration done, we could not able to ssh to the server?


We could not able to ssh to the server once we migrated the server to AIX 7.1. Looks like there is a bug in AIX 7.1 ssh.

Please follow the below to fix the issue.


Problem:
=======

testlpar: # ssh root@testlpar2
Connection closed by testlpar2
testlpar: #


Solution:
=======

Take the backup of /etc/ssh/sshd_config file and please add "hostKeyAlgorithms +ssh-dss" to the /etc/ssh/sshd_config file, then you can able to ssh to the server witout any issues.

or

Take the backup of /etc/ssh/sshd_config file and please add "HostKey /etc/ssh/ssh_host_rsa_key" to the /etc/ssh/sshd_config file, then you can able to ssh to the server witout any issues.


Now try to ssh now!

testlpar: # ssh root@testlpar2
root@testlpar2's  password:



Migration issues - Server degraded but lppchk didn't show anything in aix?

Migration issues - Server degraded but lppchk didn't show anything in aix?


After the server migration done, the OS level is degraded to 7.1.3.4. when i checked the "lppchk -vm3" it did not show any output.

so I tried to check with oslevel -rl command and identified the issue. Here is the history and solution

testlpar: # oslevel -s
7100-03-04-1441
testlpar: #

testlpar: # lppchk -vm3      -> lppchk didn't show any error. looks like clean
testlpar: #

testlpar: # oslevel -rl 7100-05     -> This will clearly tell you where the issue is.
 Fileset                        Actual level  Recommended level
Java5.sdk                   5.0.0.570            5.0.0.620
testlpar: #

testlpar: # instfix -i|grep -i ml
.
.
Not all filesets for 7100-04_AIX_ML were found
Not all filesets for 7100-05_AIX_ML were found
testlpar: #


Solution:

It clearly says that the problem is with the java5.sdk filesets. Speak to IBM and get the Java5.sdk packages as it is not comes in default when you download the packages from fixcentral for the migration.

Keep the packages under /tmp/java_package directory

cd /tmp/java_packages
inutoc .
installp -acgXYd . java5.sdk
lppchk -vm3
oslevel -rl 7100-05    -> Now the oslevel will be in the expected desired level
instfix -i|egrep -i 'ml|sp'     -> All the ML and SP filesets were found.


Migration issues - lppchk issues after migration done in aix?

Migration issues - lppchk issues after migration done in aix?


testlpar: # lppchk -vm3

lppchk: The following filesets need to be installed or corrected to bring the system to a consistent state.

bos.ecc_client.rte 7.1.5.0     (usr: APPLIED, root: BROKEN)
rpm.rte            4.13.0.2    (usr: COMMITED, root: not installed)

testlpar: #


Solution:
=======

testlpar: # cd <directory of AIX 7.1.5.2 lppsource directory which you used for migratioin>

you may see the below files under it.

testlpar: # ls -al bos.ecc*
-rwxr-xr-x   1   root   system 2356343 APR 11 2020  bos.ecc_client.7.1.5.0.I
-rwxr-xr-x   1   root   system 2356343 APR 11 2020  bos.ecc_client.7.1.5.0.U
testlpar: # ls -al rpm*
-rwxr-xr-x   1   root   system 4832243 APR 11 2020  rpm.rte.4.13.0.2.I
testlpar: #


Then force re-isntall them as below.


testlpar: # installp -acFXYd ./ bos.ecc_client.rte
testlpar: # installp -acgNXYd ./ bos.ecc_client.rte 7.1.5.0
testlpar: # installp -acFXYd ./ rpm.rte

Then run "lppchk -vm3", it should be clean.


Pre-Post migration check-out -preparation in aix?

Pre-Post migration check-out -preparation in aix?


   Pre Migration check out


# lscfg |grep Architecture
System platform check - Only CHRP systems are supported in AIX 5.2 and above
# prtconf |grep 'Processor Type'
only 64-bit common hardware reference platform (CHRP) machines supported
# ls -al /dev/rootvg; ls -al /dev/hd5
verity the major number for /dev/rootvg and /dev/hd5 is 10.
# lslv -m hd5
Find out which disk contains your hd5 logical volume.
# bosboot -ad /dev/hdisk0; bosboot —ad /dev/ipldevice
verify boot image can be successfully recreated using the hdisk and by using /dev/ipldevice.
# lsvg -i rootvg|grep -i hd5; lsvg rootvg|grep SIZE
Currently the recommended allocated space to have for hd5 is 32mb
# lspv -M hdisk0|grep -i hd5
the hd5 lv covers the first or first 3 partitions on the disk based on the size. (Min is 32MB)
# bootinfo -r
To check the system has minimum memory (AIX 5.3 - 256MB, AIX 6.1/7.1 - 512MB)
# lppchk -vm3
lppchk command should be run to check system consistency
# instfix -i|egrep -i 'ml|sp'
To check currently Installed TL / SP filesets are consistent.
# lscfg -vl hdisk*|grep -i hdisk*
To get the disk location.
# emgr -l; emgr -r -L <efix>
Need to remove any efix applied on the systems.
# lspv|egrep -i 'alt|old|reserve|none'
To check any spare disks/reserved disk present on the system. you can see alt/old rootvg
# /usr/lpp/bos/pre_migration
Execute pre_migration script. output saved in /home/pre_migration.<date> directory.


"Note"
Take all the necessary checks/output like df -gt; netstat -nr; ifconfig -a;



    Post Migration checks out


# /usrlpp/bos/post_migration
To check that your migration was succsiful (all output will be saved in /home/post_migration.<date> directory.)
# lppchk -vm3
lppchk command should be run to check system consistency (no output is best)
# oslevel -s
To check the expected target level achieved.
# instfix -i|egrep -i 'ml|sp'
To check currently Installed TL / SP filesets are consistent.


Note
Filesets that did not migrate can now be migrated using a software source containing the software
 and running a smitty update_all