Friday, June 15, 2018

Useful AIX command alt_disk_copy

Useful AIX command alt_disk_copy command

This command clones existing OS copy to other disk of same size.
other application of this command is while cloning admin also do AIX TL upgrade.

some good example with explanation of alt_disk_copy


1.alt_disk_copy -d hdisk1 -b update_all -l /home/AIX72TL02

above command will clone existing OS to hdisk1 and after successful cloning update the OS on cloned disk .

after successful cloning and AIX TL update on new disk ,bootlist has been changed to new disk.

2.alt_rootvg_op -X old_rootvg

After successful booting from newly cloned disk  ,if admin wants to remove old_rootvg then above command is useful.

**here my suggestion is after cloning and AIX TL update keep old_rootvg for 3-4 week .if everything is working fine then admin can remove old_rootvg.


3.Clone AIX OS to hdisk1.
alt_disk_copy -d hdisk1 

some time situation arise where we need to include multiple disk in rootvg ,so in this sitiation how alt_disk_copy will work

Ans:

 alt_disk_copy -d "hdisk5 hdisk6" -b update_all -l /AIX72TL02

so above command will clone AIX 7.2 on hidsk5 and hdisk6 and then update to AIX 7.2 TL 02.


# alt_disk_copy -d "hdisk4 hdisk5"   

clone rootvg on 2 hdisk4 and hdisk5


Below figure show illustration of alt_disk_copy in AIX


                                               


Thanks

will continue writing new ideas on AIX alt_disk_copy





Sunday, June 10, 2018

df command in hang state on AIX two node cluster .

df command in hang state on AIX node


Incident:

on AIX two node hacmp cluster ,when we executed df -gt command , in command output observed that some nfs mount was missing and command is not exiting and in hang state.
because of this TSM backup for AIX node was failing.

Analysis:
After analysis found that one filer mount is missing on server and AIX cluster node was trying to mount it.we checked nmon log file and also /etc/filesystems to find missing mount entry.

solution :

forcefully umounted that filer and after that df -gt works and also TSM backup also worked
after that requested filer access to storage team which was not accessible.

umount -f /nfs-mountpoint  and then TSM backup and df -gt also working fine.

After doing analysis of df -gt hang issue we also found that at Firewall level there was rule missing for communication between AIX server and filer ,so to resolve  issue at network level Firewall rule need to be implement and need to mount again to solve this issue.

df command may hang on AIX NFS clinet when NFS server is down or crashed from where file-system exported to client.

Also want to discuss on mount type in AIX.there are two types of mount 
1.HARD
2.SOFT

so here question is which one is better .As per my knowledge and experience soft mount is the best option while doing NFS mount. generally these two parameter define that if there is nfs mount crash or mount point is not accessible then how nfs client react.

why soft mount is better ??

 AIX node tries until timeout value reach ,but in hard mount it there is no  timeout value defined so AIX server try indefinitely ,so in this situation system performance may degrade.


Thanks !!!!!!

Saturday, June 9, 2018

Assign root privilege to normal user using sudoers on AIX

Assign root privilege to normal user using sudoers file.

Unix root user is master of all user.but sometime situation demand that other user also need access of command which are only executed by root user .

Here /etc/sudoers file come in picture. this configuration file containing stanza for user and their access right.visudo is the command used for editing  /etc/sudoers file.


# User privilege specification
root    ALL=(ALL) ALL
oracle  ALL=(ALL) NOPASSWD:ALL
webuser  ALL=(ALL) NOPASSWD:ALL

In above yellow highlighted text user oracle and webuser able to execute all root user command without entering root password.

Following are some example where normal  user provided root command access.

If admin wants to provide poweroff command access to user test,then following will be the stanza in /etc/sudoers.
 test ALL=(ALL) NOPASSWD: /sbin/poweroff

Default log file for sudo log

Defaults logfile=/var/adm/sudo.log


Friday, June 8, 2018

Rename Logical volume and mount point on SUSE Linux

Rename Logical volume and mount point on SUSE Linux.

while doing day today administration task on SUSE linux one day i got task to rename existing LV name and mount point.when i got this task first thought in my mind was ,is it possible while File system is in mounted state ??.so answer to this is NO.

Here is the scenario

Filesystem                              Type  Size      Used   Avail   Use%   Mounted on
/dev/mapper/vg01-lvopt_IBM ext3  9.8G      2.8G    6.5G  30%       /opt/IBM
Rename LV name from lvopt_IBM to lvopt_IBMNew and chnage mount point to /opt/IBMNew
solution:

1.First take fstab file backup using command
  cp /etc/fstab /etc/org_fstab

2.mkdir -p /opt/IBMNew   //make sure that same name directory not exist in mentioned path.

3.umount /opt/IBM

4.lvrename vg01  lvopt_IBM   lvopt_IBMNew

syntax: lvrename [vg name]  old_lv_name   new_lv_name

5.Change /etc/fstab entry with New LV and mount point name

old 

/dev/vg01/lvopt_IBM  /opt/IBM             ext3       defaults              1 2

New

/dev/vg01/lvopt_IBMNew  /opt/IBMNew            ext3       defaults              1 2

6. mount /opt/IBMNew  

Check mounted file system using command 

df -hT /opt/IBMNew
Filesystem                              Type  Size      Used   Avail   Use%   Mounted on
/dev/mapper/vg01-lvopt_IBMNew ext3  9.8G      2.8G    6.5G  30%       /opt/IBMNew

Thanks .


Thursday, June 7, 2018

Recovering AIX root password using NIM server

                   
Recovering AIX root password using NIM server
---------------------------------------------------------------------------------
When AIX admin came across situation where  demand is recovery of  AIX root password.
In this situation there are 2 method

1. AIX DVD
2. NIM SPOT  // Here SPOT must be at same AIX OS level.
SPOT is shared product object tree which is used to boot NIM client(AIX LPAR).

So here i will prefer 2 option.use convenient option according to environment.

NIM SPOT : generally used for network boot of NIM client.

steps to boot NIM client(AIX LPAR) in maintenance mode

1.On NIM server define client
2.Assign NIM spot resource to client.
3.Initialize operation on NIM client(AIX LPAR) using command smitty nim_mac_op and select maint_boot = enable a machine to boot in maintenance mode
4.Boot into SMS menu.

IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM 
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM 
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM 
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM 
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM 
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM 
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM 
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM 
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM 
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM 
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM 
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM 
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM 
IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM IBM 

1 = SMS Menu 5 = Default Boot List 
8 = Open Firmware Prompt 6 = Stored Boot List 


Select option 1


5. Select option 4


Main Menu 

1. Select Language 
2. Password Utilities NOT available in LPAR mode 
3. View Error Log 
4. Setup Remote IPL (Initial Program Load) 
5. Change SCSI Settings 
6. Select Console NOT available in LPAR mode 
7. Select Boot Options 


6.On next screen admin should choose correct NIC adapter on which he set IP parameter for NIM server ,NIM client
(AIX LPAR) ,subnetmask and NIM client gateway.

Network Parameters 

1. IP Parameters 
2. Adapter Configuration 
3. Ping Test

enter value which suits network environment in your orgnization

IP Parameters 
1. Client IP Address [x.x.x.x ] 
2. Server IP Address [x.x.x.x
3. Gateway IP Address [x.x.x.x
4. Subnet Mask [x.x.x.x



7. Do ping test to verify  whether NIM server is reachable from NIM client.


Network Parameters 

1. IP Parameters 
2. Adapter Configuration 
3. Ping Test


8.Return to MAIN screen


Main Menu 

1. Select Language 
2. Setup Remote IPL (Initial Program Load) 
3. Change SCSI Settings 
4. Select Console 
5. Select Boot Options

9.Next screen


1. Select Install/Boot Device 


10. select Network


Select Device Type 
1. Diskette 
2. Tape 
3. CD/DVD 
4. IDE 
5. Hard Drive 
6. Network 
7. List all Devices 



11. On next screen admin need to choose correct adapter for network boot.

12. Select Normal boot mode.

1. Information 
2. Normal Mode Boot
3. Service Mode Boot 

13.On next screen choose YES option

Are you sure you want to exit System Management Services? 
1. Yes 
2. No 

14.On next screen choose "Access a Root Volume Group".


Type the number of your choice and press Enter. 


0 Continue 

88 Help ? 
 99 Previous Menu 


15. After choosing  0 option and it will list volume group details .



Option1 Access this volume group and start a shell before mounting file systems
Option 2 Allows you to perform file system maintenance on /, /usr, /tmp, and /var before mounting them
.
16.choose correct volume group.

17.

choose option 1 and press Enter. 

1) Access this Volume Group and start a shell   
2) Access this Volume Group and start a shell before mounting filesystems 



18. If AIX admin wants to edit file he must set TERM to terminal type.


If you intend to use SMIT or vi, set your terminal type in preparation for editing the file.

terminal types are lft, ibm3151, or vt100.

        TERM=
        export TERM
when admin want to edit any configuration file at that point export of TERM variable will come in picture.

19.
Execute command
 #passwd root   //To chnage root passwd

set password
20. sync;sync;sync;reboot     //To save changes

Second method ,which i will say traditional one is using AIX OS media DVD to recover or reset password .

other solution for resetting AIX server root password are like below
1.Find Jump server from where trust(pass-wordless configuration) configured to affected server and 
reset password of root
2. Sudo root access to other user than root ,so that user can execute root user command to reset password.


Thanks









Thursday, April 5, 2018

AIX connection timeout error

AIX connection timeout error on certain port have following  possibilities

1. service on the target  AIX host isn't running and therefore nothing is listening on the port.
2. firewall running somewhere in route is blocking connections to the port on AIX host .
3.check whether port is listening on AIX host.

command to check port status on AIX server

aixhost# netstat -Aan |grep port number

example

netstat -Aan |grep 22

what i do if i get connection timeout error on AIX host.

First thing i will do is check whether require service is running on AIX host,if that service is not running then check /etc/services file for required port and check that if that port is commented .
If that port is commented then remove comment from file and restart service and check again connection is succeeding or not.

on AIX host execute following command to check if port is open for connection.

#telnet [server-name] port-number

another issue may from firewall ,may be firewall blocking communication between AIX server and target client,so there must be new firewall rule need to enable this communication.check with network guy for firewall .


thanks !!!





Wednesday, April 4, 2018

How to manage print queue on AIX

 AIX admin  do following task while managing  print queue.
Print a job
Query the status of the job.
Cancel his print job.
Change priority of print job.
start or stop print queue.
start stop  ‘qdaemon’ on AIX.

Here i am discussing some command to check status of printer queue on AIX.
Check the status of the qdaemon process
 #ps -ef | grep qdaemon  //important process

If qdaemon process found in inoperative state then Start the qdaemon process by following command.
 #startsrc -s qdaemon
Stop the qdaemon
 #stopsrc -s qdaemon

***The qdaemon tracks both job requests and the resources(printer) necessary to complete the jobs.

There are diffrent commands to show status of printer queue on AIX.

example:

#lpstat
#enq -A
#lsallq

understand lpstat command output on AIX
======================================
#lpstat -p[queue name]
This command displays a list similar to the following:
Queue  Dev      Status      Job    Files      User      PP      %      Blks      CP      Rnk

Queue- Queue name
Dev- Queue device name
Status- Current status of the queue
Job -Job Number
Files- Name of file being printed
User- Aix user ID (owner of AIX print job)


PP- number of pages in print job
%- Percentage of AIX print job done.
Blks- Number of blocks the print job has broken
Cp- Number of copies
Rnk- Job rank in the print queue

qchk command example

#qchk -Pqueuename
shows status of a specific AIX queue
#qchk -A
Shows status of all AIX queues

There other command qadm in AIX to manage queue ,like printer queue UP and down.

example

#qadm -U[qname] Bring queue UP.
#qadm -D [qname] Bring queue DOWN.
#qadm -K [qname] Bring forcefully queue down.

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

Different state of printer on AIX

Ready - Printer on AIX OS ready to accept print jobs
Dev-Wait- Printer is not ready, not on-line, out of paper paper jam, or
Running- Printer on AIX OS printing
Down - Printer is not ready but will accept jobs

Troubleshooting Printer queue on AIX.

possible reason for facing issue on AIX printer queue.

1.check printer cable properly connected or not
2.make sure that printer is online.
3.printer is not out of paper.
4.qdaemon process is running on AIX server.if "qdaemon" process not running no printer will able do his print job.
5.make sure that job is not already printed.
6.make sure that AIX admin not sent job to incorrect printer.
=========================================
How to mange print queue on AIX
===============================
In printer management on AIX we generally do following.

1.start printer queue.
2.stop printer queue.
3.know the status of printer queue.



1.How to stop/start Printer queue on AIX.

step 1.

SMIT spooler ----manage print queue----stop/start print queue ---Print queue name and press enter


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

2.How to check status of Printer queue on AIX

SMIT  spooler ----manage print queue---know the status of print queue----enter print queue name
and press enter .

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

Print Queue on AIX using command line
root@servername:/root : lpstat -p[queue_name]
Queue   Dev   Status    Job Files              User         PP %   Blks  Cp Rnk
------- ----- --------- --- ------------------ ---------- ---- -- ----- --- ---

Flag

-p   printer status

some example of lpstat from MAN page

Examples
       1    To display the status for all print queues, enter:

            lpstat
       2    To display the long status for all printers, enter:

            lpstat -t

       3    To display a job number in the print queue lp0, enter:

            lpstat -plp0 This command displays a list similar to the following:

            Queue  Dev      Status      Job    Files      User      PP      %      Blks      CP      Rnk
            lp0    dlp0     running     39     motd       guest     10      83      12        1       1



Command examples on AIX for managing printer.
===================================
Display the default queue on AIX :
#qchk -q

To display the status of the printer lp0 on AIX:
#qchk -P lp0

To display the status of specific job numberon AIX :
#qchk -# [job number]

To display the status of all queues:
#qchk -A

To cancel the specific print job on AIX:
#qcan -x [job number]

To enable queue xyz on AIX:
#enable xyz

To disable queue xyz:
#disable xyz

To display the status all queues:
#lpstat

To display the status of print queue lp0:
#lpstat -p lp0

To display the jobs submitted by user root AIX:
#lpstat -u root

To display the status of queue testq:
#lpq -P testq