Thursday, October 19, 2017

Crontab in aix, concepts and commands in aix?

Crontab in aix, concepts and commands in aix?



v  Deamon - cron
v  Started by - /etc/inittab
v  startup entry - cron:2:respawn:/usr/sbin/cron (or)  cron:2:respawn:/etc/cron
v  file - crontab
v  file location - /var/spool/cron/crontabs/crontab
v  log - /var/adm/cron/log  (error messages about crontab is recorded here)
v  How to list - crontab -l
v  How to edit - crontab -e
v  How to remove - crontab -r
v  Allow - /var/adm/cron/log/cron.allow  (If the file exists, user id must be in the file before it can run cron jobs)
v  Deny - /var/adm/cron/log/cron.deny (If the user is not denied the user may submit the cron jobs)
v  process -  ps -eaf|grep -i cron


v  A crontab entry consists of six fields:

* * * * * Command

The minute (0 through 59)
The hour (0 through 23)
The day of the month (1 through 31)
The month of the year (1 through 12)
The day of the week (0 through 6 for Sunday through Saturday)
The command to run


Sunday, October 15, 2017

Disk is in Removed state in aix, How to fix it?

Disk is in Removed state in aix, How to fix it?


I have faced the below issue.


"lspv" output shows that the disk is in available state however

"lsvg -p datavg" output shows that the disk is in "Removed" state in the lpar.  (disk is virutal disk)


# lspv
hdisk0   0000000012345678 rootvg   active
hdisk1   10000BC987654321 datavg   active
hdisk2   10000CD999654321 datavg   active

# lsvg -p vgname

datavg:
PV_NAME           PV STATE               TOTAL PPs   FREE PPs    FREE DISTRIBUTION
hdisk1                   active                          646         486                 130..00..98..129..129
hdisk2                   removed                     646         486                 130..00..98..129..129  

#


Executed the below commands to fix the issue.

# varyonvg datavg   (It didn't helpful as it saying unable to sync the logical volumes)

# chpv -va hdisk1    ( This brought the disk into available state)

# syncvg -v datavg   (Confirmed that all the logical volumes and FS are in open/sync state)



Tuesday, October 3, 2017

How to restore a single file in aix?

How to restore a single file in aix?



If we want to restore a file named healthcheck.ksh from mksysb use the below.


Checking the healthcheck.ksh file existing in the mksysb image.
         
          restore -T -q -l -f /backup/uktest.mksysb | grep healthcheck.ksh


It will list out the detailed output and at the end it will display the file which we need to recover

-rwxr-xr-x- 10   staff  May 30  11:54  267 ./home/unixsa/healthcheck.ksh


Restore the particular file healthcheck.ksh using,

          restore -x -q -f /backup/uktest.mksysb ./home/unixsa/healthcheck.ksh

Please note that (.) is important before the file name


cd ./home/unixsa
ls -la healthcheck.ksh
-rwxr-xr-x- 10   staff  May 30  11:54  267 ./home/unixsa/healthcheck.ksh


======================================================================

Another method:
---------------------

#lsmksysb -lf /backup/uktest.mksysb
# restorevgfiles -f /backup/uktest.mksysb ./home/unixsa/healthcheck.ksh

New volume on uktest.mksysb
Cluster size is 51200 bytes (100 blocks).
The volume number is 1.
The backup date is: Tue May 30 11:54:18 GMT+01:00 2017
Files are backed up by name.
The user is root.
x            267 ./home/unixsa/healthcheck.ksh
The total size is 267 bytes.
The number of restored files is 1.


# ls -la */*
-rw-r--r--    1 root     system            6 Feb 17 11:16 ./home/unixsa/healthcheck.ksh



Monday, June 12, 2017

How to perform OS migration from 6.1 to 7.1 using CD in aix?

How to perform OS migration from 6.1 to 7.1 using CD in aix?


Please find the below steps for migration installation:

 # lsvg -p rootvg  à Check for mirrored Eg: hdisk0 and hdisk1

 # umirrorvg rootvg   à Breaking the mirrorr

 # chpv -c hdisk1  à  Clearing the boot image on hdisk1

 # alt_disk_copy -d hdisk1    à Cloning of rootvg on hdisk1

 # bosboot -ad /dev/hdisk1    à Creating a boot image on hdisk1

 # ipl_varyon -i    à Check the disk bootable or not

 # cfgmgr   à Detect the 6.1 Migration CD

 # lsdev | grep cd0

 # ipl_varyon -i   à Check the cd  and the disk bootable or not

 # bootlist -m  -normal -o cd0 hdisk1 hdisk0   à Changing the boot list to boot from 6.1 OS  CD */

 # shutdown -Fr    à Fast Re-boot

Migration:
========

** Once the Server Boots it would show the below message,**

1 = SMS menu                          5 = Default bootlist
8 = Open Firmware                  6 = Stored bootlist

** Ignore the above message and installation proceeds to the next page,

Starting Software
Please wait

** Next Screen,
Please define the System Console
Type a 1 and press Enter to use this terminal as the system console

** Type 1 and press enter,

1. Type 1 and press Enter to have English during install
>>>choice[1]

** Again Type 1 and press enter,
Welcome to Base Operating System Installation and Maintenance
Type the number of your choice and press Enter. Choice is indicated by >>>
>>>1. Start Install now with Default Settings
   2. Change/show Installation Settings and Install
   3. Start Maintenance Mode for System Recovery
   4. Configure Network Disks (iSCSI)
   88 Help?
   99 Previous Menu
   Choice[1]: 2

**Type 2 and press enter to change the installation settings,

Installation and Settings
Either type 0 and press Enter to install with current settings
or type the number of the setting you want to change and press Enter
1. System Settings:
   Method of Installation ......................Migration
   Disk where you want to Install ..............hdisk0   
2. Primary Language Environment settings (AFTER Install):
   Cultural Conventions ........................English (United States)
   Language ....................................English (United States)
   Keyboard ....................................English (United States)
   Keyboard Type ...............................Default
3. Security Model...............................Default
4. More Options (Software install options)
>>> 0 Install with the current settings listed above
88 Help?
99 Previous Menu
>>> Choice[0]:

** Change the method of installation to "Migration"
Ensure that the "Disk where you want to Install" is set to the correct disk : hdisk0
Change the "Cultural Conventions", "Language" and "Keyboard" to your prefered location

** Type 4 and press enter for "More Options (Software install options)"

Install Options
1. Enable System Backup to install any system....Yes
2. Import User Volume Groups.....................Yes
3. Remove Java 1.1.8 Software....................No
>>> 0 Install with the current settings listed above
88 Help?
99 Previous Menu
>>> Choice[0]:

** Check the values for the fields are as listed above and then press enter to accept the default value of 0 "Install with the current settings listed above
Migration Installation Summary
Disks: hdisk0
Cultural Convention: en_GB
Language: en_US
Keyboard: en_GB
Import User Volume Groups: Yes
Enable System Backup to install any system: Yes
Remove Java 1.1.8 Software: No
>>> 1 Continue with Install
88 Help?
99 Previous Menu
>>> Choice[1]:

** Check the fields if all the values as correct then press enter to accept the default value 1 "Continue with Install"

Migration menu preparation
Please wait
Approximate                            Elapsed time
% task complete                                   (in minutes)

** Next Screen,

Migration Confirmation
Either type 0 and press Enter to continue the installation
or type the number of your choice and press Enter
1. List the saved Base System Configuration files which will not be merged into the system
   These files are saved in /tmp/bos
2. List the filesets which will be removed and not replaced
3. List directories which will have all current contents removed
4. Reboot without migrating
Acceptance of license agreements is required before using system.
You will be prompted to accept after the system reboots
>>> 0 Continue with the migration

WARNING: Selected files, directories and filesets (installable options)
from the Base System will be removed.
Choose 2 or 3 for more information
88 Help?
99 Previous Menu
>>> Choice[0]:

Have a look at each menu option then type 0 and press enter to "Continue with the migration"

Saving system configuration files in /tmp/bos
Removing obsolete filesets, directories and files
Installing Base Operating System
Please wait
Approximate                            Elapsed time
% task complete                                   (in minutes)


** The installation should continue and finish and present a login screen and check the oslevel.
# oslevel -s

**Change the bootlist. 
#bootlist -m normal hdisk0


Saturday, May 20, 2017

NIM server and client configuration in AIX?

NIM server and client configuration in AIX?



NIM SERVER PRE-REQUISITE
========================

The below filesets required to setup NIM server and Client. We could check using      

#lslpp –l |grep nim.

bos.sysmgt.nim.master
bos.sysmgt.nim.spot


NIM SERVER INSTALLATION
========================

We could install using below commands

installp -agXd /mnt/nimpkg/bos.sysmgt.nim.master
installp -agXd /mnt/nimpkg/bos.sysmgt.nim.spot


lslpp -l |grep nim - To display the nim.spot and nim.master file sets
ls -l /etc/niminfo  -> The /etc/niminfo file created as part of the installation

The above installation creates the /etc/niminfo  file and the below deamons.

nimd and nimesis – daemon will get started, if it is not started, restart the inetd
startsrc –g inetd
startsrc –s nimd
startsrc -s nimesis


LPP_SOURCE

Lpp_source: This is having the content of aix in the CD for the aix installation

cd /export/install/nim/lpp_source
mkdir 6101LPP

smitty nim -> Perform NIM Adinistration Task -> Manage Resources -> Define a Resource
select lpp_source as resource type and enter

Fill it up the below mandatory field.
resource name                [61TL07]
resource type                 lpp_source
server of resource [master]
location of resource       [/export/install/nim/lpp_source/6101LPP]
source of install images [/cdrom]
Press enter, lpp_source will be created.

Commands to check
lsnim –l  <LPP_SOURCE NAME> detailed view
lsnim –c <lpp_name>

SPOT


Spot: This is used for aix installation which is created for each lpp_source

smitty nim ->  Perform NIM Adinistration Task ->  Manage Resources ->  Define a Resource
select spot as a resource type and enter

resource name                [spot_61TL07]
resource type                 spot
server of resource [master]
source of install images [61TL07_lpp]
location of resource       [/export/install/nim/spot]

Commands to check:
lsnim –l  <SPOTR NAME> detailed view
lsnim –c <sopt_name>


NIM CLIENT CONFIGURATION
==========================
 Nim master's /etc/hosts client IP and HOSTNAME and obviously client server supppose to be in DNS.

For NIM Client:
Required fileset: bos.sysmgt.nim.client   (This fileset present on aix server defaultly)

smitty nim_mkmac
Enter the machine name and press enter to continue
Select the type of network as "ent = ethernet network" and enter

* NIM Machine Name [abc_testlpar]
* Machine Type [standalone]
* Hardware Platform Type [chrp] Make sure this is set to ‘chrp’
Kernel to use for Network Boot [mp]
* Cable Type bnc/tp
* NIM Network master_net/enX
* Host Name abc_testlpar
 Press enter to continue

Commands to check
lsnim|grep -i abc_testlpar
lsnim -l abc_testlpar

Friday, February 3, 2017

How to check the apar installed in aix?

How to check the particular apar is installed in aix?


Many times we are in the position to check or install the specific apar in aix.

Below is the way to check whether the particular apar is already installed or not.

Example: APAR IZ97457


syntax: #instfix -ik <apar_name>

#instfix -ik IZ97457

All filesets for IZ97457 were found.

The above output shows that the APAR IZ97457 is already installed on the server.



Suppose if the apar is not installed on the server then we have to get the apar first and then installed it.

To list of fixes/apar that are on a directory or CD, then we can use the following:
# instfix -Td <directory>     (or)   # instfix -Td /dev/cd0

once you find out then installed the fix with the below command
# instfix -k <fix> -d <directory>
# instfix -k IZ97457 -d /export/filesets      (or) use # smitty update_by_fix