Friday, June 15, 2012

Setting up NIM Server

 Setting up NIM Master server: used AIX 7 but pretty much works the same for AIX 5 & 6
Install NIM Filesets(Client, Master and SPOT)
# smitty install_latest


Create Volume Group, loglv, and filesystem for NIM resources
# mkvg -f -S -s 128 -y nim_vg hdisk3
# mklv -t jfs2log -y nim_jfs2log nim_vg 1
# logform /dev/nim_jfs2log
# mklv -t jfs2 -y nim_base nim_vg 2
# crfs -v jfs2 -d /dev/nim_base -m /nim -p rw -A yes -u NIM
# mount /nim

Create Filesystem for Installation Images
# mklv -t jfs2 -y nim_images nim_vg 100
nim_images
# crfs -v jfs2 -d /dev/nim_images -m /nim/images -p rw -A yes -u NIM
File system created successfully.
13106596 kilobytes total disk space.
New File System size is 26214400
# mount /nim/images


Create Filesystem for LPP Sources
# mklv -t jfs2 -y nim_lppsrc nim_vg 100
nim_lppsrc
# crfs -v jfs2 -d /dev/nim_lppsrc -m /nim/lppsource -p rw -A yes -u NIM
File system created successfully.
13106596 kilobytes total disk space.
New File System size is 26214400
# mount /nim/lppsource


Creat Filesystem for SPOTS
# mklv -t jfs2 -y nim_spot nim_vg 30
nim_spot
# crfs -v jfs2 -d /dev/nim_spot -m /nim/spot -p rw -A yes -u NIM
File system created successfully.
3931836 kilobytes total disk space.
New File System size is 7864320
# mount /nim/spot


Verify the Filesystems Created
# df
Filesystem    512-blocks      Free %Used    Iused %Iused Mounted on
/dev/hd4          917504    341240   63%    11455    21% /
/dev/hd2        16646144    329032   99%    49881    54% /usr
/dev/hd9var      1179648    356512   70%     8470    17% /var
/dev/hd3         1966080   1949800    1%       99     1% /tmp
/dev/fwdump       262144    261448    1%        4     1% /var/adm/ras/platform
/dev/hd1          131072    103728   21%       25     1% /home
/dev/hd11admin     262144    261384    1%        7     1% /admin
/proc                  -         -    -         -     -  /proc
/dev/hd10opt      917504    540312   42%     7173    11% /opt
/dev/livedump     524288    523552    1%        4     1% /var/adm/ras/livedump
/dev/nim_base     524288    523488    1%        7     1% /nim
/dev/nim_images   26214400  26209744    1%        4     1% /nim/images
/dev/nim_lppsrc   26214400  26209744    1%        4     1% /nim/lppsource
/dev/nim_spot    7864320   7862464    1%        4     1% /nim/spot


 Initialize NIM
To initiatize nim on the server with IP: 10.62.137.109 & NetMask: 255.255.255.0, run the following
 # nimconfig -a netname=net_10_62_137 -a pif_name=en0 -a netboot_kernel=64 -a c>
0513-071 The nimesis Subsystem has been added.
0513-071 The nimd Subsystem has been added.
0513-059 The nimesis Subsystem has been started. Subsystem PID is 6946994.

Upon Initializing NIM, some base resources are created as shown below
# lsnim
master           machines        master
boot             resources       boot
nim_script       resources       nim_script
net_10_62_137     networks        ent

Create Basic NIM Resources
Following basic resources must be created.
  • an LPP source (NIM object of type lppsource)
  • a SPOT (NIM object of type spot)
  • NIM scripts (NIM objects of type script and fb_script
Creating LPP Source from AIX 7 DVD
For creating an LPP source from an AIX 7.1 installation DVD.We copy the files to our target filesystem (/nim/lppsource) using bffcreate. Since we want to be able to serve more than one LPP source we decide to store the files in a subfolder LPP71_TL00:  
# mkdir /nim/lppsource/LPP71_TL00 
# smitty bffcreate
 

I have downloaded the TL  filesets under /datafs/ for AIX 7100-01-00-1140.. We now copy the filesets into the LPP source. Please note the target directory should be /nim/lppsource/LPP71_TL00/installp/ppc

# smitty bffcreate


I have downloaded Service pack: 7100-01-01-1141 and ran smitty bffcreate again for updating service pack
# smitty bffcreate


Define LPP Source
# cd /nim/lppsource/LPP71_TL00/installp/ppc
# inutoc .
# nim -o define -t lpp_source \
> -a server=master \
> -a location=/nim/lppsource/LPP71_TL00 \
> -a comments='Full AIX 7100-01-03 Source' \
> lpp_aix710

Preparing to copy install images (this will take several minutes)...

Now checking for missing install images...
All required install images have been found. This lpp_source is now ready.

Save some space by  removing superseeded filesets  : You can remove Language software by selecting yes if you don't want to keep language software.



Create SPOT  from LPP source:
 

Create Installation Image 
This is an option step needed if you want to install servers from mksysb image instead of using lpp source. If you want to define mksysb resource, create mksysb from existing AIX7 installation, copy it over to NIM Master. If you do not have any AIX 7 in your environment, then create an installation from lppsource on a spare lpar, customize it and create mksysb or create mksysb from the nim master before configuring the nim master..
After you have a mksysb image of AIX 7, you can define the mksysb nim resource as below
# nim -o define -t mksysb \
-a server=master \
-a comments='MKSYSB AIX 7 Installation - Created <DATE> \
-a location=/nim/install_mksysbimages/mksysb_aix7 \
mksysb_aix7


Create Scripts
If you have customization scripts like   first boot script called fboot_aix7.sh and a postinstall script called pboot_aix7.sh in place, then we have to define two more NIM resources:

Firstboot Script
# vi fboot_aix7.sh
# chmod ug+x fboot_aix7.sh
# nim -o define -t fb_script \
            -a server=master \
            -a comments='Firstboot script for AIX 7' \
            -a location=/nim/scripts/fboot_aix7.sh \
          fb_aix7

Postinstall Script

# vi pboot_aix7.sh
# chmod ug+x pboot_aix7.sh
# nim -o define -t script \
            -a server=master \
            -a comments='Postinstall script for AIX 7 installations' \
            -a location=/nim/scripts/
pboot_aix7.sh \
          script_aix7_post


 This completes the NIM Master setup, then do the followingon Nim Master to

Define a client: use smitty nim->Perform Nim Admin Tasks->Manage Machines->Define a Machine or command line as below.
#nim -o define -t standalone -a platform=chrp -a netboot_kernel=64 -a if1="net_10_62_137 -a cable_type1=tp <client>" <client>
 Allocate resources:
# nim -o allocate -a spot=spot_aix710 -a lpp_source=LPP71_TL00 <ClientName>
Initialize lpp installation:
nim -o bos_inst -a spot=spot_aix710 -a lpp_source=LPP71_TL00 -a no_client_boot=yes -a accept_licenses=yes <client>
If the installation Fails and you have to restart installation, deallocate all resources before reallocating
# nim -Fo deallocate -a subclass=all <ClientName> 

Other useful commands and resources


Tuesday, May 1, 2012

Update DNS Server Entries on Multiple Servers

Recently we had upgraded our Windows 2000 Domain Controllers with Windows 2008 Domain Controllers and had to replace the DNS Servers  listed in Network Properties across all the member servers running windows 2000, Windows 2003 & Windows 2008 Servers. I created the following script to replace DNS Entries.. Replace "a.b.c.d"  with the actual dns server IP's in the script, create a file "d:\DNS_Order\servers.txt" with the server names listed in it. I ran it from command line as below: test.txt will record the output from the script which lists the DNS Entries of each and every server before and after completing the replacement..

C:\ cscript dns_replace_Serversfile.vbs >test.txt

dns_replace_Serversfile.vbs
Const ForReading = 1
Set objNetwork = CreateObject("Wscript.Network")
'Open the File System Object to Feed the Script
Set objFSO = CreateObject("Scripting.FileSystemObject")

'This line needs to be customized for the servers.txt localtion text file
Set objTextFile = objFSO.OpenTextFile ("d:\DNS_Order\servers.txt", ForReading)

'Starts the process reading thru the input file line by line until EOF
Do Until objTextFile.AtEndOfStream
strComputer = objTextFile.ReadLine
Wscript.Echo ""
Wscript.Echo "********************** Gathering Data On **********************"
Wscript.Echo " Computer Name From TXT File : "& strComputer
Wscript.Echo "********************** Gathering Data On **********************"


On Error Resume Next


arrNewDNSServerSearchOrder = Array("a.b.c.d", "a.b.c.d1", "a.b.c.d2", "a.b.c.d3")

Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colNicConfigs = objWMIService.ExecQuery _
 ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")

WScript.Echo VbCrLf & "Computer: " & strComputer

For Each objNicConfig In colNicConfigs
  WScript.Echo VbCrLf & "  Network Adapter " & objNicConfig.Index
  WScript.Echo "    DNS Server Search Order - Before:"
  If Not IsNull(objNicConfig.DNSServerSearchOrder) Then
    For Each strDNSServer In objNicConfig.DNSServerSearchOrder
      WScript.Echo "        " & strDNSServer
    Next
  End If
  intSetDNSServers = _
   objNicConfig.SetDNSServerSearchOrder(arrNewDNSServerSearchOrder)
  If intSetDNSServers = 0 Then
    WScript.Echo "    Replaced DNS server search order list."
  Else
    WScript.Echo "    Unable to replace DNS server search order list."
  End If
Next

WScript.Echo VbCrLf & String(80, "-")

Set colNicConfigs = objWMIService.ExecQuery _
 ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")

For Each objNicConfig In colNicConfigs
  WScript.Echo VbCrLf & "  Network Adapter " & objNicConfig.Index
  WScript.Echo "    DNS Server Search Order - After:"
  If Not IsNull(objNicConfig.DNSServerSearchOrder) Then
    For Each strDNSServer In objNicConfig.DNSServerSearchOrder
      WScript.Echo "        " & strDNSServer
    Next
  End If
Next
Loop

Thursday, April 26, 2012

Update AIX 7.1 Service Packs

Make sure that all current filesets are commited by running installp -s or lslpp -l
# installp -s
   installp:  No filesets were found in the Software
        Vital Product Database in the APPLIED state.
To cleanup  the repository images of your installation directory. If you have committed all the fixes and don't need these files anymore..
#/usr/lib/instl/lppmgr -d /usr/sys/inst.images -l -b -x  -r -e
  lppmgr: Source table of contents location is /usr/sys/inst.images/.toc
  lppmgr: Building table of contents in /usr/sys/inst.images ..
  dsm.core.7.1.1.1.U
  mcr.rte.7.1.1.1.U
  security.pkcs11.7.1.1.1.U
  sysmgt.cfgassist.7.1.0.15.U
======================== end list ==============================

Run the inutoc command, this creates the .toc file in Directory. If a .toc file already exists, it is recreated with new information. The default installation image Directory is/usr/sys/inst.images. The inutoc command adds table of contents entries in the .toc file for every installation image in Directory. To create .toc file for /usr/sys/inst.images
# inutoc /usr/sys/inst.images
Optional--Not needed to run --To rename the downloaded files to their fileset name, run the bffcreate command. After renaming the files, run the inutoc command again.
# bffcreate -c -d /usr/sys/inst.images
# inutoc /usr/sys/inst.images
Run smit update_all to install all updates from this package that apply to the installed filesets on your system, select the Installation Directory, make sure expand filesystem as required..
# smit update_all
   



 Reboot the system if required

Monday, March 26, 2012

Update Firmware on 9111-285 (power5 System)

Download Required Firmware - In this case Recommended Firmware is SF240-417
FTP the rpm file (01SF240_417_382.rpm) to the Server that Needs to be Upgraded

Run the command below to extract the flash image file in the rpm file:

rpm -Uvh --ignoreos /tmp/01SF240_202_201.rpm

Before installing check the existing firmware level. From AIX, use the command lsmcode.  This command resides in the diagnostic directory.  An example of the output of the lsmcode command is as follows:
----------------------------------------------------------------------------------------------------------
DISPLAY MICROCODE LEVEL                                                   802811
IBM,9111-285

The current permanent system firmware image is SF240_202
The current temporary system firmware image is SF240_202
The system is currently booted from the temporary firmware image.

Use Enter to continue.
--------------------------------------------------------------------------------------------------------------
Next, run the update_flash command to upgrade firmware:
# ls /tmp/fwupdate
01SF240_417_382
# /usr/lpp/diagnostics/bin/update_flash -f /tmp/fwupdate/01SF240_417_382
The image is valid and would update the temporary image to SF240_417.
The new firmware level for the permanent image would be SF240_202.

The current permanent system firmware image is SF240_202.
The current temporary system firmware image is SF240_202.


***** WARNING: Continuing will reboot the system! *****

Do you wish to continue?
Enter 1=Yes or 2=No
SHUTDOWN PROGRAM
Mon Mar 26 11:01:35 EDT 2012
Stopping The LWI Nonstop Profile...
Waiting for The LWI Nonstop Profile to exit...
Waiting for The LWI Nonstop Profile to exit...
Stopped The LWI Nonstop Profile.
0513-044 The sshd Subsystem was requested to stop.
Wait for 'Rebooting...' before stopping.
Error logging stopped...
Advanced Accounting has stopped...
Process accounting stopped...
Stopping NFS/NIS Daemons
0513-044 The nfsd Subsystem was requested to stop.
0513-044 The biod Subsystem was requested to stop.
0513-044 The rpc.lockd Subsystem was requested to stop.
0513-044 The rpc.statd Subsystem was requested to stop.
0513-004 The Subsystem or Group, gssd, is currently inoperative.
0513-004 The Subsystem or Group, nfsrgyd, is currently inoperative.
0513-044 The rpc.mountd Subsystem was requested to stop.
0513-004 The Subsystem or Group, ypbind, is currently inoperative.


Connection to host lost.
After the System is back up, ran lsmcode and found that the system booted from the new Temporary Firmware as shown below
DISPLAY MICROCODE LEVEL                                                   802811
IBM,9111-285

The current permanent system firmware image is SF240_202
The current temporary system firmware image is SF240_417
The system is currently booted from the temporary firmware image.

Use Enter to continue.
To move the Temporary Image
# /usr/lpp/diagnostics/bin/update_flash -c 

Friday, March 23, 2012

Rename hdisk in AIX

Recently we had an issue with 2 hdisks going bad in AIX LPAR, both in different volume groups (hdisk15 & hdisk78)., The Volume groups had disks mirrored (hdisk0 to hdisk39 mirrored to hdisk40 to hdisk79). After replacing the drives, found that  the hdisks names got swapped as shown below before and after replacement. Since I do not want to create any confusion in future, I had to rename them back to original state before adding them to voulme groups as below..

 Before Replacing 



#lscfg -vl hdisk15
  hdisk15          U5791.001.992055M-P2-T5-L11-L0  16 Bit LVD SCSI Disk Drive (7
3400 MB)



#lscfg -vl hdisk78
  hdisk78          U5791.001.9920546-P2-T6-L10-L0  16 Bit LVD SCSI Disk Drive (7
3400 MB)

After Replacing



#lscfg -vl hdisk78
  hdisk78          U5791.001.992055M-P2-T5-L11-L0  16 Bit LVD SCSI Disk Drive (7
3400 MB)



#lscfg -vl hdisk15
  hdisk15          U5791.001.9920546-P2-T6-L10-L0  16 Bit LVD SCSI Disk Drive (7
3400 MB)

Swapping Back to Original State

Removed both the drives
#rmdev -dl hdisk78
#rmdev -dl hdisk15

Ran cfgmgr in the order I wanted

#cfgmgr -l scsi3 
#cfgmgr -l scsi23

Verified that they are swapped back

#lsdev -Cc disk |grep hdisk15
hdisk15   Available 0P-08-00-11,0 16 Bit LVD SCSI Disk Drive 
$ lsdev -Cc adapter |grep 0P-08
scsi3     Available 0P-08 Wide/Ultra-3 SCSI I/O Controller



#lscfg -vl hdisk15
  hdisk15          U5791.001.992055M-P2-T5-L11-L0  16 Bit LVD SCSI Disk Drive (7
3400 MB)




#lsdev -Cc disk |grep hdisk78
hdisk78   Available 0t-08-00-10,0 16 Bit LVD SCSI Disk Drive 
# lsdev -Cc adapter |grep  0t-08  
scsi23    Available 0t-08 Wide/Ultra-3 SCSI I/O Controller
#lscfg -vl hdisk78
  hdisk78          U5791.001.9920546-P2-T6-L10-L0  16 Bit LVD SCSI Disk Drive (7
3400 MB)