Thursday, 28 June 2012

Cluster resource group fallover/fallback


Cluster resource group fallover/fallback

Use smitty to move a resource group between nodes in a cluster
smitty hacmp
                    HACMP for AIX

Move cursor to desired item and press Enter.

  Initialization and Standard Configuration
  Extended Configuration
  System Management (C-SPOC)
  Problem Determination Tools
Select "System Management"
----------------------------------------------------------------------------------------------------------------
         System Management (C-SPOC)

Move cursor to desired item and press Enter.

  Manage HACMP Services
  HACMP Communication Interface Management
  HACMP Resource Group and Application Management
  HACMP Log Viewing and Management
  HACMP File Collection Management
  HACMP Security and Users Management
  HACMP Logical Volume Management
  HACMP Concurrent Logical Volume Management
  HACMP Physical Volume Management

  Open a SMIT Session on a Node
Select "HACMP Resource Group and Application Management"
----------------------------------------------------------------------------------------------------------------
          HACMP Resource Group and Application Management

Move cursor to desired item and press Enter.

  Show the Current State of Applications and Resource Groups
  Bring a Resource Group Online
  Bring a Resource Group Offline
  Move a Resource Group to Another Node / Site

  Suspend/Resume Application Monitoring
  Application Availability Analysis
Select "Move a Resource Group to Another Node / Site"
----------------------------------------------------------------------------------------------------------------
           Move a Resource Group to Another Node / Site

Move cursor to desired item and press Enter.

  Move Resource Groups to Another Node
  Move Resource Groups to Another Site
Select "Move Resource Groups to Another Node"
----------------------------------------------------------------------------------------------------------------
     Select a Resource Group                      
                                                                         
 Move cursor to desired item and press Enter.                             
                                                                          
   #                                                                      
   # Resource Group                State                Node(s) / Site    
   #                                                                      
     app_rg                       ONLINE                node1 /         
     data_rg                      ONLINE                node2 /        
                                                                          
   #                                                                      
   # Resource groups in node or site collocation configuration:           
   # Resource Group(s)                           State    Node / Site  
   #  
Select the resource group to be moved.
----------------------------------------------------------------------------------------------------------------
     Select a Destination Node                         
                                                                          
  Move cursor to desired item and press Enter.                             
                                                                                                 
    # *Denotes Originally Configured Highest Priority Node                 
      node2   
      
Select a destination node.
----------------------------------------------------------------------------------------------------------------
         Move Resource Group(s) to Another Node

Type or select values in entry fields.
Press Enter AFTER making all desired changes.

                                                        [Entry Fields]
  Resource Group(s) to be Moved                       app_rg
  Destination Node                                    node2
Confirm the entry fields are correct and press Enter
----------------------------------------------------------------------------------------------------------------
  Command: OK            stdout: yes           stderr: no

Before command completion, additional instructions may appear below.

Attempting to move resource group app_rg to node node2.

Waiting for the cluster to process the resource group movement request....

Waiting for the cluster to stabilize........................................

Resource group movement successful.
Resource group app_rg is online on node2.


Cluster Name: node2

Resource Group Name: app_rg
Node                         State
---------------------------- ---------------
node2                       ONLINE
node1                       OFFLINE

Resource Group Name: data_rg
Node                         State
---------------------------- ---------------
node2                       OFFLINE
node1                       ONLINE
----------------------------------------------------------------------------------------------------------------
Whilst the resource group is being moved, open another terminal and monitor the log file /tmp/hacmp.out by typing the following.
tail -f /tmp/hacmp.out

Creating a snap for IBM analysis

snap -r

snap -e

To verify the snap
zcat snap.pax.Z | pax -vf -

To start the cluster services on a node use the following HACMP script

/usr/sbin/cluster/etc/rc.cluster
Nov 14 2009 12:36:09  Starting execution of /usr/sbin/cluster/etc/rc.cluster
with parameters:

Nov 14 2009 12:36:14  Checking for srcmstr active...
Nov 14 2009 12:36:14 complete.
 213174      -  0:00 syslogd
Setting routerevalidate to 1
Nov 14 2009 12:36:14
/usr/sbin/cluster/utilities/clstart : called with flags -m -G -A

Verifying Cluster Configuration Prior to Starting Cluster Services.

Verifying node(s): node2 against the running node node1


WARNING: The following resource type have the same resource name.
Resource name: cluster
Resource Types: Service IP Label and Application
WARNING: Having cluster resources with the same name can lead to confusion and
difficulties with cluster planning and administration. Cluster services may
not function properly if resources do not have unique names.

WARNING: Application monitors are required for detecting application failures
in order for HACMP to recover from them.  Application monitors are started
by HACMP when the resource group in which they participate is activated.
The following application(s), shown with their associated resource group,
do not have an application monitor configured:

  Application Server                Resource Group
  --------------------------------  ---------------------------------
   cluster                           cluster
WARNING: The LVM time stamp for shared volume group: datavg is inconsistent
with the time stamp in the VGDA for the following nodes:
node1

Successfully verified node(s): node2
0513-059 The topsvcs Subsystem has been started. Subsystem PID is 495748.
0513-059 The grpsvcs Subsystem has been started. Subsystem PID is 467176.
0513-059 The emsvcs Subsystem has been started. Subsystem PID is 409756.
0513-059 The emaixos Subsystem has been started. Subsystem PID is 401634.
Nov 14 2009 12:36:48

Completed execution of /usr/sbin/cluster/etc/rc.cluster
with parameters: .
Exit Status = 0.

Alternatively to start the cluster services on a node use smitty clstart

smitty clstart
Type or select values in entry fields.
Press Enter AFTER making all desired changes.

                                                        [Entry Fields]
* Start now, on system restart or both                now                                                                 
  Start Cluster Services on these nodes              [node1]                                                             
* Manage Resource Groups                              Automatically                                                       
  BROADCAST message at startup?                       false                                                               
  Startup Cluster Information Daemon?                 true                                                                
  Ignore verification errors?                         false                                                               
  Automatically correct errors found during           Interactively                                                       
  cluster start?
Modify the options as required such as the node to start the cluster services on and press return.
 
Starting Cluster Services on node: node1
This may take a few minutes.  Please wait...
node1: start_cluster: Starting HACMP
node1: 0513-029 The portmap Subsystem is already active.
node1: Multiple instances are not supported.
node1: 0513-029 The inetd Subsystem is already active.
node1: Multiple instances are not supported.
node1:    77872      -  0:00 syslogd
node1: Setting routerevalidate to 1
node1: 0513-059 The topsvcs Subsystem has been started. Subsystem PID is 585862.
node1: 0513-059 The grpsvcs Subsystem has been started. Subsystem PID is 860414.
node1: 0513-059 The emsvcs Subsystem has been started. Subsystem PID is 929926.
node1: 0513-059 The emaixos Subsystem has been started. Subsystem PID is 704586.
node1: 0513-059 The gsclvmd Subsystem has been started. Subsystem PID is 643118.
node1: 0513-059 The clinfoES Subsystem has been started. Subsystem PID is 794646.
node1: Mar  9 2010 17:10:25 Starting execution of /usr/es/sbin/cluster/etc/rc.cluster
node1: with parameters: -boot -N -A -i -C interactive -P cl_rc_cluster
node1:
node1: Mar  9 2010 17:10:34 Checking for srcmstr active...
node1: Mar  9 2010 17:10:34 complete.
node1: Mar  9 2010 17:10:34
node1: /usr/es/sbin/cluster/utilities/clstart: called with flags -m -G -i -P cl_rc_cluster -C interactive -B -A
node1:
node1:         Mar  9 2010 17:10:56
node1: Completed execution of /usr/es/sbin/cluster/etc/rc.cluster
node1: with parameters: -boot -N -A -i -C interactive -P cl_rc_cluster.
node1: Exit status = 0
node1:

To stop the cluster services on a node use the following HACMP script

/usr/sbin/cluster/etc/clstop

To start the clcomdES daemon

startsrc -s clcomdES

How to modify the heartbeat failure detection rate

This procedure should be done on an active HACMP node
1. Type smitty hacmp.
2. Go to Extended Configuration.
3. Select Extended Topology Configuration.
4. Select Configure HACMP Network Modules.
5. Select Change a Network Module using Predefined Values and press Enter. SMIT displays a list of defined network modules.
6. Select the name of the network module for which you want to see current settings and press Enter.
Type or select values in entry fields.
Press Enter AFTER making all desired changes.
                                                        [Entry Fields]
* Network Module Name                                 tmscsi
  Description                                         TMSCSI Serial protocol
  Failure Detection Rate                              Normal

  NOTE: Changes made to this panel must be
        propagated to the other nodes by
        Verifying and Synchronizing the cluster 
Change normal to slow if for instance you are experiencing network contention and the heartbeats are taking some time to complete.
Do not follow the above procedure on the other nodes in the cluster but instead synchronise the changes by completing the following procedure.
1. Type smitty hacmp.
2. Go to Extended Configuration.
3. Select Extended Verification and Synchronization.
4. Press Enter with the default settings.

Changing the location of HACMP log files

If you know the log file whose location you would like to change use the following command replacing 'clstrmgr.debug' as necessary.
/usr/es/sbin/cluster/utilities/cllog -c 'clstrmgr.debug' -v '/var/adm'
Use smitty if you are not sure of the current log file names and locations as follows.
smitty hacmp
                    HACMP for AIX

Move cursor to desired item and press Enter.

  Initialization and Standard Configuration
  Extended Configuration
  System Management (C-SPOC)
  Problem Determination Tools
Select "Problem Determination Tools"
----------------------------------------------------------------------------------------------------------------
               Problem Determination Tools



Move cursor to desired item and press Enter.

  HACMP Verification
  View Current State
  HACMP Log Viewing and Management
  Recover From HACMP Script Failure
  Restore HACMP Configuration Database from Active Configuration
  Release Locks Set By Dynamic Reconfiguration
  Clear SSA Disk Fence Registers
  HACMP Cluster Test Tool
  HACMP Trace Facility
  HACMP Event Emulation
  HACMP Error Notification
  Manage RSCT Services

  Open a SMIT Session on a Node
Select "HACMP Log Viewing and Management"
----------------------------------------------------------------------------------------------------------------
             HACMP Log Viewing and Management

Move cursor to desired item and press Enter.

  View/Save/Remove HACMP Event Summaries
  View Detailed HACMP Log Files
  Change/Show HACMP Log File Parameters
  Change/Show Cluster Manager Log File Parameters
  Change/Show a Cluster Log Directory
  Collect Cluster log files for Problem Reporting
Select "Change/Show a Cluster Log Directory"
----------------------------------------------------------------------------------------------------------------
              Select a Cluster Log Directory                      
                                                                         
  Move cursor to desired item and press Enter. Use arrow keys to scroll.   
                                                                                                 
  clstrmgr.debug           - Generated by the clstrmgr daemon            
  cluster.log              - Generated by cluster scripts and daemons    
  cluster.mmddyyyy         - Cluster history files generated daily       
  cspoc.log                - Generated by CSPOC commands                 
  emuhacmp.out             - Generated by the event emulator scripts     
  hacmp.out                - Generated by event scripts and utilities    
  clavan.log               - Generated by Application Availability Analy 
  clverify.log             - Generated by Cluster Verification utility   
  clcomd.log               - Generated by clcomd daemon                  
  clcomddiag.log           - Generated by clcomd daemon, debug informati 
  clconfigassist.log       - Generated by Two-Node Cluster Configuration 
  clutils.log              - Generated by cluster utilities and file pro 
  cl_testtool.log          - Generated by the Cluster Test Tool          
  autoverify.log           - Generated by Auto Verify and Synchronize    
  sa.log                   - Generated by Application Discovery  
Select a log file such as clstrmgr.debug
              Change/Show a Cluster Log Directory

Type or select values in entry fields.
Press Enter AFTER making all desired changes.

                                                        [Entry Fields]
  Cluster Log Name                                    clstrmgr.debug
  Cluster Log Description                             Generated by the clstrmgr daemon
  Default Log Destination Directory                   /tmp
* Log Destination Directory                          [/var/adm]
  Allow Logs on Remote Filesystems                    false    
Change the "Log Destination Directory" value
Do not follow the above procedure on the other nodes in the cluster but instead synchronise the changes by completing the following procedure.
1. Type smitty hacmp.
2. Go to Extended Configuration.
3. Select Extended Verification and Synchronization.
4. Press Enter with the default settings.

 * Source Article from : Internet

How to Add SAN or local volume in VIO Server and LPAR

The fact is, i'm still learning how to administer a IBM box.

The following procedure i am trying to record is very similar be it adding a partition that is SAN LUN or local disk. If in doubt, check using smitty.

The requirement for this is that all the disk or LUNs are presented to the VIO server before using VIO server to assign them as volumes to the LPARs.

If you have 2 VIO servers, which is usually the case for redundancy purpose, do this on both VIO server A good practice would be to mirror them at the LPAR level.

1) Log in to the VIO server. Verify if the disk or LUNs is visible to the VIO server

'Refresh' the device tree.
$ cfgdev

List out the PV. Those that are labeled as "None" are ones not assigned to any use yet.
$ lspv 

You can also double check using the "-free" option to list those that are not in use yet. This is only available in VIO in the restricted shell only.
$ lspv -free

2) Create VG in VIO server

Once the disk or LUNs is visible, go on to create VG. Notice that the PVID is randomly created for the disk or LUNs to uniquely identify them in the ODM.
$ mkvg -vg dbvg_clients hdisk8
dbvg_clients
0516-1254 mkvg: Changing the PVID in the ODM.

3) Next, Create LV in VIO server

Here we are creating the LV with "db_vg" LV name to the "dbvg_clients" VG name with 20Gb space from hdisk8.
$ mklv -lv db_vg dbvg_clients 20000M hdisk8
db_vg

4) Now, Assign the VG to the LPAR.

Create a virtual adapter in HMC to map to the LPAR, then reload in VIOS and assign the VG to the LPAR.
$ mkvdev -vdev db_vg -vadapter vhost5
vtscsi0 Available
 



For easy management you may want to separate the different VG that is assigned to the LPAR via the vhostX. i.e. rootvg assigned to vhost4 (myserver) and datavg assigned to vhost5 (myserver too). Also if there are multiple SAN devices you want to connect to, recommendation to use a different vhost so that in the event that you need to remove access to that SAN device, the virtual resources can be removed easily without downtime.
vhost is the "Virtual SCSI Server Adapter" that maps to the LPAR. To know which LPAR is mapped to which vhost, check the HMC.
In HMC, Select the LPAR > Hardware Information > Virtual I/O adapters > SCSI
Look for your host(s) in "remote partition" and note their 'vhost' number another way is to check from the VIO server.
$ lsmap -all | grep vhost | grep 0005
vhost4          U8233.E8B.1003D8P-V1-C40                     0x00000005
vhost5          U8233.E8B.1003D8P-V1-C41                     0x00000005
vhost12         U8233.E8B.1003D8P-V1-C42                     0x00000005

5) Lets login to the LPAR "vhost5" aka myserver.

Refresh the device tree.
# cfgmgr

The disk should now appear. Here, we see hdisk6
root@myserver:> lspv
hdisk0          00f603d83df2e2f6                    rootvg          active
hdisk1          00f603d843c55fa7                    rootvg          active
hdisk2          00f603d852925bfd                    oravg           active
hdisk3          00f603d891cf7b8a                    oravg2          active
hdisk4          00f603d852925c71                    oravg           active
hdisk5          00f603d891cf7c09                    oravg2          active
hdisk6          none                                None

6) Create VG in LPAR

We will create a VG using hdisk6. Noticed that the PVID is generated for the PV.
root@myserver:/> mkvg -y oravg3 hdisk6
0516-1254 mkvg: Changing the PVID in the ODM.
oravg3

7) Next, create LV in LPAR

The command below creates the LV named "oratmplv" belonging to oravg3 VG with 750 LP from hdisk6. As each LP is 256Mb, total LV size is 192Gb.
# /usr/sbin/mklv -y oratmplv -t jfs2 oravg3 750 hdisk6

8) Create journal log in LPAR if required.

Journal log partition is the log device used to provide the partition protection. It is used by OS to recover the partition when required.
This LV oratemplv has 3 LP from hdisk6.
# /usr/sbin/mklv -y oradjlogv3  -t jfs2log oravg3 3 hdisk6
General guide is 2Mb for every 1Gb or 1 partition per 512 partition as a baseline.
In some cases where the filesystem activities are too heavy or too frequent for the log device, you might wrap errors like the below in errpt
LABEL: J2_LOG_WAIT IDENTIFIER: CF71B5B3
LABEL: J2_LOG_WRAP IDENTIFIER: 061675CF

Increase the size of the journal log as follows
# extendlv  

Check and unmount the log device
# mount
# unmount /dev/

Format and mount back the log device
# logform /dev/
#mount 

My recommendation is to quieten the LV data partition before working on the LV journal log device.

9) Format the log device

We will use the log device as it is and not use it as "inline" for data LV. (Not required if you don't need to specify a separate log device)
root@myserver:/> logform  /dev/oradjloglv3
logform: destroy /dev/roradjloglv3 (y)?y

10) Create file-system with mount-point.

create mount-point.
# mkdir /opt/oracle11

We create the file system to mount to /opt/oracle11.

If you are using "smitty storage" to create file system, do the following
  • put in the log device in "Logical Volume for Log"
  • leave the "Inline Log size" blank.
Alternatively, use crfs with "-a logname='oradjloglv3'" or mkfs.
# mkfs -o log=/dev/oradjloglv3 -V jfs2 /dev/oratmplv

11) Mount the file system and ready for use.

Confirm file-system integrity
# fsck -p /dev/oratemplv

Then finally create mountpoint and mount the filesystem
# chown -R oracle:dba /opt/oracle11
# mount -o log=/dev/oradjloglv3 /dev/oratmplv /opt/oracle11
 


Remember to add into /etc/filesystem if you want to mount it after every restart.
If you used smitty to mount the filesystem, choose "Mount AUTOMATICALLY at system restart?" so that you don't need to meddle with the /etc/filesystem file.

How to disable first time password change in AIX


I'm new to AIX. Getting sick of AIX asking users for new password when you log in to the server for the first time ever after the setting the password using root. After some digging, this is due to the ADMCHD flag in /etc/security/password like below.
ahkow:
        password = Qpkm8APaNsdoI
        lastupdate = 1227154518
        flags = ADMCHG
Clear the ADMCHG flag of the user account with "pwdadm -c ".
> pwdadm -c ahkow
now the flag is gone. ahkow: password = Qpkm8APaNsdoI lastupdate = 1227154518

How to Configure Etherchannel in IBM AIX


EtherChannel and IEEE 802.3ad Link Aggregation are network port aggregation technologies that allow several Ethernet adapters to be aggregated together to form a single pseudo Ethernet device. For example, ent0 and ent1 can be aggregated into an EtherChannel adapter called ent2; interface ent2 would then be configured with an IP address. The system considers these aggregated adapters as one adapter. The switch side should be configured accordingly.

Considerations
    > Switch side configuration should be done prior to the the AIX side etherchannel configuration
    > All the adapters should have same speed and duplex settings
    > The interfaces, which are going to be part of etherchannel should be in down and detached state.(smitty chinet)

Bring down the interfaces, if they are active, also the devices should be in detached state.

# ifconfig en0 down detach
# ifconfig en1 down detach






Creating new Etherchannel adapter with smitty


# smitty etherchannel

       EtherChannel / IEEE 802.3ad Link Aggregation

Move cursor to desired item and press Enter.

  List All EtherChannels / Link Aggregations
  Add An EtherChannel / Link Aggregation 
<< SELECT, then Enter

  Change/Show Characteristics of an EtherChannel/Link Aggregation
  Remove An EtherChannel / Link Aggregation
  Force A Failover In An EtherChannel / Link Aggregation

 


F1=Help        F2=Refresh         F3=Cancel              F4=List
F5=Reset       F6=Command         F7=Edit                F8=Image
F9=Shell       F10=Exit           Enter=Do



Now the EtherChannel creation screen, you have to enter the interfaces, which are going to be part of EtherChannel. In my case it is ent0 and ent1. If you want to provide an Backup adapter, you can. EtherChannel will be resilient enough, in case of ent0 or ent1. If both fails, that case the Backup adapter comes into picture.


       Add An EtherChannel / Link Aggregation

Type or select values in entry fields.
Press Enter AFTER making all desired changes.

                                                 [Entry Fields]
  EtherChannel / Link Aggregation Adapters       ent0,ent1      +
  Enable Alternate Address                       no             +
  Alternate Address                              []             +
  Enable Gigabit Ethernet Jumbo Frames           no             +
  Mode                                           standard       +
  Hash Mode                                      default        +
  Backup Adapter                                                +
    Automatically Recover to Main Channel        yes            +
    Perform Lossless Failover After Ping Failure yes            +
  Internet Address to Ping                       []
  Number of Retries                              []            +#
  Retry Timeout (sec)                            []            +#


F1=Help         F2=Refresh        F3=Cancel          F4=List
F5=Reset        F6=Command        F7=Edit            F8=Image
F9=Shell        F10=Exit          Enter=Do


Press Enter



Find the newly created Etherchannel Adapter

# lsdev -Cc adapter -t ibm_ech
ent2 Available  EtherChannel / IEEE 802.3ad Link Aggregation




Setting IP Address for the newly created Etherchannel adapter

# smitty chinet

lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x                       Available Network Interfaces           x
x                                                              x
x Move cursor to desired item and press Enter.                 x
x                                                              x
x en0   1L-08   Standard Ethernet Network Interface            x
x en1   1j-08   Standard Ethernet Network Interface            x
x en2           Standard Ethernet Network Interface << SELECT  x
x et0   1L-08   IEEE 802.3 Ethernet Network Interface          x
x et1   1j-08   IEEE 802.3 Ethernet Network Interface          x
x et2           IEEE 802.3 Ethernet Network Interface          x
x                                                              x
x F1=Help                 F2=Refresh              F3=Cancel    x
x Esc+8=Image             Esc+0=Exit              Enter=Do     x
x /=Find                  n=Find Next                          x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

         




        Change / Show a Standard Ethernet Interface

Type or select values in entry fields.
Press Enter AFTER making all desired changes.

                                                  [Entry Fields]
  Network Interface Name                           en2
  INTERNET ADDRESS (dotted decimal)               [192.168.1.100]
  Network MASK (hexadecimal or dotted decimal)    [255.255.255.0]
  Current STATE                                    up          +
  Use Address Resolution Protocol (ARP)?           yes         +
  BROADCAST ADDRESS (dotted decimal)              []
  Interface Specific Network Options
     ('NULL' will unset the option)
    rfc1323                                       []
    tcp_mssdflt                                   []
    tcp_nodelay                                   []
    tcp_recvspace                                 []
    tcp_sendspace                                 []
  Apply change to DATABASE only                    no          +

F1=Help         F2=Refresh        F3=Cancel           F4=List
Esc+5=Reset     Esc+6=Command     Esc+7=Edit          Esc+8=Image
Esc+9=Shell     Esc+0=Exit        Enter=Do






Show the Etherchannel Adapter properties

# ifconfig -a

en2: flags=5e080863,c0<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),PSEG,LARGESEND,CHAIN>
        inet 192.168.1.100 netmask 0xffffff00 broadcast 192.168.1.255
         tcp_sendspace 131072 tcp_recvspace 65536 rfc1323 0
lo0: flags=e08084b<UP,BROADCAST,LOOPBACK,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT>
        inet 127.0.0.1 netmask 0xff000000 broadcast 127.255.255.255
        inet6 ::1/0
         tcp_sendspace 131072 tcp_recvspace 131072 rfc1323 1




         
# lsattr -El ent2

adapter_names   ent0,ent1      EtherChannel Adapters                       True
alt_addr        0x000000000000 Alternate EtherChannel Address              True
auto_recovery   yes            Enable automatic recovery after failover    True
backup_adapter  NONE           Adapter used when whole channel fails       True
hash_mode       default        Determines how outgoing adapter is chosen   True
mode            standard       EtherChannel mode of operation              True
netaddr         0              Address to ping                             True
noloss_failover yes            Enable lossless failover after ping failure True
num_retries     3              Times to retry ping before failing          True
retry_time      1              Wait time (in seconds) between pings        True
use_alt_addr    no             Enable Alternate EtherChannel Address       True
use_jumbo_frame no             Enable Gigabit Ethernet Jumbo Frames        True

Some Interview Questions

How would I know if I am running a 32-bit kernel or 64-bit kernel?
To display if the kernel is 32-bit enabled or 64-bit enabled, type:
bootinfo -K

How do I know if I am running a uniprocessor kernel or a multiprocessor kernel?
/unix is a symbolic link to the booted kernel. To find out what kernel mode is running, enter ls -l /unix and see what file/unix it links to. The following are the three possible outputs from the ls -l /unix command and their corresponding kernels:
/unix -> /usr/lib/boot/unix_up   # 32 bit uniprocessor kernel 
/unix -> /usr/lib/boot/unix_mp   # 32 bit multiprocessor kernel
/unix -> /usr/lib/boot/unix_64   # 64 bit multiprocessor kernel       

Note:
AIX 5L Version 5.3 does not support a uniprocessor kernel.
How can I change from one kernel mode to another?
During the installation process, one of the kernels, appropriate for the AIX version and the hardware in operation, is enabled by default. Use the method from the previous question and assume that the 32-bit kernel is enabled. Also assume that you want to boot it up in the 64-bit kernel mode. This can be done by executing the following commands in sequence:
ln -sf /usr/lib/boot/unix_64    /unix
ln -sf /usr/lib/boot/unix_64    /usr/lib/boot/unix

bosboot -ad  /dev/hdiskxx
shutdown -r

The /dev/hdiskxx directory is where the boot logical volume /dev/hd5 is located. To find out what xx is in hdiskxx, run the following command:
 lslv -m hd5
 

Note:
In AIX V5.2, the 32-bit kernel is installed by default. In AIX V5.3, the 64-bit kernel is installed on 64-bit hardware and the 32-bit kernel is installed on 32-bit hardware by default.
How do I know if my machine is capable of running AIX 5L Version 5.3?
AIX 5L Version 5.3 runs on all currently supported CHRP (Common Hardware Reference Platform)-based POWER™ hardware.
How do I know if my machine is CHRP-based?
Run the prtconf command. If it's a CHRP machine, the string chrp appears on the Model Architecture line.
How do I know if my System p machine (hardware) is 32-bit or 64-bit?
To display if the hardware is 32-bit or 64-bit, type:
bootinfo -y

How much real memory does my machine have?
To display real memory in kilobytes (KB), type one of the following:
bootinfo -r    

lsattr -El sys0 -a realmem 

Can my machine run the 64-bit kernel?
64-bit hardware is required to run the 64-bit kernel.
What are the values of attributes for devices in my system?
To list the current values of the attributes for the tape device, rmt0, type:
lsattr -l rmt0 -E

To list the default values of the attributes for the tape device, rmt0, type:
lsattr -l rmt0 -D

To list the possible values of the login attribute for the TTY device, tty0, type:
lsattr -l tty0 -a login -R

To display system level attributes, type:
lsattr -E -l sys0

How many processors does my system have?
To display the number of processors on your system, type:
lscfg | grep proc

How many hard disks does my system have and which ones are in use?
To display the number of hard disks on your system, type:
lspv

How do I list information about a specific physical volume?
To find details about hdisk1, for example, run the following command:
lspv hdisk1  
   

How do I get a detailed configuration of my system?
Type the following:
lscfg

The following options provide specific information:
-pDisplays platform-specific device information. The flag is applicable to AIX V4.2.1 or later.
-vDisplays the VPD (Vital Product Database) found in the customized VPD object class.
For example, to display details about the tape drive, rmt0, type:
lscfg -vl rmt0

You can obtain similar information by running the prtconf command.
How do I find out the chip type, system name, node name, model number, and so forth?
The uname command provides details about your system.
uname -pDisplays the chip type of the system. For example, PowerPC®.
uname -rDisplays the release number of the operating system.
uname -sDisplays the system name. For example, AIX.
uname -nDisplays the name of the node.
uname -aDisplays the system name, nodename, version, machine ID.
uname -MDisplays the system model name. For example, IBM, 9114-275.
uname -vDisplays the operating system version.
uname -mDisplays the machine ID number of the hardware running the system.
uname -uDisplays the system ID number.
What version, release, and maintenance level of AIX is running on my system?
Type one of the following:
oslevel -r

lslpp -h bos.rte

How can I determine which fileset updates are missing from a particular AIX level?
To determine which fileset updates are missing from 5300-04, for example, run the following command:
oslevel -rl 5300-04

What SP (Service Pack) is installed on my system?
To see which SP is currently installed on the system, run the oslevel -s command. Sample output for an AIX 5L Version 5.3 system, with TL4, and SP2 installed, would be:
oslevel –s
5300-04-02
   

Is a CSP (Concluding Service Pack) installed on my system?
To see if a CSP is currently installed on the system, run the oslevel -s command. Sample output for an AIX 5L Version 5.3 system, with TL3, and CSP installed, would be:
oslevel –s
5300-03-CSP
   

How do I create a file system?
The following command will create, within volume group testvg, a jfs file system of 10MB with mounting point /fs1:
crfs -v jfs -g testvg -a size=10M -m /fs1 
   

The following command will create, within volume group testvg, a jfs2 file system of 10MB with mounting point /fs2 and having read-only permissions:
crfs -v jfs2 -g testvg -a size=10M -p ro -m /fs2 
   

How do I change the size of a file system?
To increase the /usr file system size by 1000000 512-byte blocks, type:
chfs -a size=+1000000 /usr

Note:
In AIX V5.3, the size of a JFS2 file system can be shrunk, as well.
How do I mount a CD?
Type the following:
mount -V cdrfs -o ro /dev/cd0  /cdrom

How do I mount a file system?
The following command will mount file system /dev/fslv02 on the /test directory:
mount /dev/fslv02 /test 

How do I mount all default file systems (all standard file systems in the /etc/filesystems file marked by the mount=true attribute)?
The following command will mount all such file systems:
mount {-a|all}

How do I unmount a file system?
Type the following command to unmount /test file system:
umount /test

How do I display mounted file systems?
Type the following command to display information about all currently mounted file systems:
mount

How do I remove a file system?
Type the following command to remove the /test file system:
rmfs /test

How can I defragment a file system?
The defragfs command can be used to improve or report the status of contiguous space within a file system. For example, to defragment the file system /home, use the following command:
defragfs /home

Which fileset contains a particular binary?
To show bos.acct contains /usr/bin/vmstat, type:
lslpp -w /usr/bin/vmstat

Or to show bos.perf.tools contains /usr/bin/svmon, type:
which_fileset svmon

How do I display information about installed filesets on my system?
Type the following:
lslpp -l    
   

How do I determine if all filesets of maintenance levels are installed on my system?
Type the following:
instfix -i | grep ML

How do I determine if a fix is installed on my system?
To determine if IY24043 is installed, type:
instfix -ik IY24043

How do I install an individual fix by APAR?
To install APAR IY73748 from /dev/cd0, for example, enter the command:
instfix -k IY73748 -d /dev/cd0   
   

How do I verify if filesets have required prerequisites and are completely installed?
To show which filesets need to be installed or corrected, type:
lppchk -v

How do I get a dump of the header of the loader section and the symbol entries in symbolic representation?
Type the following:
dump -Htv

How do I determine the amount of paging space allocated and in use?
Type the following:
lsps -a

How do I increase a paging space?
You can use the chps -s command to dynamically increase the size of a paging space. For example, if you want to increase the size of hd6 with 3 logical partitions, you issue the following command:
chps -s 3 hd6   
   

How do I reduce a paging space?
You can use the chps -d command to dynamically reduce the size of a paging space. For example, if you want to decrease the size of hd6 with four logical partitions, you issue the following command:
chps -d 4 hd6   
   

How would I know if my system is capable of using Simultaneous Multi-threading (SMT)?
Your system is capable of SMT if it's a POWER5®-based system running AIX 5L Version 5.3.
How would I know if SMT is enabled for my system?
If you run the smtctl command without any options, it tells you if it's enabled or not.
Is SMT supported for the 32-bit kernel?
Yes, SMT is supported for both 32-bit and 64-bit kernel.
How do I enable or disable SMT?
You can enable or disable SMT by running the smtctl command. The following is the syntax:
smtctl [ -m off | on [ -w boot | now]]

The following options are available:
-m offSets SMT mode to disabled.
-m onSets SMT mode to enabled.
-w bootMakes the SMT mode change effective on next and subsequent reboots if you run the bosboot command before the next system reboot.
-w nowMakes the SMT mode change immediately but will not persist across reboot.
If neither the -w boot or the -w now options are specified, then the mode change is made immediately. It persists across subsequent reboots if you run the bosboot command before the next system reboot.
How do I get partition-specific information and statistics?
The lparstat command provides a report of partition information and utilization statistics. This command also provides a display of Hypervisor information.
How do I know if my volume group is normal, big, or scalable?
Run the lsvg command on the volume group and look at the value for MAX PVs. The value is 32 for normal, 128 for big, and 1024 for scalable volume group.
How can I create a volume group?
Use the following command, where spartition_size sets the number of megabytes (MB) in each physical partition where the partition_size is expressed in units of MB from 1 through 1024. (It's 1 through 131072 for AIX V5.3.) The partition_size variable must be equal to a power of 2 (for example: 1, 2, 4, 8). The default value for standard and big volume groups is the lowest value to remain within the limitation of 1016 physical partitions per physical volume. The default value for scalable volume groups is the lowest value to accommodate 2040 physical partitions per physical volume.
mkvg -y name_of_volume_group -s partition_size list_of_hard_disks

How can I change the characteristics of a volume group?
You use the following command to change the characteristics of a volume group:
chvg

How do I create a logical volume?
Type the following:
mklv -y name_of_logical_volume name_of_volume_group number_of_partition

How do I increase the size of a logical volume?
To increase the size of the logical volume represented by the lv05 directory by three logical partitions, for example, type:
extendlv lv05 3
   

How do I display all logical volumes that are part of a volume group (for example, rootvg)?
You can display all logical volumes that are part of rootvg by typing the following command:
lsvg -l rootvg

How do I list information about logical volumes?
Run the following command to display information about the logical volume lv1:
lslv lv1

How do I remove a logical volume?
You can remove the logical volume lv7 by running the following command:
rmlv lv7

The rmlv command removes only the logical volume, but does not remove other entities, such as file systems or paging spaces that were using the logical volume.
How do I mirror a logical volume?
  1. mklvcopy LogicalVolumeName Numberofcopies
  2. syncvg VolumeGroupName
How do I remove a copy of a logical volume?
You can use the rmlvcopy command to remove copies of logical partitions of a logical volume. To reduce the number of copies of each logical partition belonging to logical volume testlv, enter:
rmlvcopy testlv 2

Each logical partition in the logical volume now has at most two physical partitions.
Queries about volume groups
To show volume groups in the system, type:
lsvg

To show all the characteristics of rootvg, type:
lsvg rootvg

To show disks used by rootvg, type:
lsvg -p rootvg

How to add a disk to a volume group?
Type the following:
extendvg   VolumeGroupName   hdisk0 hdisk1 ... hdiskn 

How do I find out what the maximum supported logical track group (LTG) size of my hard disk?
You can use the lquerypv command with the -M flag. The output gives the LTG size in KB. For instance, the LTG size for hdisk0 in the following example is 256KB.
/usr/sbin/lquerypv -M hdisk0
256

You can also run the lspv command on the hard disk and look at the value for MAX REQUEST.
What does the syncvg command do?
The syncvg command is used to synchronize stale physical partitions. It accepts names of logical volumes, physical volumes, or volume groups as parameters.
For example, to synchronize the physical partitions located on physical volumes hdisk6 and hdisk7, use:
syncvg -p hdisk4 hdisk5   
   

To synchronize all physical partitions from volume group testvg, use:
syncvg -v testvg   
   

How do I replace a disk?
  1. extendvg VolumeGroupName hdisk_new
  2. migratepv hdisk_bad hdisk_new
  3. reducevg -d VolumeGroupName hdisk_bad
How can I clone (make a copy of) the rootvg?
You can run the alt_disk_copy command to copy the current rootvg to an alternate disk. The following example shows how to clone the rootvg to hdisk1.
alt_disk_copy -d  hdisk1

How can I display or set values for network parameters?
The no command sets or displays current or next boot values for network tuning parameters.
How do I get the IP address of my machine?
Type one of the following:
ifconfig -a

host Fully_Qualified_Host_Name

For example, type host cyclop.austin.ibm.com.
How do I identify the network interfaces on my server?
Either of the following two commands will display the network interfaces:
lsdev -Cc if

ifconfig -a

To get information about one specific network interface, for example, tr0, run the command:
ifconfig tr0

How do I activate a network interface?
To activate the network interface tr0, run the command:
ifconfig tr0 up

How do I deactivate a network interface?
For example, to deactivate the network interface tr0, run the command:
ifconfig tr0 down

How do I display routing table, interface, and protocol information?
To display routing table information for an Internet interface, type:
netstat -r -f inet

To display interface information for an Internet interface, type:
netstat -i -f inet

To display statistics for each protocol, type:
netstat -s -f inet

How do I record packets received or transmitted?
To record packets coming in and going out to any host on every interface, enter:
iptrace /tmp/nettrace

The trace information is placed into the /tmp/nettrace file.
To record packets received on an interface en0 from a remote host airmail over the telnet port, enter:
iptrace -i en0 -p telnet -s airmail /tmp/telnet.trace

The trace information is placed into the /tmp/telnet.trace file.
How do I create a workload partition?
To create a workload partition named temp with the IP Address xxx.yyy.zzz.nnn, type:
mkwpar -n temp -N address= xxx.yyy.zzz.nnn

To create a workload partition with the specification file wpar1.spec, type:
mkwpar -f /tmp/wpar1.spec

How do I create a new specification file for an existing workload partition wpar1?
To create a specification file wpar2.spec for an existing workload partition wpar1, type:
mkwpar -e wpar1 -o /tmp/wpar2.spec -w
    

How do I start a workload partition?
To start the workload partition called temp, type:
startwpar temp

How do I stop a workload partition?
To stop the workload partition called temp, type:
stopwpar temp

How do I view the characteristics of workload partitions?
To view the characteristics of all workload partitions, type:
lswpar

Name State Type Hostname  Directory     
---------------------------------------------------------------------------------
bar A S bar.austin.ibm.com /wpars/bar 
foo D S foo.austin.ibm.com /wpars/foo
trigger A A trigger   /

How do I log in to a workload partition?
To log in to the workload partition named wpar1 as user foo, type:
clogin wpar1 -l foo

How do I run a command in a workload partition?
To run the /usr/bin/ps command as user root in a workload partition named howdy, type:
clogin howdy -l root /usr/bin/ps 

How do I remove a workload partition?
To remove the workload partition called temp, type:
rmwpar temp

To stop and remove the workload partition called temp preserving data on its file system, type:
rmwpar -p -s temp

Note: Workload Partitions (WPARs), a set of completely new software-based system virtualization features, were introduced in IBM AIX Version 6.1.
How do I display virtual memory statistics?
To display a summary of the virtual memory statistics since boot, type:
vmstat

To display five summaries at 2-second intervals, type:
vmstat 2 5

To display a summary of the statistics for all of the workload partitions after boot, type:
vmstat -@ ALL

To display all of the virtual memory statistics available for all of the workload partitions, type:
vmstat -vs -@ ALL

How do I display statistics for all TTY, CPU, and Disks?
To display a single set of statistics for all TTY, CPU, and Disks since boot, type:
iostat

To display a continuous disk report at 2-second intervals for the disk with the logical name disk1, type:
iostat -d disk1 2

To display 6 reports at 2-second intervals for the disk with the logical name disk1, type:
iostat disk1 2 6

To display 6 reports at 2-second intervals for all disks, type:
iostat -d 2 6

To display only file system statistics for all workload partitions, type:
iostat -F -@ ALL

To display system throughput of all workload partitions along with the system, type:
iostat -s -@ ALL

How do I display detailed local and remote system statistics?
Type the following command:
topas

To go directly to the process display, enter:
topas -P

To go directly to the logical partition display, enter:
topas -L

To go directly to the disk metric display, enter:
topas -D

To go directly to the file system display, enter:
topas -F

How do I report system unit activity?
Type the following command:
sar

To report processor activity for the first two processors, enter:
sar  -u  -P 0,1

This produces output similar to the following:
cpu  %usr  %sys  %wio  %idle
0      45    45     5      5
1      27    65     3      5