Wednesday, April 8, 2015

How to boot the server into maintenance mode using NIM?

How to boot the server into maintenance mode using NIM?


 If we want to boot a server into maintenance mode without the installation media, then we can achieve this by the NIM server using SPOT. Please find the steps below.

Note: The spot which is used to boot your target server to maintenance mode needs to be the same version and the same TL of the target server  

Login to the NIM master and perform the below steps:

The below steps is for allocated the boot image to the network for the client system to find and boot.
 smitty nim_mac_op
          select client
                   maint_boot = enable a machine to boot in maintenance mode
                             Select SPOT
                                      Enable maintenance boot (Select values in entry fields)
 Press enter and confirm the smit gives OK prompt.

Now boot the client (target) system in SMS mode so that we can select the network adapter that the client system will get the boot image from the network.
          Reboot your Client and Get into SMS mode. 
          press 1 to get into the SMS menu,
   In the SMS menu the first screen we get is the one given below.
ü Utilities
ü Remote Initial Program Load Setup --> (we need to select the correct adapter to set RIPL IP parameters)

ü Enter IP parameters
ü Specify the Client IP
( IP of the client server), Server IP ( IP of the NIM Server ), Check if the subnet mask is correct and Specify the gateway. 
ü Come back to the Main menu, by pressing X
ü Select the boot option
ü Select install/Boot Device, and select the Network card
ü We need to select the ethernet adapter to boot from
(Once you select the adapter you are going to boot from, you will be asked what type of boot you would like to perform.)
ü Select"Normal mode boot"
ü Exit from SMS menu by pressing X,

(Now The system will issue the bootp request to the master and begin the network boot and allow you to access maintenance mode)

Once booted from Nim spot, accessing rootvg to perform maintenance.

  ü On the maintenance mode, select option 1 for Access a root volume group
  ü Select the volume group
  ü Access this volume group and select a shell
you will see the prompt #. 
(now you can go with your maintenance activity)


Tuesday, March 31, 2015

How to perform the mksysb restore from nim?

How to perform the mksysb restore from nim?

Pre-check:

Ø Get the latest mksysb image of your client onto the NIM server.
Ø Ensure you have the location details of the root disk; disk onto which you have to restore mksysb. Select the correct root disk, donot select the data disk, this shall destroy the data on the data disk.
Ø Confirm the client is defined, if not define the client 


Installation Instructions:

1.Define your client in the NIM Master   -> #smitty nim_mkmac

2. Get the mksysb image of your client to the NIM Master

3. Creation of Resource using the Mksysb of your Client   --> #Smitty nim_mkres

4. Smitty nim_task_inst.-->   Install the Base Operating System on Standalone Clients

5. Select your client

6. Choose the Mksysb as Installation type

7. Choose the resource which is created by your mksysb image

8. Choose the Spot which is higher than your Client

9. Change "Initiate reboot and installation now?" to "no"

10. The following steps are optional if the hardware is similar . The steps are required if new hardware drivers will be needed. If you aren't sure, do the steps.

                 a. choose the 61TL01_lpp_source
                 b. set "ACCEPT new license agreements" to "yes"
                 c. set "ACCEPT new license agreements" in the "installp Flags" section to "yes"

11. Reboot your Client and Get into SMS mode, start your restoration

12. Press 1 to get into the SMS menu,

13.In the SMS menu the first screen , we have 3 options

14.Select the option 3, Utilities,

15.Select option “Remote Initial Program Load Setup” , 

16.Enter the IP parameters,

17.Specify the Client IP ( IP of the server on which the mksysb image will be restored ), Server IP ( IP of the NIM Server ), Check if the subnet mask is correct. Specify, gateway if needed. Perform a ping test

18. Come back to the menu, by pressing X,

19. Select the option Multiboot,

20. Select Boot Device, and select the Ethernet card

             Exit from SMS menu by pressing X, the server (a.k.a NIM client) would try to connect to the NIM server, once the packet count starts it means that the NIM client is connected and receiving the packets from the NIM master.

We get the boot screen now, Press 1

Accept the language as English, Press 1 now,

Select 0,

You may change the settings by selecting the right number,

Once selected it comes back to the main menu,

The installation would start now


This progress can also be monitored on the NIM Master,  lsnim –l <  clinet hostname>
Once done, the system should reboot automatically



Verification / Post-check:
Ø Make sure the server is accessible from the network (ssh and telnet should work)
Ø All the Volume groups should be varied On
Ø Confirm all the file systems are mounted
Ø Check all the logins are working fine
Ø Make sure all the required services are running
Ø Get the confirmation from the application team that everything working fine.



Backout:
There is no backout for ‘mksysb restore’; it is itself a backout. Perhaps the mksysb restore of the previous image could be a backout in this case.





How to perform storage migration from IBM to Hitachi?

How to perform storage migration from IBM to Hitachi?



 Please follow the below host based storage migration steps in dual vio setup.

   ü  Take the backup of the Lpar (Mksysb and TSM for datavg), and take the backup of VIOS (VIOSBR and VIOSBR)

   ü  Share the current configuration (IBM disks info) to the storage team (No of disks and size of the disks), and ask storage people to provide the new Hitachi disks based on the current configuration.

   ü  Execute "cfgmgr"on the vios servers to make sure the newly added Hitachi disks are available with the correct size and note the LUN info.

   ü  Change the disk's attribute like the algorithm and reserve_policy

   ü  Map the disks to the lpar with the help of mkvdev command (mkvdev –vadapter vhost# -vdev hdisk# -dev vtd_name)

   ü  Come to the Lpar and then execute the cfgmgr and confirm the number of disks and size of the disks also the disks having the two path.

   ü  Change the attribute of healthcheck_interval

   ü  Extend the disks to the VG and then execute the migratepv command (nohup migratepv IBM_disk Hitachi_disk &)

   ü  Once the migraiton is completed, take it out the old IBM disks by executing the reducevg command (Reducevg datavg IBM_disk)

   ü  Remove the disks from the lpar by executing rmdev

   ü  Now going to VIOS server and then delete the IBM disks VTD Mapping and then delete the IBM disks.

   ü  Once you delete the IBM disks, ask the storage people to unmap the IBM disks from their end, once they did, we will execute the cfgmgr and make sure the IBM disks cannot return back.

Note:

   ü  Ask the app people to shutdown the app/DB (This is OPTIONAL if your management wants to make sure to avoid any risks - we can perform rootvg+datavg migration on the fly. However if we perform the storage migration on cluster (HACMP) environment, we need to down the app (In cluster end - bring resource group offline) to avoid risks.

   ü  We can perform the storage migration in SAN based also. Steps are slightly differ from Host based method.

   ü  We can perform the migration by using the below methods.

       ü  1. Migratepv

       ü  2. Mirrorvg

       ü  3. Alt disk install 




If you happy with above topic, Kindly rate your reactions/comments below.

Thursday, March 19, 2015

IBM AIX interview questions you should not leave home without?

How to deal with AIX interview questions?


Hi guys Greetings from Howtoaix. I have listed the some set of interview questions below. Please prepare the answer before you gonna attend the interview. Please do share the answers if anyone wish to do it.

Note: will share the advance concept (VIO, NIM, LPAR,DLPAR,HMC) questions in near future.

1. How do I know if my volume group is normal, big, or scalable?
2. How do I create a volume group?
3. How can I change the characteristics of a volume group?
4. How do I create a logical volume?
5. How do I increase the size of a logical volume?
6. How do I display all logical volumes that are part of a volume group (e,g, rootvg)?
7. How do I list information about logical volumes?
8. How can I clone the rootvg?
9. How do I replace a disk?
10. How do I mirror a logical volume?
11. How can I display or set values for network parameters?
12. How do I get the IP address of my machine?
13. How do I identify the network interfaces on my server?
14. How do I activate a network interface?
15. How do I display routing table, interface and protocol information?
16. How will you create a file if a disk is given to you?
17. Difference between JFS & JFS2?
18. How will you find the inode number?
19. How will you find LTG size?
20. How will you change LTG size?
21. How will you find whether a quorum is up or not?
22. How to copy a LV from one VG to another?
23. Mirroring concept?
24. How will you unmirror a VG if a PV gets failed?
25. How will you change a PP size?
26. T – Factor?
27. What is the default PP Size in AIX?
28. How will you rename a VG?
29. What is major number?
30. What will you do if a disk gets failed?
31. How to enable & disable quorum?
32. What are the types of error?
33. What are the error levels severity?
34. What is the command to see the error log?
35. What is the command to clear the errorlog?
36. What is the command to increase the size of error log when it is ful?
37. What is the command to start , stop, restart and list a demon?
38. When does error demon start in boot process?
39. Which file that error daemon stay?
40. Two states of device availability and explain them?
41. How will you check whether a device is installed or not?
42. How to change a 64 bit kernel to 32 bit kernel?
43. How to change a 32 bit kernel to 64 bit kernel?
44. How many VGs can be created in a LVM?
45. Types of VG & explain about them?
46. How to convert a normal VG to big & scalable VG and also Big to Scalable VG?
47. What is VGDA, VGSA?
48. Default dump device?
49. Default secondary dump device?
50. How find a system dump?
51. Where the file does the paging space stay?
52. How will check whether a fix is installed or not?
53. What are the two states of installation?
54. How will you reject a committed fileset?
55. How will you check whether service pack is installed or not?
56. What is the latest OS level?
57. How will you check whether software is installed or not?
58. How do you find history of a file set?
59. How to remove a failed package installation?
60. How do remove the entries of the device in the odm?
61. What are the types of ODM Database ?
62. ODM Commands
63. Types of Installation?
64. Where does log files resides?
65. How to unlock user account?
66. How to lock a user’s account?
67. How do u take backup of file systems?
68. How will u restore a file from already take backup using backup?
69. How will u append a file to a previous archive take by Tar?
70. What command to take backup other vg’s?
71. What command to restore backup of non – rootvg?
72. In which files the installation errors stay?
73. What are the Error Codes? 201, 221-229, 553, c31, 552,554,556
74. What is the command to view boot log?
75. what is the command to configure the devices?
76. what is the command to list the bootlist?
77. what is the command to change the boot list order?
78. what are the fields in /etc/inittab file?
79. What is the command to find out the kernel bit mode?
80. what is the difference between mksysb and savevg backup?
81. what is the command to confirm the mksysb backup is properly taken?
82. What is the command to list/edit/remove the fields of cronjob?
83. what file should allow and deny the cron entry?
84. what command to list out the usage of the paging space?
85. what command to increase/decrease/remove the paging space?
86. How to enable and disable the paging space?
87. what command to remove the installed software?
88. what command is used to check whether the deamon is running or not?
89. what is the command to start/stop/refresh the deamon?
90. what are the areas are managed by ODM?
91. what command is used to add the IP address?
92. What is the command to bring down and bring up the network card?
93. what is the command to create/remove/change the user account?
94. what is the command to change the password?
95. How to find out the current run level?
96. How to find out the speed of the network adapter?
97. can we able to copy the lv from one vg to another vg? How?
98. what is the command to perform mirror and unmirror task?
99. How to find out the broken filesets in aix?
100. How to find out the FC card details in aix?
101. How to list out the file with the number on all the lines?
102. How to come to the last line in the vi editor?
103. what is the use of R flag in the chmod command?
104. What is mean by sticky bit and how do you find out?
105. How to change the prompt in aix?
106. How to list out last login and log out in aix?
107. How to scan a particular device in aix?
108. what is the output of bootinfo with the following options (l,K,r,s,b,p,M,T)?
109. How to stop and start the error deamon?
110. How to increase the size of errordeamon?
111. what is the output of sysdumpdev with the following options (l,e,,Pp,Ps,p,s)?
112. which file allow and deny the cron?
113. what is the disadvantage of tar?
114. How to take tar backup?
115. How to take a snap shot in aix?
116. What is the output location of snap? what is the name of the file?
117. what is the purpose of lppchk command?
118. how to change the hostname temporarily?
119. How to change the hostname permanently?
120. What are all the content of blv?
121. What is the default kernal location?
122. How to remove the filesystem info in /etc/filesystems?
123. How do you list out the filesystems information in vg?
124. What is the default priority in aix?
125. How to stop and restart the processs?
126. How to run a background process in to foreground? (Vice versa)
127. What are the different directory abbreviation ( )
128. How to move a directory?
129. How to rename a file?
130. How to obtain/monitor the lvm performance?
131. How to find out the firmware level in aix>
132. How to confirm the smt is enable or not in the system?
133. How to list out the top ten users of paging space?
134. How to list out the top ten users of real memory?
135. How to find out the available processor in aix>
136. How to check the system dump is completed successfully?
137. How to list out the efix?
138. How to list open files?
139. How to compress a file in aix?
140. How to find out the major number of the device?
141. How to list out the mac address?
142. What command needs to execute after editing /etc/inittab file?
143. what is the zoombie or defunct process in aix?
144. Waht is the purpose of errorlogger?
145. How to find out the runlevel in aix?
146. How to find out the file's general information? (What kind of file is this?)
147. what is the purpose of inutoc?
148. what is the purpose of savebase command in aix?
149. How to find out the whether your are working in standalone server or logical
partition?
150. How to list out the directories and sub-directories of the folder?

Monday, January 26, 2015

What is the difference between extend lv and increasing the filesystem ?

What is the difference between extend lv and increasing the filesystem?


If we increasing the filesystem size, both "filesystem and LV are getting increased", But if we extend the LV means, it will extend (increase) only the size of lv NOT the filesystem. So again we need to increase the filesystem size to take the real effect.

Please see the example below.

here we executing the extendlv command to increase the "cvalv", pls note that there is a change in number of lv from 42 to 45, however there is no size increment on the filesystem.

So the real size of the filesytem (after extendlv) will take effect only after increasing the filesystem. (672 Mb to 720 Mb)

Thats what,all the system admin prefer to increasing the filesytem directly instead of doing extendlv + increasing FS.




The above figure explains about the difference between extend lv and increasing the filesystem.



If you happy with the above topic, please leave your reactions.

Tuesday, December 2, 2014

Useful AIX Commands in day to day activities

Useful AIX Commands in day to day activities


Below I have given you the consolidate AIX Commands. Hope it will really useful for AIXian.

DEVICES
lscfg
lists all installed devices
lscfg –v
lists all installed devices in detail
lscfg -vl (device name)
lists device details
bootinfo –b
reports last device the system booted from
bootinfo –k
reports keyswitch position 1=secure, 2=service, 3=normal
bootinfo –r
reports amount of memory (/ by 1024)
bootinfo -s
(disk device) reports size of disk drive
bootinfo –T
 reports type of machine ie rspc
lsattr -El sys0 -a realmem
reports amount of useable memory
mknod (device) c (major no) (minor no)
Creates a /dev/ device file.
mknod /dev/null1 c 2 3

lsdev –C
lists all customised devices ie installed
lsdev –P
lists all pre-defined devices ie supported
lsdev -(C or P) -c (class) -t (type) -s (subtype)

chdev -l (device) -a (attribute)=(new value)
Change a device attribute
chdev -l sys0 -a maxuproc=80

lsattr -EH -l (device) –D
Lists the defaults in the pre-defined db
lsattr -EH -l sys0 -a modelname

rmdev -l (device)
Change device state from available to defined
rmdev -l (device) –d
Delete the device
rmdev -l (device) –SR
S stops device, R unconfigures child devices
lsresource -l (device)
Displays bus resource attributes of a device.


PHYSICAL VOLUME

Lspv
Lists all physical volumes (hard disks)
lspv (pv)
 Lists the physical volume details
lspv -l (pv)
Lists the logical volumes on the physical volume
lspv -p (pv)
Lists the physical partition usage for that PV
chdev -l (pv) -a pv=yes
Makes a new hdisk a pysical volume.
chpv -v r (pv)
Removes a disk from the system.
chpv -v a (pv)
Adds the removed disk back into the system.
chpv -a y (pv)
Changes pv allocatable state to YES
chpv -a n (pv)
Changes pv allocatable state to NO
migratepv (old pv) (new pv)
Moves all LV's from one PV to another PV, both PV's must be in the same volume group


Volume Groups (VG's)
Lsvg
Lists all volume groups
lsvg (vg)
Lists the volume group details
lsvg -l (vg)
Lists all logical volumes in the volume group
lsvg -p (vg)
Lists all physical volumes in the volume group
lsvg –o
Lists all varied on volume groups
varyonvg (vg)
Vary On a volume group
varyonvg -f (vg)
 Forces the varyon process
varyonvg -s (vg)
Vary on a VG in maintenance mode.
LV commands can be used on VG, but LV,s cannot be opened for I/O.

varyoffvg (vg)
Vary Off a volume group
synclvodm (vg)
Tries to resync VGDA, LV control blocks and ODM.
mkvg -y(vg) -s(PP size) (pv)
Create a volume group example:mkvg -y datavg -s 4 hdisk1
reducevg -d (vg) (pv)
Removes a volume group
reducevg (vg) (PVID)
Removes the PVID disk reference from the VGDA when a disk has vanished without the reducevg (vg) (pv) command being run first.
extendvg (vg) (new pv)
Adds another PV into a VG.
exportvg (vg)
Exports the volume group eg deletes it!


Note:

Cannot export a VG if it has active paging space, turn off paging, reboot before exporting VG.

Exporting removes entries from filesystems file but does not remove the mount points.

chvg -a y (vg)
Auto Vary On a volume group at system start.
lqueryvg -Atp (pv)
Details volume group info for the hard disk.
importvg -y (vg name) (pv)
Import a volume group from a disk.
importvg (pv)
Same as above but VG will be called vg00 etc.
chvg -Q (y/n) (vg name)
Turns on/off Quorum checking on a vg.

Logical Volumes (LV's)
lslv (lv)
Lists the logical volume details
lslv -l (lv)
 Lists the physical volume which the LV is on
mklv (vg) (No of PP's) (pv Name optional)
Create a logical volume
mklv -y (lv) (PP's) (pv name optional)
Creates a named logical volume
chlv -n (new lv) (old lv)
Rename a logical volume
extendlv (lv) (extra No of PP's)
Increase the size of an LV
rmlv (lv)
Remove a logical volume
migratepv -l (lv) (old pv) (new pv)
Move a logical volume between physical volumes.
mklv -y (lv) -t jfslog (vg) (No of PP's) (pv Name optional)
Creates a JFSlog logical volume.
logform (/dev/lv)
Initialises an LV for use as an JFSlog
getlvcb -AT (lv)
 Displays Logical Volume Control Block information

File Systems (FS's)
Lsfs
Lists all filesystems
lsfs -q (fs)
Lists the file system details
mount
Lists all the mounted filesystems
mount (fs or lv)
Mounts a named filesystem
mount –a
Mounts all filesystems
mount all

mount -r -v cdrfs /dev/cd0 /cdrom
mounts cd0 drive over /cdrom
crfs -v jfs -d(lv) -m(mount point) -A yes
 Will create a file system on the whole of the logical volume, adds entry into/etc/filesystems and will create mount point directory if it does not exist.
crfs -v jfs -g(vg) -m(mount point) -a size=(size of fs) -A yes
Will create a FS on the default logical volume on the volume group with the size stated. Will add entry into /etc/filesystems.
chfs -A yes (fs)
Change file system to Auto mount in /etc/filesystems
chfs -a size=(new fs size)(fs)
Change file system size
rmfs (fs)
Removes the file system and will also remove the LV if there are no onther file
systems on it.

defrag -q (fs)
 Reports the fragment status of the file system.
defragfs -r (fs)
Runs in report only defrag mode (no action).
defragfs (fs)
Defragments a file system.
fsck (fs)
Verify a file system, the file system must be unmounted!
fsck (-y or -n) (fs)
Pre-answer questions either yes or no !
fsck -p (fs)
Will restore primary superblock from backup copy if the superblock is corrupt.

Mirroring
mklv -y (lv) -c(copies 2 or 3) (vg) (No of PP's) (PV Name optional)
Creates a mirrored named logical volume.
mklvcopy -s n (lv) (copies 2 or 3) (pv)
Creates a copy of a logical volume onto another physical volume. The physical volume MUST be in the same volume group as the orginal logical volume !
rmlvcopy (lv) (copies 1 or 2)
Removes logical volume copies.
rmlvcopy (lv) (copies 1 or 2) (pv)
From this pv only!
syncvg -p (pv)
Synchronize the physical volume
syncvg -l (lv)
Synchronize logical partion copies
syncvg -v (vg)
Synchronize the volume group
mirrorvg (vg) (pv)
Mirrors the all the logical volumes in a volume group onto a new physical volume. New physical volume must already be part of the volume group.
mirrorvg –S (vg) (pv)
Mirrors all the lvs in a volume group in background. We can access the vg in the meanwhile.

BOOT LOGICAL VOLUME (BLV)
bootlist -m (normal or service) –o
displays bootlist
bootlist -m (normal or service) (list of devices)
change bootlist
bootinfo –b
Identifies the bootable disk
bootinfo –t
Specifies type of boot
bosboot -a -d (/dev/pv)
Creates a complete boot image on a physical volume.
mkboot -c -d (/dev/pv)
Zero's out the boot records on the physical volume.
savebase -d (/dev/pv)
Saves customised ODM info onto the boot device.

SYSTEM DUMP
sysdumpdev –l
Lists current dump destination.
sysdumpdev –e
Estimates dumpsize of the current system in bytes.
sysdumpdev –L
 Displays information about the previous dump.
sysdumpstart –p
Starts a dump and writes to the primary dump device.
sysdumpstart –s
Starts a dump and writes to the secondary dump device.
Note :

(MCA machine can also dump if key is in service position and the reset button is pressed

sysdumpdev -p (dump device) -P
Sets the default dump device, permanently
echo "stat\n status\n t -m" | crash \ /var/adm/ras/vmcore.0
Analyse dump file

PAGING SPACE (PS's)
lsps –a
Lists out all paging space
lsps –s
Displays total paging and total useage
lsps (ps)
Display the info about the paging space
mkps -s(No of 4M blocks) -n -a (vg)

mkps -s(No of 4M blocks) -n -a (vg) (pv) -n = don't activate/swapon now -a = activate/swapon at reboot

chps -a n (ps)
Turns off paging space.
chps -s(No of 4M blocks) (ps)
Increases paging space.
chlv -n (new name) (old name)
Change paging space name
rmps (ps)
Remove paging space. PS must have been swap off
swapon /dev/paging00
To swap on the paging space
swapoff /dev/paging00
To swap off the Paging space
/etc/swapspaces
File that lists all paging space devices that are activated/swapon during reboot.

SCHEDULING
crontab –l
List out crontab entrys
crontab –e
Edit crontab entrys
crontab -l > (filename)
 Output crontab entrys to a file
crontab (filename)
Enter a crontab from a file
crontab –r
Removes all crontab entrys
crontab –v
Displays crontab submission time.
/var/adm/cron/cron.allow
File containing users allowed crontab use.
/var/adm/cron/cron.deny
File containing users denied crontab use.
/var/adm/cron/crontab
Directory containing users crontab entries.
/var/adm/cron/at.allow
File containing users allowed at use.
/var/adm/cron/at.deny
File containing users denied at use.
/var/adm/cron/atjobs
Directory containing users at entries.

USERS
passwd –f
Change current users gecos (user description)
passwd –s
 Change current users shell
chfn (username)
Changes users gecos
chsh (username) (shell)
Changes users shell
env
Displays values of environment variables
id
 Displays current user's uid and gid details
id (user)
Displays user uid and gid details
whoami
Displays current user details
who am i (or who -m)
Displays details of the current user
who
Displays details of all users currently logged in.
w
Displays details of all users currently logged in.
who –b
Displays system reboot time
uptime
Displays number of users logged in, time since last reboot, and the machine loadaverages.
Lslicense Displays number of current user licensese

chlicense -u (number)
 changes the number of user licenses
lsuser ALL
Lists all users details
lsuser (username)
Lists details for user
lsuser -a(attribute) (username or ALL)
Lists user attributes
lsuser -a home ALL

mkuser -a(attributes) (newuser)
Add a new user
chuser (attributes) (user)
Change a user
chuser login=false (user)
Lock a user account
rmuser -p (user)
Removes a user and all entries in security files
usrck -t ALL
Checks all the user entires are okay.
fuser -u (logical volume)
Displays processes using the files in that LV
lsattr -D -l sys0 -a maxuproc
Displays max number of processes per user
chdev -l sys0 -a maxuproc=(number)
Changes max number of processes per user


INITTAB
telinit S
Switches to single user mode.
telinit 2
Switches to multi user mode.
telinit q
Re-examines /etc/inittab
lsitab –a
Lists all entries in inittab
lsitab (ident eg tty1)
Lists the tty1 entry in inittab
mkitab ("details")
Creates a new inittab entry
chitab ("details")
Edit the inittab entry
Ammends an existing inittab entry

Example :

chitab "tty1:2:respawn:/usr/bin/getty /dev/tty1"

rmitab (ident eg tty1).
Removes an inittab entry

ODM
odmget -q "name=lp1" CuDv |more
Gets lp1 info from pre-defined database.
odmget -q "name-lp1" CuAt |more
Gets lp1 info from customised database.
odmdelete -o CuAt -q "name=lp1"
 Deletes lp1 info from customised db.
odmget -q "name=lp1" CuAt > lp1.CuAt
Export ODM info to text file.
odmadd < lp1.CuAt
Import ODM info from text file.

ERROR LOGGING
/usr/lib/errdemon –l
Displays errorlog attributes.
/usr/lib/errdemon
Starts error logging.
/usr/lib/errstop
Stops error logging.
Errpt
Displays summary errorlog report.
errpt –a
Displays detailed errorlog report.
errpt -j (identifier)
Displays singe errorlog report.
Note : errorlog classes are

H=Hardware

S=Software

O=Information

V=Undetermined

errclear (days)
Deletes all error classes in the errorlog.
errclear -d (class) (days)
 Deletes all error class entries in errlog.
Note :

The errclear command will delete all entries older than the numbers of days

specified in the days paramenter.

To delete ALL entries used 0.

errlogger "message up to 1024 chrs"
Enters an operator notifaction message into the errorlog.

PERFORMANCE MONITORING
vmstat (drive) (interval) (count)
Reports virtual memory statistics.example: vmstat hdisk0 5 20
vmstat -s
Diplays number of paging events since system start.
vmstat –f
Diplays number of forks since system start.
vmstat –i
Diplays number of interupts by device since system start.
iostat (drive) (interval) (count)
Reports i/o and cpu statistics.
Example :

iostat hdisk0 5 20

iostat -d (drive) (interval) (count)
Limits report to drive statistics.
iostat -t (interval) (count)
Limits report to tty statistics.
sar -u -P ALL 10 10
Displays %usr %sys %wio %idle for all processors

DOS DISKETTES
Dosdir
Reads directory listing of a diskette
dosdir (directory)
Reads directory listing of a named directory
dosread -D/dev/fd0 C41.TXT c41.txt Gets C41.TXT from diskette drive fd0

dosread -D/dev/fd0 DIRECTORY/C41.TXT c41.txt (-D option can be dropped if using fd0)

doswrite -D/dev/fd0 (unixfile) (dosfile)
Writes a file to diskette
dosdel (dosfile)
Deletes a dos file on diskette
dosformat
Formats the diskette

SENDMAIL
sendmail –bi
Creates new aliase db from /etc/aliase file.newaliases
sendmail –bp
Displays the contents of the mail queue mailq
sendmail –q
Processe the sendmail queue NOW
sendmail -bt -d0.4 < /dev/null

refresh -s sendmail
Prints out sendmail version, compile defines and system information
kill -l (sendmail PID)
Restart sendmail

MISCELLENEOUS
oslevel
Returns operating system level
whence (program)
 Returns full path of program
whereis (program)
Returms full path of program
what (program)
Displays identifying info from the executable like version number, when compiled.
lslpp -L
all list all installed software
lslpp -L
(program set name) Check if software installed
lslpp -f
Lists filesets vs packages
lslpp -ha
Lists installation history of filesets
compress -c file.txt > file.Z
Create a compressed file.
od -c /tmp
Displays contents of the /tmp directory file
ls -i
Lists files with their inode numbers
echo *
Lists files, can be used if ls is corrupt/missing
alog -o -t boot
View the boot log
chtz (timezone eg GMT0BST)
Changes the timezone in /etc/environment file
chlang (language eg En_GB)
Changes the language in /etc/environment file
ar -v -t (archive file)
List contents of an archive
ar -v -x (archive file)
Extracts the archive
ar -v -t /usr/lib/libC-r.a
Lists contents of the libC_r.a library
find /source -print | cpio -pdm /target
Copying directories using cpio, creates /target/source directory.
dump -nTv (binary executable)
Displays the contents of an executable file
dump –c
Displays string information
dump –o
Displays object file headers
dump –l
Displays line numbers
dump –s
Displays the text section
snap -ao /dev/rmt0
Create a snapshot onto tape
snap -ad (directory)
Create a snapshot into a named directory other than the default (/tmp/ibmsupt)
/usr/dt/bin/dtconfig –d
Disables desktop logins
/usr/dt/bin/dtconfig –e
Enables desktop logins
/var/dt/Xpid
PID of the dtlogin process

TERMINALS
tty
Displays what the tty/pty number of terminal is.
Termdef
 reports the termtype setup in smit for the tty port that termdef is run on.
chdev -l (device eg tty1) -a term=vt100
Sets tty to a vt100 terminal type
penable tty0
adds getty line into /etc/inittab for tty0 and starts getty
pdisable tty0
disables the getty line and disables getty
penable / pdisable -a option is for all

stty erase ^?
Set backspace key for vt100 terminals
stty erase ^H
Set backspace key for wyse50 terminals
lscons
Displays the console device
chcons -a login=enable (device eg /dev/tty1)
Changes the console device
for i in 0 1 2 3 4 5 6 7
Create ttys on ports 0 to 7 on adapter sa2 :-
do

mkdev -c tty1 -t tty -s rs232 -p sa2 -w$i -a login=enable -a term=vt100

done

portmir -t /dev/tty0
Mirror current terminal onto /dev/tty0
portmir –o
Turns off port mirroring

NETWORK
host (ip or hostname)
Resolves a hostname / ip address
hostname
Displays hostname
hostname (hostname)
Sets the hostname until next reboot
chdev -l (device name) -a hostname=(hostname)
Changes hostname permanently
ifconfig (device name)
Displays network card settings
ifconfig (device name) up Turns on network card

Examples :

ifconfig en0 inet 194.35.52.1 netmask 255.255.255.0 up

ifconfig (device name) down
Turns off network card
ifconfig (device name) detach
Removes the network card from the network interface list
ifconfig lo0 alias 195.60.60.1
Create alias ip address for loopback
route (add/delete) (-net/-host) (destination) (gateway)
Adds or deletes routes to other networks or hosts, does not update the ODM database and will be lost at reboot.
Example:  route add -net 194.60.89.0 194.60.90.4
lsattr -EHl inet0
Displays routes set in ODM and hostname
odmget -q "name=inet0" CuAt
Displays routes set in ODM and hostname
refresh -s inetd
Refresh inetd after changes to inetd.conf
kill -1 (inetd PID)
 Refresh inetd after changes to inted.conf
netstat –I
 Displays interface statistics
entstat -d (ethernet adapter eg en0)
Displays ethernet statistics
arp –a
Displays ip to mac address table from arp cache
traceroute (name or ipaddress)
Displays all the hops from source to destination supplied.
ping -R (name or ipaddress)
Same as traceroute except repeats.

N.F.S.
Exportfs
Lists all exported filesystems
exportfs –a
Exports all fs's in /etc/exports file
exportfs -u (filesystem)
Un-exports a filesystem
mknfs
Configures and starts NFS services
rmnfs
Stops and un-configures NFS services
mknfsexp -d /directory
Creates an NFS export directory
mknfsmnt
Creates an NFS mount directory
mount hostname:/filesystem /mount-point Mount an NFS filesystem

nfso –a
 Display NFS Options
nfso -o option=value

Set an NFS Option

Examples :

nfso -o nfs_use_reserved_port=1


MKSYSB
mkszfile –f
Creates /image.data file (4.x onwards)
mkszfile –X
Creates /fs.size file (3.x)
mksysb
(device eg /dev/rmt0)

CPIO ARCHIVE
find (filesystem) -print | cpio -ocv > (filename or device)
eg find ./usr/ -print | cpio -ocv > /dev/rmt0

CPIO RESTORE
cpio -ict < (filename or device) | more Lists archive

cpio -icdv < (filename or device)

cpio -icdv < (filename or device) ("files or directories to restore")

 Restore directory and contents
cpio -icdv < /dev/rmt0 "tcpip/*"
Restore a named file
cpio -icdv < /dev/rmt0 "*resolve.conf"

TAR ARCHIVE
tar -cvf (filename or device)
 ("files or directories to archive") tar -cvf /dev/rmt0 "/usr/*"
tar -tvf (filename or device)
Lists archive
tar -xvf (filename or device)
Restore all
tar -xvf (filename or device)
("files or directories to restore") use -p option for restoring with orginal permissions
examples:

Restore directory and contents
tar -xvf /dev/rmt0 "tcpip"
Restore a named file
tar -xvf /dev/rmt0 "tcpip/resolve.conf"

AIX ARCHIVE
find (filesystem) -print | backup -iqvf (filename or device)
Backup by filename. ( -u option updates /etc/dumpdates file )
Example :
find /usr/ -print | backup -iqvf /dev/rmt0
backup -(backup level 0 to 9) -f (filename or device) ("filesystem")
           Example :  backup -0 -f /dev/rmt0 "/usr
Backup by inode. ( -u option updates /etc/dumpdates file )
"

AIX RESTORE
restore -qTvf (filename or device)
Lists archiv
restore -qvxf (filename or device)
Restores all
restore -qvxf (filename or device) ("files or directories to restore")
use -d for restore directories)
Restore /etc/passwd file
restore -qvxf /dev/rmt0.1 "./etc/passwd"
Lists contents of a mksysb tape
restore -s4 -qTvf /dev/rmt0.1

BACKUPS ACROSS A NETWORK
find /data -print | cpio -ocv | dd obs=32k | rsh remhost "dd ibs=32k obs=64k of=/dev/rmt0"
To run the backup on a local machine (cpio) and backup on the remote machine's (remhost) tape drive (/dev/rmt0)
dd ibs=64k if=/dev/rmt0 | cpio –icvt
To restore/read the backup (cpio) on the remote machine
rsh remhost "dd ibs=64k obs=32k if=/dev/rmt0" | dd ibs=32k | cpio –icvt
To restore/read the backup (cpio) on the local machine from the remote machine's (remhost) tape drive (/dev/rmt0)
rsh remhost "find /data -print | cpio -icv | dd ibs=32k" | dd ibs=32k obs=64k of=/dev/rmt0
To run the backup (cpio) on a remote machine (remhost) and backup to the local machines tape drive (/dev/rmt0)



COPYING DISKETTES
dd if=/dev/fd0 of=(filename) bs=36b
dd if=(filename) of=/dev/fd0 bs=36b conv=sync or flcopy

COPYING TAPES
dd if=/dev/rmt0 of=(filename)
dd if=(filename) of=/dev/rmt0 tcopy

Editor
editor Commands
:g/xxx/s//yyy/
VI global change where xxx is to be changed by yyy ( ctrl V to enter any character)
sed 's(ctrl v ctrl m)g//g' old.filename > new.filename
Strips out ^M characters from ascii files that have been transferred as binary. To enter crontrol characters type ctrl v then ctrl ? where ? is whatever ctrl character you need.

TAPE DRIVES
rmt0.x where x = A + B + C

A = density 0 = high 4 = low

B = retension 0 = no 2 = yes

C = rewind 0 = no 1 = yes

tctl -f (tape device) fsf (No)
Skips forward (No) tape markers
tctl -f (tape device) bsf (No)
Skips back (No) tape markers
tctl -f (tape device) rewind
Rewind the tape
tctl -f (tape device) offline
Eject the tape
tctl -f (tape device) status
Show status of tape drive
chdev -l rmt0 -a block_size=512
changes block size to 512 bytes
(4mm = 1024, 8mm = variable but 1024 recommended)

bootinfo –e
answer of 1 = machine can boot from a tape drive
answer of 0 = machine CANNOT boot from tape drive

diag -c -d (tape device)
Hardware reset a tape drive.
tapechk (No of files)
Checks Number of files on tape.
< /dev/rmt0
Rewinds the tape !!!

PRINTERS / PRINT QUEUES
splp (device)
Displays/changes printer driver settings
example:
splp /dev/lp0
export $LPDEST="pqname"
Set default printer queue for login session
lsvirprt
Lists/changes virtual printer attributes.
rmvirprt -q queuename -d queuedevice
Removes a virtual printer
qpri -#(job No) -a(new priority)
Change a queue job priority.
qhld -#(job No)
 Put a hold on hold
qhld -r #(job No)
Release a held job
qchk –A
Status of jobs in queues
lpstat

lpstat -p(queue)
Status of jobs in a named queue
qcan -x (job No)
Cancel a job from a queue
cancel (job No

enq -U -P(queue
 Enable a queue
enable (queue)

enq -D -P(queue)
Disable a queue
disable (queue)

qmov -m(new queue) -#(job No)
Move a job to another queue
startsrc -s qdaemon
Start qdaemon sub-system
lssrc -s qdaemon
List status of qdaemon sub-system
stop -s qdaemon
Stop qdaemon sub-system


SECURITY
Groups Lists out the groups that the user is a member of

Setgroups Shows user and process groups

chmod abcd (filename)

Changes files/directory permissions

Where :

a is (4 SUID) + (2 SGID) + (1 SVTX)

b is (4 read) + (2 write) + (1 execute) permissions for owner

c is (4 read) + (2 write) + (1 execute) permissions for group

d is (4 read) + (2 write) + (1 execute) permissions for others

rwSrwxrwx = SUID -rwxrwSrwx = SGID drwxrwxrwt = SVTX

chown (new owner) (filename)
Changes file/directory owners
chgrp (new group) (filename)
Changes file/directory groups
chown (new owner).(new group) (filename)
Do both !!!
umask
Displays umask settings
umask abc
Changes users umask settings
Where :

( 7 - a = new file read permissions)

( 7 - b = new file write permissions)

( 7 - c = new file execute permissions)

examples :

umask 022 =

new file permissions of 755

read write and execute for owner

read and execute for group

read and execute for other


mrgpwd > file.txt
Creates a standard password file in file.txt
passwd
Change current user password
pwdadm (username)
Change a users password
pwdck -t ALL
 Verifies the correctness of local authentication
lsgroup ALL
Lists all groups on the system
mkgroup (new group)
Creates a group
chgroup (attribute) (group)
Change a group attribute
rmgroup (group)
Removes a group