Skip to main content

HMC Commands



  1. for system in `lssyscfg -r sys -F "name,state" | sort | grep ",Operating" | sed 's/,Operating//'`; do
  2.     echo $system
  3.     echo "    LPAR            CPU    VCPU   MEM    OS"
  4.     for lpar in `lssyscfg -m $system -r lpar -F "name" | sort`; do
  5.         default_prof=`lssyscfg -r lpar -m $system --filter "lpar_names=$lpar" -F default_profile`
  6.         procs=`lssyscfg -r prof -m $system --filter "profile_names=$default_prof,lpar_names=$lpar" -F desired_proc_units`
  7.         vcpu=`lssyscfg -r prof -m $system --filter "profile_names=$default_prof,lpar_names=$lpar" -F desired_procs`
  8.         mem=`lssyscfg -r prof -m $system --filter "profile_names=$default_prof,lpar_names=$lpar" -F desired_mem`
  9.         os=`lssyscfg -r lpar -m p520 --filter "lpar_names=$lpar" -F os_version`
  10.         printf "    %-15s %-6s %-6s %-6s %-30s\n" $lpar $procs $vcpu $mem "$os"
  11.     done
  12. done


This example script loops through every managed system and every LPAR.  For each LPAR it gets the CPU, Virtual CPU, and Memory settings from the profile and the OS version from lssyscfg.   It then prints it out in a formatted output (this HMC only has 1 managed frame so the output is pretty brief):  
  1. hscroot@hmc1:~> source testscript
  2. p520
  3.     LPAR            CPU    VCPU   MEM    OS
  4.     aix1            0.2    2      384    AIX 6.1 6100-07-05-1228      
  5.     aix2            0.2    2      384    AIX 6.1 6100-07-05-1228      
  6.     aix3            0.2    2      384    Unknown                      
  7.     linux1          0.2    2      384    Unknown                      
  8.     vio1            0.2    2      512    VIOS 2.2.1.4                  
  9.     vio2            0.2    2      400    Unknown        

Compare LPAR running config / profile config

 A new version of prdiff is available that now includes support for Virtual Fibre Channel / NPIV and also improved dedicated CPU support.  For those of you unfamiliar with prdiff it is a script that compares running LPAR configurations with their profiles and shows differences.   This can prevent issues when you are shutting down and rebooting LPAR's.  For more info, see http://prdiff.sourceforge.net/







WWPN of virtual fiber card on LPARs

The below command from HMC will list the WWPN of virtual fiber card on LPARs only.
I am interested in finding wwpn of physical HBAs allocated in VIO and physical to virtual hba relation for each LPAR.

lssyscfg -r sys -F name |
while read M; do lshwres -r virtualio --rsubtype fc --level lpar -m $M -F lpar_name,wwpns|
sed 's/^/'$M,'/'
done


WWPN of physical HBA's are not stored on HMC, so you have to log in to VIO server to find these out.

Reset padmin VIO password from the HMC with zero downtime

Step 1
Find the current padmin password hash.   From the HMC, type (change "-m p520 -p vio1" to your managed system / VIO server names)




command=`printf "oem_setup_env\ncat /etc/security/passwd"`; viosvrcmd -m p520 -p vio1 -c "$command"
Look for the padmin stanza and its password hash:

 padmin:
    password = TRl01MDd3QnVw
    lastupdate = 1352950198

Step 2:  Generate a new password hash.   From a different AIX server that has openssh/openssl installed, type "openssl passwd"  and type in the new password that you want to assign to the padmin account.  Openssl will generate the password hash and display it on the screen. 

 # openssl passwd
Password:
Verifying - Password:
OSdD0E9SQYE.E

Step 3:   Replace the VIO padmin's password hash with the new password hash from the HMC using viosvrcmd/perl.   Use a command similiar to this from the HMC:

command=`printf "oem_setup_env\nperl -pi -e 's/<OLD_HASH>/<NEW_HASH>/' /etc/security/passwd"`; viosvrcmd -m p520 -p vio1 -c "$command"
In our example, it would be (make sure to change "-m p520 -p vio1" to your managed system / VIO names)


 command=`printf "oem_setup_env\nperl -pi -e 's/TRl01MDd3QnVw/OSdD0E9SQYE.E/' /etc/security/passwd"`; viosvrcmd -m p520 -p vio1 -c "$command"
Step 4:  Optionally reset padmin failed login count.   If you need to reset the failed login count, run this command from the HMC:  (make sure to change "-m p520 -p vio1" to your managed system / VIO names)
command=`printf "oem_setup_env\nchsec -f /etc/security/lastlog -a unsuccessful_login_count=0 -s padmin"`; viosvrcmd -m p520 -p vio1 -c "$command"

Comments

  1. Hello, i need your help. I need to reset the padmin password, but this commands doesn't work

    ReplyDelete
    Replies
    1. I have the same problem. I need to recover or reset my padmin password.

      Delete

Post a Comment

Popular posts from this blog

Buffer to Buffer credits Define the maximum amount of data that can be sent prior to an acknowledgement Buffer credits are physical ASIC port or card memory resources and are finite in number as a function of cost Within a fabric, each port may have a different number of buffer credits The number of available buffer credits is communicated at fabric logon (FLOGI) One buffer credit allows a device to send one 2112 byte frame of data Before any data frames are sent, the transmitter sets a counter equal to the BB-credit value. For each data frame sent by the transmitter, the counter is decremented by one. Upon receipt of a data frame, the receiver sends a status frame (R_RDY) to the transmitter indicating that the data frame was received AND the buffer can receive another data frame. For each R_RDY received by the transmitter, the counter is incremented by one. BB_Credits are the “admission control” mechanism in FC to ensure that FC switches don’t run out of buffers ...

(SR-IOV) - Single Root I/O Virtualization (SR-IOV)

http://blog.scottlowe.org/2009/12/02/what-is-sr-iov/