home *** CD-ROM | disk | FTP | other *** search
/ Current Shareware 1994 January / SHAR194.ISO / misc / aix1025.zip / AIX_FAQ.1 next >
Internet Message Format  |  1993-10-27  |  55KB

  1. Path: nlbbs!jaxsat!pagesat!decwrl!uunet!cs.utexas.edu!mavrick!basto@cactus.org
  2. From: basto@cactus.org (Luis Basto)
  3. Newsgroups: comp.unix.aix,news.answers,comp.answers
  4. Subject: AIX Frequently Asked Questions (Part 1 of 3)
  5. Summary: This posting contains a list of Frequently Asked Questions and thei
  6.  answers about AIX, IBM's version of Unix.
  7. Keywords: AIX RS/6000 questions answers
  8. Message-ID: <1462@mavrick.UUCP>
  9. Date: 25 Oct 93 06:03:14 GMT
  10. Expires: 15 Nov 93 01:23:45 GMT
  11. Sender: luis@mavrick.UUCP
  12. Reply-To: basto@cactus.org (Luis Basto)
  13. Followup-To: comp.unix.aix
  14. Lines: 1519
  15. Approved: news-answers-request@MIT.Edu
  16. Supersedes: <1459@mavrick.UUCP>
  17.  
  18. Archive-name: aix-faq/part1
  19. Last-modified: October 25, 1993
  20. Version: 2.42
  21.  
  22.  
  23. Version: $Id: aix.faq,v 2.42 93/10/25 basto $
  24.  
  25. Frequently Asked Questions to AIX 3.x and IBM RS/6000
  26. _____________________________________________________
  27.  
  28. This posting contains frequently asked questions and answers about the
  29. IBM RS/6000 series workstations and AIX version 3. All input is very
  30. welcome, please mail to basto@cactus.org.
  31.  
  32. The list is split into three articles to pass thru most mailers. I'll
  33. usually try to post them once a month to comp.unix.aix, news.answers,
  34. and comp.answers. Please let your input continue as I am most thankful
  35. for all of it.
  36.  
  37. If you see a From: line it means that whatever follows is either an
  38. unabridged or slightly edited version of the input I have received, and
  39. that I may not have verified its contents. If there is no From: line, I
  40. probably know what I am talking about, and the entry is edited from
  41. various sources.
  42.  
  43. All entries are numbered with major and minor subject number, e.g. 
  44. 2.11. If the subject is preceded by an asterisk, that entry has been
  45. changed or added since the last posting.
  46.  
  47. The comp.unix.aix group is for AIX on all IBM platforms -- RT, PS/2,
  48. 370, RS/6000 and mainframes (ESA based on OSF/1), but the traffic has
  49. evolved to discuss predominantly AIX 3.x and the RS/6000. The
  50. newsgroups comp.sys.ibm.pc.rt and comp.sys.ibm.ps2.hardware cover the
  51. RT, mostly hardware and AOS 4.3, and on PS/2 hardware respectively. 
  52. Mark Whetzel posts FAQ lists about RTs in the rt and *.answers groups.
  53. There are few to non-existent discussions on AIX/370 and AIX/ESA.
  54.  
  55. This article covers only AIX 3.x and the RS/6000, except when noted.
  56.  
  57. If you post questions to comp.unix.aix, please be sure to indicate:
  58.  
  59. - the machine type and brief configuration, e.g. Model 540, 64 MB RAM,
  60.   48 MB swap space (this is actually bad), 1.2 GB XYZ hard drive, etc.
  61.  
  62. - the exact AIX version number, i.e. AIX 3.1 is NOT sufficient, whereas
  63.   AIX 3.1.5 or AIX 3.1 with the 3005 update is. With 3.2 you should
  64.   mention any significant ptfs using the U4xxxxx numbers.
  65. ______________________________________________________________________________
  66.  
  67. Table of contents:
  68.  
  69. 1.0    General concepts
  70. 1.000  The AIX operating system - what is it?
  71. 1.000  I know neither Unix nor AIX - where do I find more information?
  72. 1.002  What is the Object Database?
  73. 1.003  How do I get rid of the verbose error messages?
  74. 1.004  Which release of AIX do I have?
  75.  
  76. 1.1    SMIT, system administration, file systems
  77. 1.100  I am used to Unix systems programming, why should I learn SMIT?
  78. 1.101  How do I turn off the "running man" in smit?
  79. 1.102  How do I import an /etc/passwd or /etc/group file from another box?
  80. 1.103  Cleaning up utmp, who, and accounting problems
  81. 1.104  How to fsck the root filesystem
  82. 1.105  How can I unmount /usr to run fsck on it?
  83. 1.106  How do I shrink /usr?
  84. 1.107  How do I make a filesystem larger than 2 Gig?
  85. 1.108  How do I see/change system parameters like number of processes per user
  86. 1.109  How do I shrink the default paging space on hd6?
  87. 1.110  The swapper seems to use enormous amounts of paging space, why?
  88. 1.111  How much paging space do I need?
  89. 1.112  How do I mount a floppy disk as a filesystem?
  90. 1.113  How do I remove a committed lpp?
  91. 1.114  How can I recover space after installing updates?
  92. 1.115  Where are the AIX log files kept?
  93. 1.116  How can I log information about ftp accesses to a file?
  94. 1.117  How do I find a file name from the inode number?
  95. 1.118  How do I set up postscript accounting?
  96. 1.119  How do I create boot diskettes for 3.2?
  97. 1.120  Where can I find tools for performance monitoring?
  98. 1.121  How can I tell what virtual printer a print queue is using?
  99. 1.122  Two srcmstr's are less useful than one?
  100. 1.123  How do I set the tty name associated with a physical port?
  101. 1.124  How do I use mksysb to clone a system?
  102. 1.125  How do I retain timestamps with mksysb?
  103. 1.126  How can I find out the machine type?
  104.  
  105. 1.2    Backups, tape
  106. 1.200  Some info about tape backups
  107. 1.201  How do I do remote backup?
  108. 1.202  How do I backup a multi-disk volume group?
  109. 1.203  How do I put multiple backups on a single 8mm tape?
  110. 1.204  How can I make an exact duplicate of a tape over the network?
  111.  
  112. 1.3    Memory and process management
  113. 1.300  Some info about the memory management system
  114. 1.301  How much should I trust the ps memory reports?
  115.  
  116. 1.4    Shells, commands, man pages, InfoExplorer
  117. 1.400* How do I make an informative prompt in the shell?
  118. 1.401  How do I set up ksh for emacs mode command line editing?
  119. 1.402  Listing files with ls causes a core dump
  120. 1.403  How do I put my own text into InfoExplorer?
  121. 1.404  InfoExplorer ASCII key bindings 
  122. 1.405  How can I add new man pages to the system?
  123.  
  124. 1.5    Video, Graphics, X11
  125. 1.500  Which release of X11 do I have?
  126. 1.501  How to prevent ctrl-alt-backspace from killing the X session
  127. 1.502  Who has a termcap/terminfo source for aixterm or the HFT console?
  128. 1.503  How can I look at PostScript files?  Why is "dpsexec" so lousy?
  129. 1.504  unix:0 vs `hostname`:0
  130. 1.505  VT100 key bindings for aixterm
  131.  
  132. 1.6    Networks and communications
  133. 1.600* My named dies frequently, why?
  134. 1.601  How do I trace ethernet packets on an AIX system?
  135. 1.602  What is the authorized way of starting automount at boot time?
  136. 1.603  How do I set a tty port for both dial-in and dial-out?
  137. 1.604  How to move or copy whole directory trees across a network
  138. 1.605  How can I send mail to hosts that cannot be pinged?
  139. 1.606  How to setup dialup SLIP
  140.  
  141. 1.7
  142. 1.8
  143.  
  144. 1.9    Miscellaneous
  145. 1.900  SCSI-1 and SCSI-2 "interoperability" got you confused?
  146. 1.901  How to get your keyboard back after unplugging it from the 6000
  147. 1.902  How do I set up pcsim, the DOS emulator?
  148. 1.903  How do I transfer files between AIX and DOS disks?
  149.  
  150.  
  151. 2.00  C/C++
  152. 2.01  I cannot make alloca work
  153. 2.02  How do I compile my BSD programs?
  154. 2.03* Isn't the linker different from what I am used to?
  155. 2.04  How do I link my program with a non-shared /lib/libc.a?
  156. 2.05  How do I make my own shared library?
  157. 2.06  Linking my program fails with strange error, why?
  158. 2.07  What's with malloc()?
  159. 2.08  Why does xlc complain about 'extern char *strcpy()'
  160. 2.09  Why do I get 'Parameter list cannot contain fewer ....'
  161. 2.10  Why does xlc complain about '(sometype *)somepointer = something'
  162. 2.11  Some more common errors
  163. 2.12  Can the compiler generate assembler code?
  164. 2.13  Curses
  165. 2.14  How do I speed up linking?
  166. 2.15  What is deadbeef?
  167. 2.16  How do I statically link in 3.2?
  168.  
  169. 3.00  Fortran and other compilers
  170. 3.01  I have problems mixing fortran and C code, why?
  171. 3.02  How do I statically bind fortran libraries and dynamically bind
  172.       C libraries?
  173. 3.03  How do I check if a number is NaN?
  174. 3.04  Some info sources on IEEE floating point
  175.  
  176. 4.00  GNU and Public Domain software
  177. 4.01  How do I find PD software?
  178. 4.02* Are there any ftp sites?
  179. 4.03  General hints
  180. 4.04  GNU Emacs
  181. 4.05  gcc/gdb
  182. 4.06  GNU Ghostscript
  183. 4.07  TeX
  184. 4.08  Perl
  185. 4.09  X-Windows
  186. 4.10  bash
  187. 4.11  Elm
  188. 4.12  Oberon 2.2
  189. 4.13* Kermit
  190. 4.14  Gnu dbm
  191. 4.15  tcsh
  192. 4.16  Kyoto Common Lisp
  193. 4.17* Tcl/Tk
  194. 4.18  Expect
  195. 4.19  Public domain software on CD
  196. 4.20* Andrew Toolkit
  197.  
  198. 5.00  Third party products
  199. 5.01  IBM List of third party products
  200. 5.02  Disk/Tape/SCSI
  201. 5.03  Memory
  202. 5.04  Others
  203. 5.05  C++ compilers
  204.  
  205. 6.00  Miscellaneous other stuff
  206. 6.01* Can I get support by e-mail?
  207. 6.02  List of useful faxes
  208. 6.03  List of 3.2 ptfs
  209. 6.04  Some RS232 hints
  210. 6.05  What publications are available for AIX and RS/6000?
  211. 6.06  Some acronyms
  212. 6.07  How do I get this by mailserver or ftp?
  213. 6.08  Hypertext version of the FAQ
  214. 6.09  Where can I send suggestions for tools?
  215.  
  216. 7.00  Contributors
  217.  
  218. ______________________________________________________________________________
  219. 1.000: The AIX operating system - what is it?
  220.  
  221. This is best answered by reading the text files in /usr/lpp/bos. The
  222. README file there contains general information and the BSD files contain
  223. useful information if you know BSD and/or System V.
  224.  
  225. The last release for the RT PC is 2.2.1. The latest release for PS/2s
  226. and Intel architecture machines is AIX 1.3; for PS/2s only, 1.2.1. For
  227. the RS/6000, there are two major levels, 3.1 and 3.2, and various
  228. intermediate levels.
  229.  
  230.  
  231. 1.001: I know neither Unix nor AIX - where do I find more information?
  232.  
  233. Quite a number of questions posted to comp.unix.aix show that AIX is
  234. people's first experience with Unix. If this is the case with you, you
  235. are advised to look at the other newsgroups in the comp.unix hierarchy,
  236. in particular comp.unix.questions (for basic questions) or
  237. comp.unix.wizards (for difficult questions). These two groups have a
  238. common FAQ posting as well.
  239.  
  240. If you need information about C programming, try comp.lang.c or comp.std.c,
  241. the latter for Standard ANSI C issues.  comp.lang.c has a FAQ posting.
  242.  
  243.  
  244. 1.002: What is the Object Database?
  245.  
  246. The Object Database Manager, ODM, stored in /etc/objrepos,
  247. /usr/lib/objrepos, and /usr/share/lib/objrepos is AIX's way of storing
  248. all the system management information. Under most circumstances, only
  249. SMIT or the commands SMIT call (see 1.100) should be used to change the
  250. ODM.
  251.  
  252. A harmless way to look at the ODM is to use odmget <Class> where <Class>
  253. is one of the files in /etc/objrepos.
  254.  
  255. Experienced users can use the ODM editor, odme, to navigate the ODM in
  256. detail. Modifying the ODM should only be attempted if you know exactly
  257. what you are doing.
  258.  
  259.  
  260. 1.003: How do I get rid of the verbose error messages?
  261.  
  262. Many of the messages from the Unix commands are available in different
  263. languages. This is controlled by the LANG environment variable, the
  264. default being En_US meaning English in the US. All the default messages
  265. have a message number associated with them, e.g.:
  266.  
  267. $ cat no-such-file
  268. cat: 0652-050 Cannot open no-such-file.
  269.  
  270. If you prefer the terser Unix-looking error message, set your
  271. environment LANG to C, and you will get:
  272.  
  273. $ cat no-such-file
  274. cat: Cannot open no-such-file.
  275.  
  276.  
  277. 1.004: Which release of AIX or other products do I have?
  278.  
  279. The command 'lslpp -h bos.obj' will show all lines referring to the BOS, 
  280. Basic Operating System.  E.g.:
  281.  
  282. Option Name          State      Event      Date      Release         User Name
  283. -------------------- ---------- ---------- --------- --------------- ---------
  284. bos.obj              INACTIVE   COMMIT     02/03/90  03.01.0000.0000 root
  285.                      INACTIVE   APPLY      06/25/90  03.01.0000.0001 root
  286.                      INACTIVE   COMMIT     06/25/90  03.01.0000.0001 root
  287.                      INACTIVE   APPLY      11/16/90  03.01.0002.0015 root
  288.                      INACTIVE   COMMIT     11/16/90  03.01.0002.0015 root
  289.                      ACTIVE     COMMIT     05/07/91  03.01.0005.0012 root
  290.  
  291. gives the history for the BOS lpp.  The last line, column four, indicates
  292. that this is release 3.1.5.
  293.  
  294. To see a listing of everything installed use lslpp -l '*', then use
  295. lslpp with the -h option as above to get a history of a particular lpp. 
  296.  
  297. 3.1.5 is considered the "base" release for users running 3.1.  You
  298. should be at least at this level.  If you request a ptf update you will
  299. get 2010.  If you are at some level earlier than 3.1.5, you must first
  300. apply 3.1.5, then 2010.  Customers using SNA should request the SNA
  301. Quality Refresh update.  Support for 3.1 will end on December 31, 1993.
  302.  
  303. For AIX 3.2, it's a completely different scheme. You may come across
  304. discussions on 3.2.0, 3.2.1, 3.2.2, or 3.2.3 extended. There is no
  305. absolute way to tell which of these you are running since the newer
  306. releases are simply 3.2.0 with some sets of PTFs added. These selective
  307. fixes could mean there are literally thousands of slightly different
  308. variations of 3.2 in use. Please see section 6 to request some useful
  309. faxes to help with this number game.
  310.  
  311. AIX 3.2.4 resolves this confusion with a new option for lslpp. Use
  312. 'lslpp -m bos.obj' to show what level and update the system is running. 
  313. You can also use the new oslevel command. Unless you have a pressing
  314. need (such as applications unsupported on 3.2.4), it is recommended that
  315. you update to this level.
  316.  
  317. ______________________________________________________________________________
  318. 1.100: I am used to Unix systems programming, why should I learn SMIT?
  319.  
  320. Using SMIT is probably very different from your normal way of doing
  321. system administration, but could prove very useful in the long run. In
  322. some areas, in particular TCP/IP, NFS, etc., you can also do things the
  323. normal way, but it is unfortunately difficult to know exactly when the
  324. normal way works. Again, always using SMIT is probably your best way
  325. to go, even when you have to learn a new tool. 
  326.  
  327. What SMIT actually does is build up commands with all required options
  328. to perform the functions requested and execute them. The commands
  329. called and the output they produce are stored in the files smit.script
  330. and smit.log in your home directory. Looking in smit.script may teach
  331. you more about system administration.
  332.  
  333.  
  334. 1.101: How do I turn off the "running man" in smit?
  335.  
  336. Use smitty, the standard curses version or add this line to your .kshrc file:
  337. alias smit="smit -C"
  338.  
  339.  
  340. 1.102: How do I import an /etc/passwd or /etc/group file from another box?
  341.  
  342. Make sure that you run usrck, pwdck (/etc/passwd), and grpck
  343. (/etc/group) to let AIX work its password/group magic.
  344.  
  345.  
  346. 1.103: Cleaning up utmp, who, and accounting problems
  347. From: fritz@scipp.UCSC.EDU (Frederick Staats)
  348.  
  349. This applies if you are running an X11R5 xterm on 3.2.
  350. Add this to the top of X11R5 mit/clients/xterm/main.c:
  351.  
  352. #ifdef AIXV3
  353. #define USE_SYSV_UTMP
  354. #define HAS_UTMP_UT_HOST
  355. #define WTMP_FILENAME "/var/adm/wtmp"
  356. #endif
  357.  
  358. And your utmp problems should go away.  If you want xterminal sessions
  359. to go into the wtmp file you need to define -DWTMP in the Imakefile and
  360. be sure the WTMP_FILENAME is set to the right place.
  361.  
  362. The following program by jfh@rpp386.cactus.org (John F. Haugh)
  363. if run in the background by root will clean up the utmp file.
  364.  
  365. #include <sys/types.h>
  366. #include <utmp.h>
  367. #include <fcntl.h>
  368.  
  369. main ()
  370. {
  371.         int     fd;
  372.         struct  utmp    utmp;
  373.  
  374.         while (1) {
  375.                 if ((fd = open ("/etc/utmp", O_RDWR)) < 0)
  376.                         exit (1);
  377.  
  378.                 while (read (fd, &utmp, sizeof utmp) == sizeof utmp) {
  379.                         if (utmp.ut_type == USER_PROCESS &&
  380.                                         kill (utmp.ut_pid, 0) != 0) {
  381.                                 lseek (fd, - (long) sizeof utmp, 1);
  382.                                 utmp.ut_type = DEAD_PROCESS;
  383.                                 write (fd, &utmp, sizeof utmp);
  384.                         }
  385.                 }
  386.                 close (fd);
  387.                 sleep (60);
  388.         }
  389. }
  390.  
  391. Another utmp program was posted to comp.sources.unix, volume 25, issue
  392. 96 by David W. Sanderson (dws@cs.wisc.edu) that also works on AIX 3.1.
  393.  
  394.  
  395. 1.104: How to fsck the root filesystem
  396.  
  397. You can run fsck either in maintenance mode or on mounted filesystems.
  398. To enter maintenance mode to run fsck on the root filesystem:
  399.  
  400.   1. boot from diskette
  401.   2. select maintenance mode
  402.   3. type /etc/continue hdisk0 exit (replace hdisk0 with boot disk if
  403.      not hdisk0)
  404.   4. fsck /dev/hd4
  405.  
  406.  
  407. 1.105: How can I unmount /usr to run fsck on it?
  408. From: accapadi@mathew.austin.ibm.com (Matt Accapadi)
  409. [ This is for 3.2. ]
  410.  
  411. In order to fsck /usr, it has to be unmounted. But /usr cannot be
  412. unmounted because /bin is symbolically linked to /usr/bin. Also
  413. /etc/fsck is symbolically linked to /usr/sbin/fsck.
  414.  
  415. To work around this, when you boot from the boot/maintenance diskettes
  416. and enter maintenance mode, enter "getrootfs hdisk0 sh" instead of
  417. "getrootfs hdisk0" where hdisk0 is the name of the boot disk. Then run
  418. "fsck /dev/hd2".
  419.  
  420.  
  421. 1.106: How do I shrink /usr?
  422. From: mike@bria.UUCP (Michael Stefanik) and Richard Hasting
  423.  
  424. FOR AIX 3.1
  425. -----------
  426.  
  427.  1) Make a backup of /usr
  428.  
  429.         find /usr -print | backup -ivf /dev/rmt0 (or appropriate device)
  430.  
  431.  2) shutdown to maintenance mode
  432.  
  433.         shutdown -Fm
  434.  
  435.  3) export LANG=C
  436.  
  437.  4) remove the filesystem and the logical volume
  438.     ignore an error about the "dspmsg" command not found
  439.  
  440.         umount /usr
  441.         rmfs /usr
  442.  
  443.  5) make a new logical volume hd2 and place it on rootvg with desired size
  444.  
  445.         mklv -yhd2 -a'e' rootvg NNN 
  446.  
  447.    where NNN is the number of 4 meg partitions
  448.  
  449.  6) create a filesystem on /dev/hd2
  450.  
  451.         crfs -vjfs -dhd2 -m'/usr' -Ayes -p'rw'
  452.  
  453.  7) mount the new /usr filesystem and check it
  454.  
  455.         /etc/mount /usr
  456.         df -v
  457.  
  458.  8) restore from the tape; system won't reboot otherwise
  459.  
  460.         restore -xvf/dev/rmt0
  461.  
  462.  9) Sync and reboot the system; you now have a smaller /usr filesystem
  463.  
  464. FOR AIX 3.2
  465. -----------
  466.  
  467.  1) Remove any unneeded files from /usr.
  468.  
  469.  2) Make sure all filesystems in the root volume group are mounted. If
  470.     not, they will not be included in the re-installed system.
  471.  
  472.  3) Type mkszfile. This will create /.fs.size that contains a list of
  473.     the active filesystems in the root volume group that will be
  474.     included in the installation procedure.
  475.  
  476.  4) Edit .fs.size. Change the size of /usr to what you want.
  477.  
  478.     Example: This .fs.size file shows /usr to be 40MB.
  479.  
  480.         rootvg 4 hd2 /usr 10 40 jfs
  481.  
  482.     The number 10 is the number of physical partitions for the filesystem
  483.     and the 40 is 40 MB. Most systems have a physical partition size of
  484.     4 MB. Therefore, the second number (40) will always be 4 times the
  485.     previous number (10). Note, however, that a model 320 with a 120 MB
  486.     drive will have a physical partition size of only 2 MB, and the
  487.     total MB is twice the number of physical partitions. The first
  488.     number (4) in the .fs.size file represents the PP size.
  489.  
  490.     If you want to reduce the size of /usr from 40 MB to 32 MB, edit the
  491.     /usr entry to:
  492.  
  493.         rootvg 4 hd2 /usr 8 32 jfs
  494.  
  495.     IMPORTANT: Make sure that you DO NOT enter a value which is less
  496.     than the size of the filesystem required to contain the current
  497.     data. Doing so will cause the re-installation procedure to fail.
  498.  
  499.  5) chdev -l rmt0 -a block=512 -T
  500.  
  501.  6) Unmount all filesystems that are NOT in the root volume group.
  502.  
  503.  7) Varyoff all user-defined volume groups, if any
  504.  
  505.         varyoffvg VGname
  506.  
  507.  8) Export the user-defined volume groups, if any
  508.  
  509.         exportvg VGname
  510.  
  511.  9) With a tape in the tape drive, type
  512.  
  513.         mksysb /dev/rmt0
  514.  
  515.      This will do a complete system backup, which will include
  516.      information (in the .fs.size file) for the installation procedure
  517.      on how large the filesystems are to be created.
  518.  
  519.  10) Follow the instructions in the Installation Kit under "How to
  520.      Install and perform maintenance from Diskettes" using the
  521.      diskettes and tape that you created in the previous steps.
  522.      DO NOT select the option "Reinstall AIX with Current System
  523.      Settings". Instead use "Install AIX with Current System Settings"
  524.      for the logical volume size changes to take affect.
  525.  
  526.  11) When the installation is complete, you may then import the
  527.      information into your newly installed operating system for any
  528.      user-defined volume groups.
  529.  
  530.          importvg -y VGname PVname
  531.  
  532.      where "VGname" is the name of the volume group, and "PVname" is
  533.      the name of any one of the physical volumes in the volume group.
  534.  
  535.  12) Varyon your user-defined volume groups
  536.  
  537.          varyonvg VGname
  538.  
  539.  The reduction of the filesystems is now complete.
  540.  
  541.  
  542. 1.107: How do I make a filesystem larger than 2 Gig?
  543.  
  544. The largest filesystem under AIX is 2 Gigabytes because the largest
  545. signed integer is 2**31 - 1.
  546.  
  547.  
  548. 1.108: How do I see/change system parameters like number of processes
  549.        per user?
  550.  
  551. You can use SMIT as described below or simply use the lsattr/chdev pair. 
  552. The former will list the current setting as in:
  553.  
  554.   # lsattr -E -l sys0 -a maxuproc
  555.   maxuproc 40 Maximum # of processes allowed per user True
  556.  
  557. and you can then increase the maxuproc parameter:
  558.  
  559.   # chdev -l sys0 -a maxuproc=200
  560.   sys0 changed
  561.  
  562. If you just type 'lsattr -E -l sys0' you will get a list of all
  563. parameters, some of which can be changed but not others.
  564.  
  565. If you want to use smit, this procedure can be followed:
  566.  
  567. smit
  568.   System Environments and Processes
  569.     Change / Show Operating System Parameters
  570.       - on this screen you can change by overtyping the following fields:
  571.         - Maximum number of PROCESSES allowed per user
  572.         - Maximum number of pages in block I/O BUFFER CACHE
  573.         - Maximum Kbytes of real memory allowed for MBUFS
  574.       - toggle fields exist for:
  575.         - Automatically REBOOT system after a crash  (false/true)
  576.         - Continuously maintain DISK I/O history (true/false)
  577.  
  578.  
  579. 1.109: How do I shrink the default paging space on hd6?
  580.  
  581. 1) create a paging space to use temporarily
  582.    mkps -s 20 -a rootvg
  583.  
  584. 2) change default paging space hd6 so it is not used at next reboot
  585.    chps -a n hd6
  586.  
  587. 3) For AIX 3.1, edit /etc/rc.boot4 and change swapon /dev/hd6;
  588.    for AIX 3.2, edit /sbin/rc.boot and change swapon /dev/hd6
  589.    swapon /dev/paging00
  590.  
  591. 4) Update information in boot logical volume
  592.    bosboot -a             (3.1)
  593.    bosboot -a -d hdisk0   (3.2)
  594.  
  595. 5) shutdown and reboot
  596.  
  597. 6) remove current hd6 and create a new one of smaller size
  598.    rmps hd6
  599.    mklv -y hd6 -t paging rootvg <size of PS in 4 Meg blocks>
  600.  
  601. 7) Re-edit /etc/rc.boot4 (3.1), /sbin/rc.boot (3.2) to swap to /dev/hd6
  602.    swapon /dev/hd6
  603.  
  604. 8) Update information in boot logical volume
  605.    bosboot -a             (3.1)
  606.    bosboot -a -d hdisk0   (3.2)
  607.  
  608. 9) change current paging device (paging00) so it is inactive at next boot
  609.    chps -a n /dev/paging00
  610.  
  611. 10) shutdown, reboot, remove paging00 using the command:
  612.     rmps paging00
  613.  
  614.  
  615. 1.110: The swapper seems to use enormous amounts of paging space, why?
  616.  
  617. When you run ps, you may see a line like:
  618.  
  619. USER   PID %CPU %MEM    SZ   RSS     TT STAT  TIME CMD
  620. root     0 0.0%  14% 386528  8688      -    S 17:06 swapper
  621.  
  622. This is normal behavior, the swapper looks to ps like it has the entire
  623. paging space plus real memory allocated.
  624.  
  625.  
  626. 1.111: How much paging space do I need?
  627.  
  628. See answer 2 in question 1.300.
  629.  
  630.  
  631. 1.112: How do I mount a floppy disk as a filesystem?
  632. From: op@holmes.acc.Virginia.EDU (Olaf Pors)
  633.  
  634. You can build a filesystem on a floppy and mount it, however the
  635. filesystem will be read only. The reason that the filesystem will be
  636. read only is because AIX Version 3.1.5 cannot create a journal log on a
  637. diskette. The intended use is for temporary access to read only data. 
  638. The diskette file system must be unmounted after use and during system
  639. backup procedures or errors could occur.
  640.  
  641. To make the read only filesystem on a floppy:
  642.  
  643. 1. Make a subdirectory on an existing filesystem and place all of the
  644.    files that the diskette will contain into this subdirectory.
  645.  
  646. 2. Enter the following command to create a prototype file containing
  647.    information about the new filesystem, in the example /dir_struct
  648.    is the pathname of the subdirectory created in step 1, and
  649.    proto_filename is the name of the prototype file to be created.
  650.  
  651.          proto /dir_struct > proto_filename
  652.  
  653. 3. Place a formatted floppy into the drive.
  654.  
  655. 4. Edit the prototype file and replace the first line with the following:
  656.  
  657.          <noboot> 0 0
  658.  
  659. 5. Enter the following command to make the filesystem on your floppy:
  660.  
  661.           mkfs -p proto_filename -V jfs /dev/fd0
  662.  
  663. 6. Create the directory upon which you will mount the floppy based
  664.    filesystem, or you can use /mnt. Mount the filesystem:
  665.  
  666.           mount -r -V jfs /dev/fd0 /your_mount_point
  667.  
  668. 7. To unmount the filesystem:
  669.  
  670.           umount /dev/fd0
  671.  
  672. Since the filesystem is read-only it may be of limited use but if you
  673. are going to use it for utility programs and other data that does not
  674. change much, it may still be useful. If you need to change the data,
  675. you can copy the directory from the floppy into another directory, make
  676. your modifications, and remake the filesystem using this procedure.
  677.  
  678.  
  679. 1.113: How do I remove a committed lpp?
  680. From: drb@chmeds.ac.nz (Ross Boswell)
  681.  
  682. This seems to be a common problem. The following script for 3.2 only is
  683. from IBM NZ AIX software support. As far as I know, it works -- I used
  684. it to remove unwanted fonts. I have no official permission to post it
  685. -- use it at your own risk!
  686.  
  687. #!/bin/ksh
  688. #
  689. # Permanently remove a product from disk and AIX databases
  690. #
  691.  
  692. if [ `whoami` != "root" ] ; then
  693.   echo You must be root to run this script.
  694.   exit 1
  695. fi
  696.  
  697. if [ `uname -a | awk '{print $1$4$3}'` != "AIX32" ] ; then
  698.   echo This script only works on AIX 3.2.
  699.   exit 1
  700. fi
  701.  
  702. TMP_FREE=`df /tmp | awk '$3 ~ /[0-9]/{print $3}'`
  703. if [ "$TMP_FREE" -lt 1000 ] ; then
  704.    echo There is not enough room in your /tmp directory.
  705.    echo You need 1000 KB free, and you have only $TMP_FREE KB free.
  706.    echo Either remove some stuff from /tmp, or use chfs to make it bigger.
  707.    exit 1
  708. fi
  709.  
  710. ODMDIRS="/etc/objrepos /usr/lib/objrepos /usr/share/lib/objrepos"
  711. ODMDIR=/usr/lib/objrepos
  712. export ODMDIR
  713.  
  714. if [ $# -lt 1 ]
  715. then
  716.   echo usage: $0 lppname [lppname ...]
  717.   echo lppname is a string compatible with grep, ie "X11" or "PHIGS"
  718.   echo typing   $0 PHIGS   will remove all LPPs with PHIGS in their name.
  719.   exit 1
  720. fi
  721.  
  722. NAMES=$1
  723. shift
  724. while [ $# -gt 0 ] ; do
  725.   NAMES="$NAMES|$1"
  726.   shift
  727. done
  728. echo "Searching for lpps with egrep \"$NAMES\"...\c"
  729.  
  730. for ODMDIR in $ODMDIRS ; do
  731.   if [ ! -d $ODMDIR -o ! -w $ODMDIR ] ; then
  732.      echo $ODMDIR is not writeable or is not a directory.
  733.      echo I hope this is because you are a /usr client or diskless.
  734.      echo If you are not a diskless or a /usr client, you should stop.
  735.      echo "Enter y to continue ->\c"
  736.      read answer
  737.      if [ "$answer" != "y" ] ; then
  738.        exit 0
  739.      fi 
  740.   fi
  741.   TMP=`odmget lpp | awk -F\" '/name/ {print $2}' | egrep "$NAMES"`
  742.   LPPS=`echo $LPPS $TMP`
  743. done
  744.  
  745. if [ "$LPPS" = "" ]
  746. then
  747.   echo "failed.\nNo LPP with the name $NAMES detected."
  748.   exit 1
  749. fi
  750. echo ok.
  751.  
  752. for ODMDIR in $ODMDIRS ; do
  753.   mkdir -p /tmp/rmlpp/$ODMDIR > /dev/null 2>&1
  754. done
  755.  
  756. > /tmp/listOfFilesToRM$$    # truncate temporary file, just in case.
  757. echo
  758. echo This script is about to attempt to remove an LPP from your system.
  759. echo I say attempt, because it could fail.  If it fails, you may have
  760. echo to at least reload the LPP.  Use the \"lppchk\" command to make sure
  761. echo all is well with your system.
  762. echo
  763. # Loop through all the LPP names found.
  764. for LPP in $LPPS
  765. do
  766.   DESCR=none
  767.   answer=""
  768.  
  769.   # find the LPP ids.  They will be different in the three SWVPD databases.
  770.   for ODMDIR in $ODMDIRS ; do
  771.     # get the lpp id for this ODMDIR (yes, they are different)
  772.     LPPID=`odmget -q name=$LPP lpp | grep lpp_id | sed 's/.* = //'`
  773.  
  774.     # did we find the LPP?
  775.     if [ "$DESCR" = "none" -a "$LPPID" != ""  ] ; then
  776.       # all the descriptions should be the same
  777.       DESCR=`odmget -q name=$LPP lpp | grep description | sed 's/.* = //'`
  778.       echo "Delete $LPP, $DESCR?"
  779.       echo "y or (n) ->\c"
  780.       read answer
  781.       if [ "$answer" != "y" ] ; then # jump back up to the next LPP name
  782.         continue 2
  783.       fi
  784.     fi
  785.     # if there is no DESCR, then we didn't find the LPP.  Weird.
  786.     if [ "$DESCR" = "none" -o "$LPPID" = "" ] ; then
  787.       continue
  788.     fi
  789.         SOMETHING_DONE_FLAG=true
  790.     # Optionally, save the ODM stuff we are about to remove,
  791.     # in case something goes wrong.  The problem is it is difficult
  792.     # to determine if something really did fail, since these commands
  793.     # don't return any decent error return codes.
  794.     odmget -q lpp_id=$LPPID history   > /tmp/rmlpp/$ODMDIR/$LPP.history
  795.     odmget -q name=$LPP lpp           > /tmp/rmlpp/$ODMDIR/$LPP.lpp
  796.     odmget -q lpp_name=$LPP product   > /tmp/rmlpp/$ODMDIR/$LPP.product
  797.     # Get the list of files and links to remove later....
  798.     odmget -q lpp_id=$LPPID inventory > /tmp/rmlpp/$ODMDIR/$LPP.inventory
  799.     awk -F\" '/loc/ {print $2}' /tmp/rmlpp/$ODMDIR/$LPP.inventory | \
  800.       sed 's/,/ /g' >> /tmp/listOfFilesToRM$$
  801.     odmdelete -o history -q lpp_id=$LPPID   > /dev/null 2>&1
  802.     odmdelete -o lpp -q name=$LPP           > /dev/null 2>&1
  803.     odmdelete -o product -q lpp_name=$LPP   > /dev/null 2>&1
  804.     odmdelete -o inventory -q lpp_id=$LPPID > /dev/null 2>&1
  805.   done
  806. done
  807.  
  808. if [ "$SOMETHING_DONE_FLAG" = "true" ] ; then
  809.  
  810.   echo ODM work is done.  Now, time to delete files....
  811.  
  812.   # This could be catastrophic if there is a problem.  For example,
  813.   # if the ODM database for an application had / as one of its files.
  814.   # You be the judge.  Here's your rope....
  815.   cat /tmp/listOfFilesToRM$$ | sort -r | uniq | xargs rm -rf
  816.  
  817.   rm -rf /tmp/listOfFilesToRM$$
  818.   echo done.
  819. fi
  820.  
  821. # take this line out if you want to save your ODM saved files.
  822. rm -rf /tmp/rmlpp
  823.  
  824. exit 0
  825.  
  826.  
  827. 1.114: How can I recover space after installing updates?
  828. From: Milt Cloud <cloud@ux1.cso.uiuc.edu>
  829.  
  830. Note: If you are a /usr server, do not use this because the files
  831.       mentioned below are needed by /usr clients and cannot be deleted.
  832.  
  833. Installp creates numerous files in /usr to clean up after
  834. failed/rejected installs and also for de-installing uncommitted lpps. 
  835. Once you have COMMITted packages you can remove these files safely. 
  836. Depending on your installation activity the numbers can be significant
  837. here: hundreds-to-thousands of files, megabytes of data.
  838.  
  839. Files eligible for removal are associated with each "product" you have
  840. installed; the largest collection being due to bos.  After
  841. COMMITting bos lpps, you may safely remove all files of the form:
  842.  
  843.               /usr/lpp/bos/deinstl*
  844.               /usr/lpp/bos/inst_U4*
  845.               /usr/lpp/bosadt/deinstl*
  846.         and   /usr/lpp/bosadt/inst_U4*
  847.  
  848. You may repeat this for all additional COMMITted products (e.g.,
  849. bostext1, bosnet, xlc) you have on your system.
  850.  
  851. This problem of lingering install files is a known defect in installp. 
  852. If you have installed PTF U411711 (or any superceder of it: U412397,
  853. U413366, U413425) the deadwood in /usr will not be quite as prevalent. 
  854. No single PTF currently available completely corrects this problem.
  855.  
  856. On my own 320, the following freed up 12.4M in /usr:
  857.  
  858.        # rm -R /usr/lpp/bos/deinstl*
  859.        # rm -R /usr/lpp/bos/inst_U4*
  860.  
  861.  
  862. 1.115: Where are the AIX log files kept?
  863. From: dirk@kimosabi.ucsc.edu (Dirk Coldewey)
  864.  
  865. Such as the equivalent of the SunOS file '/var/log/syslog' and 
  866. '/var/adm/messages'.
  867.  
  868. If you want regular unix syslog files, you can configure syslogd
  869. in /etc/syslog.conf. Here's the one that I use:
  870.  
  871. #
  872. # See the supplied /etc/syslog.conf file for copious comments.
  873. #
  874. *.err;kern.debug;auth.notice;user.none          /dev/console
  875. *.err;kern.debug;daemon,auth.notice;mail.crit;user.none /var/adm/messages
  876. lpr.debug                                       /var/adm/lpd-errs
  877.  
  878. *.alert;kern.err;daemon.err;user.none           operator
  879. *.alert;user.none                               root
  880.  
  881. *.emerg;user.none                               *
  882.  
  883. # for loghost machines, to have authentication messages (su, login, etc.)
  884. # logged to a file, un-comment out the following line and adjust the 
  885. # file name as appropriate.
  886. #
  887. # if a non-loghost machine chooses to have such messages 
  888. # sent to the loghost machine, un-comment out the following line.
  889. #
  890. auth.notice                     /var/log/authlog
  891.  
  892. mail.debug                      /var/log/syslog
  893.  
  894. # following line for compatibility with old sendmails. they will send
  895. # messages with no facility code, which will be turned into "user" messages
  896. # by the local syslog daemon. only the "loghost" machine needs the following
  897. # line, to cause these old sendmail log messages to be logged in the
  898. # mail syslog file.
  899. #
  900. user.alert                       /var/log/syslog
  901. #
  902. # non-loghost machines will use the following lines to cause "user"
  903. # log messages to be logged locally.
  904. #
  905. user.err                         /dev/console
  906. user.err                         /var/adm/messages
  907. user.alert                       `root, operator'
  908. user.emerg                       *
  909.  
  910.  
  911. 1.116: How can I log information about ftp accesses to a file?
  912. From: elr@trintex.uucp (Ed Ravin) and
  913.       map@hal.maths.monash.edu.au (Michael Page)
  914.  
  915. 1) In /etc/syslog.conf, add the line:
  916.    daemon.debug         /tmp/daemon.log
  917.  
  918. 2) # touch  /tmp/daemon.log
  919.    # refresh -s syslogd
  920.  
  921. 3) Modify your inetd.conf so that ftpd is called with the "-l" flag.
  922.    You may also want the "-d" flag. This can be done with 'smit inetdconf'.
  923.  
  924. All the syslog messages from various system daemons should now appear in
  925. the file "/tmp/daemon.log".
  926.  
  927.  
  928. 1.117: How do I find a file name from the inode number?
  929. From: svpillay@berlioz.crs4.it (Kanthan Pillay)
  930.  
  931.      find /mntpoint -xdev -inum nnnn -print
  932.  
  933.  
  934. 1.118: How do I set up postscript accounting?
  935. From: taluskie@utpapa.ph.utexas.edu (Vince Taluskie)
  936.  
  937. The following program to configure postscript page accounting was
  938. originally written by Ephraim Vider. It acts as a backend wrapper which
  939. logs accounting information in /etc/qconfig. It can be ftp'd from
  940. utpapa.ph.utexas.edu in /pub/aix/psacct.tar.Z.
  941.  
  942. To get this program running compile it with
  943.  
  944. cc  pswrap.c -o pswrap -lqb
  945.  
  946. and then make this program suid root with
  947.  
  948. chown root pswrap
  949. chmod u+s pswrap
  950.  
  951. If this step is not done, the printer will hang.
  952.  
  953. Then start up SMIT and go to :
  954.  
  955. Spooler
  956.   Manage Local Printer Subsystem
  957.     Local Printer Queue Devices
  958.       Change / Show Characteristics of a Queue Device
  959.         <Select Queue>
  960.           <Select Device>
  961.  
  962. and change "BACKEND PROGRAM pathname" to the full pathname of pswrap
  963. since pswrap will now handle the backend interface with the queue.
  964.  
  965. A stream of info will be written to a logfile in /tmp (prob lp0.log) but
  966. this file is mainly used for status info and raw pagecounts. If the
  967. accounting data is going to the qconfig-specified acctfile, then use the
  968. 'pac' command to read it. I prefer to have readable ascii data files
  969. instead, so I just comment out the '#define WANT_PAC' line and it will
  970. only go to the ACCTFILE specfied in pswrap.c.
  971.  
  972. /*  pswrap.c
  973.  
  974.  compile with:   cc pswrap.c -o pswrap -lqb
  975.  (for doc on the qb library see "understanding backend routines in libqb")
  976.  
  977.  BTW:  The log_charge() function doesn't seem to do anything,
  978.        but log_pages() updates the accounting info.
  979.  
  980. Ephraim Vider, original author 
  981.  
  982. --
  983. Feb 10, 1993
  984.  
  985. You can set pswrap up to use either the accounting file specified in
  986. /etc/qconfig (which means that you need to get your data from 'pac') or
  987. you can comment out the #define WANT_PAC line and then the accounting
  988. data will only go into the ACCTFILE.
  989.  
  990. Also modified the logging to the ASCII acctfile so that it looks more
  991. readable.
  992.  
  993. Vince Taluskie
  994. */
  995.  
  996.  #include <stdio.h>
  997.  #include <string.h>
  998.  #include <ctype.h>
  999.  #include <fcntl.h>
  1000.  #include <signal.h>
  1001.  #include <setjmp.h>
  1002.  #include <sys/wait.h>
  1003.  #include <IN/backend.h>
  1004.  #include <IN/standard.h>
  1005.  #include "qprocs.h"
  1006.  
  1007.  char     *nextword (char *p);
  1008.  char     *skipvalue (char *p);
  1009.  
  1010.  #define LOGDIR     "/tmp"
  1011.  #define ACCTFILE   "/usr/adm/acct/lpr/ps-acct"
  1012. /* #define WANT_PAC     1 */     /* this define will also send accounting
  1013.                                  info to the acctfile specified in
  1014.                                  /etc/qconfig file.  If this define is 
  1015.                                  commented out then accounting info will
  1016.                                  only go to ACCTFILE  */
  1017.  
  1018.  
  1019.  char     pcprog[] = "statusdict begin pagecount = end\n\x04";
  1020.  
  1021.  char     *keyw[] = {
  1022.      "idle",
  1023.      "busy",
  1024.      "waiting",
  1025.      "printing",
  1026.      "initializing",
  1027.      NULL
  1028.  };
  1029.  enum     { PS_IDLE, PS_BUSY, PS_WAIT, PS_PRINT, PS_INIT, PS_UNKNOWN };
  1030.  
  1031.  void     giveup();
  1032.  jmp_buf  jumper;
  1033.  
  1034.  char     logfname[30];
  1035.  FILE     *logfile, *acctfile;
  1036.  
  1037.  main (argc, argv)
  1038.  int argc;
  1039.  char     *argv[];
  1040.  {
  1041.      char *devname;
  1042.      int  pagcnt, c;
  1043.      int  pid;
  1044.      int  w, status;
  1045.  
  1046.      if (argc < 2) {
  1047.           fprintf(stderr, "Usage: psbe file\n");
  1048.           exit(-1);
  1049.      }
  1050.      if (log_init(argv[1]) < 0) {
  1051.           fprintf(stderr, "log_init failed!\n");
  1052.           exit(EXITBAD);
  1053.      }
  1054.      sprintf(logfname, "%s/%s.log", LOGDIR, get_device_name());
  1055.      if ((logfile = fopen(logfname, "a")) == NULL) {
  1056.           fprintf(stderr, "Can't open logfile.\n");
  1057.           exit(EXITBAD);
  1058.      }
  1059.  
  1060.      if ((acctfile = fopen(ACCTFILE, "a")) == NULL) {
  1061.          fprintf(stderr, "Can't open logfile.\n");
  1062.          exit(EXITBAD);
  1063.          }
  1064.  
  1065.      setvbuf(logfile, NULL, _IOLBF, BUFSIZ);
  1066.      setvbuf(acctfile, NULL, _IOLBF, BUFSIZ);
  1067.  
  1068.      setvbuf(stdin, NULL, _IONBF, 0);
  1069.      setvbuf(stdout, NULL, _IONBF, 0);
  1070.      fprintf(logfile, "start Job no. %d, queued on %s\n", get_job_number(),
  1071.                get_qdate());
  1072.      log_status(WAITING);
  1073.      pagcnt = getpagecnt();
  1074.      log_status(RUNNING);
  1075.      if ((pid = fork()) < 0) {
  1076.           perror("fork");
  1077.           exit(EXITBAD);
  1078.      }
  1079.      if (pid == 0) {
  1080.           argv[0] = "piobe";
  1081.           execv("/usr/lpd/piobe", argv);
  1082.           perror("exec");
  1083.           exit(EXITBAD);
  1084.      }
  1085.      while ((w = wait(&status)) != pid)
  1086.           if (w == -1) {
  1087.                perror("wait");
  1088.                exit(EXITBAD);
  1089.           }
  1090.      if (WEXITSTATUS(status) != 0)
  1091.           exit(WEXITSTATUS(status));
  1092.      log_status(WAITING);
  1093.  
  1094.      if (pagcnt > 0 && (c = getpagecnt()) > 0) {
  1095. #ifdef WANT_PAC 
  1096.           log_pages(c - pagcnt);
  1097. #endif
  1098.         }
  1099.  
  1100.      fprintf(logfile, "end Job no. %d, queued on %s\n", get_job_number(),
  1101.                get_qdate());
  1102.  
  1103. /* the accounting file format is 
  1104.  
  1105. pages_printed     user     queue_printed_on   time_queued
  1106.  
  1107. */
  1108.  
  1109.      fprintf(acctfile, "%d %35s %7s    %s \n", (c - pagcnt), get_from()
  1110.  get_queue_name(), get_qdate());
  1111.  
  1112.      fclose(logfile);
  1113.      fclose(acctfile);
  1114.      exit(EXITOK);
  1115.  }
  1116.  
  1117.  void     giveup ()
  1118.  {
  1119.      longjmp(jumper, 1);
  1120.  }
  1121.  
  1122.  getpagecnt ()
  1123.  {
  1124.      int  pc = 0, pstat;
  1125.      char buf[81];
  1126.  
  1127.      if (setjmp(jumper) != 0) {
  1128.           fprintf(logfile, "giving up on status\n");
  1129.           return (0);
  1130.      }
  1131.      alarm(60 * 2);
  1132.      signal(SIGALRM, giveup);
  1133.      do {
  1134.           if (!gets(buf)) {
  1135.                sleep(5);
  1136.                putchar('\x14');    /* ^T returns status */
  1137.                sleep(1); /* wait for answer from printer */
  1138.                if (!gets(buf))
  1139.                     return (0);
  1140.           }
  1141.           fprintf(logfile, "%s\n", buf);
  1142.           if ((pstat = getstatus(buf)) == PS_WAIT) {
  1143.                putchar('\x04');
  1144.                sleep(1);
  1145.           }
  1146.      } while (pstat != PS_IDLE);
  1147.      alarm(0);
  1148.      while (gets(buf))
  1149.           fprintf(logfile, "%s\n", buf);
  1150.      printf("%s", pcprog);
  1151.      sleep(1); /* wait for answer from printer */
  1152.      if (!gets(buf))
  1153.           return (0);
  1154.      if (sscanf(buf, "%d", &pc) != 1)
  1155.           return (0);
  1156.      fprintf(logfile, "%d\n", pc);
  1157.      return (pc);
  1158.  }
  1159.  
  1160.  /*
  1161.   * Parser for printer status messages
  1162.   */
  1163.  
  1164.  getstatus (p)
  1165.  char     *p;
  1166.  {
  1167.      char *t;
  1168.      int  i;
  1169.  
  1170.      if ((p = strchr(p, '%')) == NULL)
  1171.           return (PS_UNKNOWN);
  1172.      if (strncmp(p, "%%[", 3) != 0)
  1173.           return (PS_UNKNOWN);
  1174.      for (p = nextword(p + 3) ; p != NULL ; p = skipvalue(p)) {
  1175.           t = p;
  1176.           p = strchr(p, ':');
  1177.           *p++ = '\0';
  1178.           p = nextword(p);
  1179.           if (strcmp(t, "status") == 0)
  1180.                break;
  1181.      }
  1182.      if (p == NULL)
  1183.           return (PS_UNKNOWN);
  1184.      t = p;
  1185.      p = strchr(p, ' ');
  1186.      if (p[-1] == ';')
  1187.           p--;
  1188.      *p = '\0';
  1189.      for (i = 0 ; keyw[i] != NULL ; i++)
  1190.           if (strcmp(t, keyw[i]) == 0)
  1191.                break;
  1192.      return (i);
  1193.  }
  1194.  
  1195.  char     *nextword (p)
  1196.  char     *p;
  1197.  {
  1198.      while (isspace(*p))
  1199.           p++;
  1200.      if (strncmp(p, "]%%", 3) == 0)
  1201.           return (NULL);
  1202.      return (p);
  1203.  }
  1204.  
  1205.  char     *skipvalue (p)
  1206.  char     *p;
  1207.  {
  1208.      char *t;
  1209.  
  1210.      while (p != NULL) {
  1211.           p = strchr(p, ' ');
  1212.           t = p;
  1213.           p = nextword(p);
  1214.           if (t[-1] == ';')
  1215.                break;
  1216.      }
  1217.      return (p);
  1218.  }
  1219.  
  1220.  /*********    qprocs.h    ***********/
  1221.  /* functions for communication between qdaemon and the backend */
  1222.  
  1223.  char     *get_from();
  1224.  char     *get_to();
  1225.  char     *get_qdate();
  1226.  char     *get_queue_name();
  1227.  char     *get_device_name();
  1228.  char     *get_title();
  1229.  
  1230.  
  1231. 1.119: How do I create boot diskettes for 3.2?
  1232.  
  1233. You need to have four formatted diskettes.
  1234.  
  1235. boot disk:                bosboot -d /dev/fd0 -a
  1236. display disk:             mkdispdskt
  1237. display extension disk:   mkextdskt
  1238. Install/Maintenance disk: mkinstdskt
  1239.  
  1240.  
  1241. 1.120: Where can I find tools for performance monitoring?
  1242.  
  1243. For 3.2 a few tools are available in /usr/lpp/bosperf. There are tools
  1244. to monitor traces, I/O events, CPU, virtual memory, disk block usage,
  1245. kernel extensions, etc. It even has a simulator, rmss, that allows one
  1246. to try out different memory size configurations to see how it impacts
  1247. performance. See 6.05 for the AIX Performance and Tuning Guide.
  1248.  
  1249.  
  1250. 1.121: How can I tell what virtual printer a print queue is using?
  1251. From: yoder@austin.ibm.com (Stuart R. Yoder)
  1252.  
  1253. Use the command 'lsvirprt'. Don't use any parameters and it will
  1254. run in an interactive mode that will give you a menu of all virtual
  1255. printers on the system with the queue and device for each one.
  1256.  
  1257.  
  1258. 1.122: Two srcmstr's are less useful than one?
  1259. From: hubert@rs530.ncs.mainz.ibm.com (Bernhard Zeller)
  1260.  
  1261. This can happen on systems that have no console, or systems with an
  1262. async terminal as the console but not attached or turned off. One of the
  1263. symptoms is a second srcmstr got run. But the second srcmstr is worthless
  1264. as we can't use the stop/startsrc commands, refresh inetd, qdaemon won't
  1265. start, etc.
  1266.  
  1267. To resolve this, type:
  1268.  
  1269.     smit chgtty
  1270.  
  1271. and add the keyword 'clocal' in following lines:
  1272.  
  1273.    STTY attributes for RUN TIME
  1274.    STTY attributes for LOGIN
  1275.  
  1276.  
  1277. 1.123: How do I set the tty name associated with a physical port?
  1278. From: accapadi@mathew.austin.ibm.com (Matt Accapadi)
  1279.  
  1280. Let's say you wanted to make a tty on the s1 port and call it rs0000
  1281. and a tty on the s2 port and call it rs0001.
  1282.  
  1283. You could run:
  1284.  
  1285. mkdev -c tty -s rs232 -t tty -l rs0000 -p sa0 -w s1   # creates rs0000
  1286. and
  1287. mkdev -c tty -s rs232 -t tty -l rs0001 -p sa1 -w s2   # creates rs0001
  1288.  
  1289.  
  1290. 1.124: How do I use mksysb to clone a system?
  1291. From: joann@ariadne.SLAC.Stanford.EDU (Jo Ann Malina)
  1292.  
  1293. I use the following steps on the master machine to clone an AIX system:
  1294. 1) Remove the password from root.
  1295. 2) Remove the NIS line from the end of the /etc/group file (the last
  1296.    line with the +: )
  1297. 3) Change most of the level '2' designations in /etc/inittab to level
  1298.    '3' to prevent them from being started up when the new system is
  1299.    booted (the minimum ones to change are rc.nfs and rc.tcpip)
  1300. 4) Boot in service mode and change the name and ip address to a "spare"
  1301.    set to avoid address collision.
  1302. 5) Clear /tmp, /usr/tmp and /usr/spool/lpd/stat.
  1303. 6) Run mkszfile and edit it to be sure /usr is as small as possible;
  1304.    then mksysb from the command line.
  1305.  
  1306. The above changes allow me to boot in normal mode the first time, get in
  1307. as root, change the above files back and do the other things necessary
  1308. to configure the new system.
  1309.  
  1310. Then, of course, I go back and clean up and reboot my master machine.
  1311.  
  1312. Note: 1 and 2 lets you log in even if you can't get on the network. 
  1313.    It prevents the login process from trying to reach an NIS server. 
  1314.    Step 2 needed only if you use NIS.
  1315.  
  1316.  
  1317. 1.125: How do I retain timestamps with mksysb?
  1318. From: graeme@ccu1.aukuni.ac.nz ( Graeme Moffat)
  1319.  
  1320. In /usr/lpp/bosinst/bosnet (for net installs), and bosrest (tape), the
  1321. 'pax' commands all have '-pmop' options.  m = "DON'T retain modification
  1322. times".  So, simply change all the '-pmop' to '-pop' and remake
  1323. inst/maint diskettes or mksysb tapes.
  1324.  
  1325.  
  1326. 1.126: How can I find out the machine type?
  1327. From: umar@compsci.cas.vanderbilt.edu (Sait Umar)
  1328.  
  1329. #!/bin/sh
  1330. #
  1331. #  Author G. Vitillaro              (peppe@ipgaix.unipg.it)
  1332. #  from an idea of Marc Pawliger    (marc@ibmpa.awdpa.ibm.com)
  1333. #
  1334. #  10/12/92  GVT  First (and last) implementation
  1335. #
  1336. # machine : will get machine type on RISC/6000
  1337. #
  1338. #
  1339. awk '
  1340.         BEGIN {
  1341.                 m["10"]="7013/530 or 7016/730";
  1342.                 m["11"]="7013/540";
  1343.                 m["14"]="7013/540";
  1344.                 m["18"]="7013/530H";
  1345.                 m["1C"]="7013/550";
  1346.                 m["20"]="7015/930";
  1347.                 m["2E"]="7015/950";
  1348.                 m["2E"]="7015/950E";
  1349.                 m["30"]="7013/520";
  1350.                 m["31"]="7012/320";
  1351.                 m["34"]="7013/520H";
  1352.                 m["35"]="7012/320H or 320E";
  1353.                 m["37"]="7012/340";
  1354.                 m["38"]="7012/350";
  1355.                 m["41"]="7011/220";
  1356.                 m["45"]="7011/M20";
  1357.                 m["5C"]="7013/560";
  1358.                 m["63"]="7015/970";
  1359.                 m["64"]="7015/980";
  1360.                 m["66"]="7015/580";
  1361.                 m["67"]="7015/570";
  1362.                 m["75"]="7012/370, 375, or 37T";
  1363.                 m["76"]="7012/360, 365, or 36T";
  1364.                 m["77"]="7012/350, 355, or 7013/550L";
  1365.                 m["78"]="7012/315 or 7013/510 ";
  1366.                 if ( m[code] != "" )
  1367.                         print "This RISC/6000 is a " m[code];
  1368.                 else
  1369.                         print "Unknown Machine";
  1370.         }
  1371. ' code=`uname -m | cut -c9-10` < /dev/null
  1372.  
  1373.  
  1374. 1.200: Some info about tape backups
  1375. From: Craig Anderson
  1376.  
  1377. The following supplements the information on rmt devices in
  1378. InfoExplorer. It is based on my own personal experience with IBM tape
  1379. drives running on AIX 3.1. No warranty is expressed or implied.
  1380.  
  1381. CONFIGURING THROUGH SMIT:
  1382.     BLOCK size (0=variable length)              (ALL)
  1383.         Sets the tape block size.  When reading, the block size must be
  1384.         set to the block size set when the tape was written.  When
  1385.         using some commands, tapes written with ANY block size can be
  1386.         read if the block size is set to 0 (variable length) (see
  1387.         "BLOCK SIZES" below).
  1388.  
  1389.     Use DEVICE BUFFERS during writes            (ALL)
  1390.         Set to yes, the device will buffer data internally on writes.
  1391.         This greatly improves performance, but under certain cases may
  1392.         be undesirable since the data is not written to tape before
  1393.         returning a good indication.
  1394.  
  1395.     Use EXTENDED file marks                     (8mm only)
  1396.         Extended file marks take up much more space than short (or
  1397.         non-extended) file marks.  But extended file marks can be
  1398.         overwritten, allowing data not at the beginning of tape to be
  1399.         overwritten (see "FILE MARKS" below).
  1400.  
  1401.     RETENSION on tape change or reset           (1/4" only)
  1402.         If set to "no" then the tape will not be retentioned
  1403.         automatically when the tape is inserted.  Note that this will
  1404.         take effect only after the device is used.
  1405.  
  1406.  
  1407. FILE MARKS:
  1408.      Tape devices support multiple tape files.  Tape files are the
  1409.      result of a backup/cpio/tar/dd type command, where the device is
  1410.      opened, written to, and closed.  Because tapes allow large
  1411.      quantities of data to be written on a single tape, several backups
  1412.      (that is, tape files), may be combined on one physical tape.
  1413.      Between each tape file is a "tape file mark" or simply "file
  1414.      mark".  These file marks are used by the device driver to indicate
  1415.      where one tape file ends and another begins.
  1416.  
  1417.                               B       E
  1418.                    <-------   O       O   ------->
  1419.                               T       T
  1420.               __ ____________________________ _______________
  1421.      physical | \            |       |      \             |physical
  1422.      beginning|  \           | tape  |       \            | end
  1423.        of     |   \          | file  |        \           |  of
  1424.       tape    |    \         | mark  |         \          | tape
  1425.               |_____\________|_______|__________\_________|
  1426.  
  1427.      Note that there is a distinction between the beginning of tape
  1428.      (BOT) side of a file mark and the end of tape (EOT) side of a file
  1429.      mark.  If the head is on the BOT side of a file- mark, "tctl fsf
  1430.      1" command will move only to the EOT side of the same file mark.
  1431.  
  1432.      With the 1/4" tape drive, writing can only take place
  1433.      sequentially, or after blank tape has been detected.  You cannot
  1434.      write over data on the tape (except at BOT).  If you wish to add
  1435.      data to a tape which has been written and then rewound you should
  1436.      space forward file mark until an error occurs.  Only then can
  1437.      you start writing again.
  1438.  
  1439.      With an 8mm tape drive, writing can only take place before blank
  1440.      tape, an EXTENDED file mark, or at BOT.  Thus if several backups
  1441.      have been made on one tape and you wish to overwrite one of the
  1442.      backups, position the tape to the place you wish to start writing
  1443.      and issue the following commands:
  1444.         tctl bsf 1
  1445.         tctl eof 1
  1446.      The first command skips back to the BOT side of the same file
  1447.      mark.  The second command rewrites the file mark (writing is
  1448.      allowed before extended file marks).  The erase head will erase
  1449.      data ahead of the write head, so that after writing the file mark
  1450.      the head will be positioned before blank tape.  Only after this
  1451.      may you start writing over data in the middle of the tape.  (All
  1452.      data beyond where you are currently writing will be lost).  Note
  1453.      that you cannot write over short file marks.  In order for this to
  1454.      work, the tape must have been written with extended file marks
  1455.      (use smit to change this).
  1456.  
  1457.      With the 9-track drive writing can take place anywhere on the
  1458.      tape although overwriting single blocks of data is not supported.
  1459.  
  1460.      On the 8mm drive extended filemarks use 2.2 megabytes of tape and
  1461.      can take up to 8.5 seconds to write.  Short filemarks use 184K
  1462.      and take up to 1.5 seconds to write.
  1463.  
  1464. BLOCK SIZES:
  1465.      When data is written to tape it is written in blocks.  The blocks
  1466.      on a tape are separated by inter-record gaps.  It is important to
  1467.      understand the structure of the written tape in order to
  1468.      understand the problems which can occur with changing block
  1469.      sizes.
  1470.  
  1471.      In fixed block size mode all blocks on the tape are the same
  1472.      size.  They are the size of the block size set in the device
  1473.      configuration.  All read()s and write()s to the tape drive must be
  1474.      a multiple of the fixed block size.
  1475.  
  1476.      In fixed block mode a read() will return as many blocks as needed
  1477.      to satisfy the read() request.  If a file mark is encountered
  1478.      while reading the tape only the data up until the file mark will
  1479.      be returned.
  1480.  
  1481.      It is not possible for the tape drive to read a tape whose block
  1482.      size is not the same as the block size in the device
  1483.      configuration.  (Unless the device configuration is in variable
  1484.      size blocks.)
  1485.  
  1486.      In variable block size (0) mode, the blocks written on the tape
  1487.      are the size of the read() and write() requests to the device
  1488.      driver.  In this case, the actual block sizes on the tape can be
  1489.      changed using the options to the backup commands (tar -C, cpio -C,
  1490.      backup -C).
  1491.  
  1492.      In variable mode, read() requests greater than size of the block
  1493.      on the tape will return only the data from the next block on the
  1494.      tape.  It is this feature that allows tapes written in any block
  1495.      size (fixed or variable) to read with the dd command (the output
  1496.      from the dd command may be piped to restore, tar, or cpio for
  1497.      example.)  Note that backup, tar, and cpio cannot read all tapes
  1498.      by using a large block size because they assume there is an error
  1499.      if they get a short read().
  1500.                 dd ibs=128k obs=16k if=/dev/rmt0 | ...
  1501.  
  1502.      The tape head is always positioned at an inter-record gap, file
  1503.      mark, or blank tape after reading or writing.
  1504.  
  1505.      With the 8mm tape drive, using a fixed block size which is not a
  1506.      multiple of 1K is inefficient.  The 8mm tape drive always writes
  1507.      internally in 1K blocks.  It simulates the effect of variable
  1508.      block sizes, but, for example, using a fixed block size of 512
  1509.      bytes (or using variable block size and write()ing 512 bytes at a
  1510.      time) wastes one half of the tape capacity and gives only one half
  1511.      the maximum transfer rate.
  1512.  
  1513.  
  1514. EXCHANGING DATA WITH NON-UNIX AND OTHER VENDORS MACHINES:
  1515.      Many tape drives support both variable and fixed block sizes.
  1516.  
  1517.      Variable block mode writes block sizes the size of the write
  1518.      command issued (tar and backup specify this with the -b option). 
  1519.      In fixed mode, block sizes are fixed and all writes must be a
  1520.      multiple of the fixed block size.
  1521.  
  1522.      Unix often internally chops larger reads and writes up into
  1523.      manageable pieces (often 65535, 65534, or 65532 bytes) before
  1524.      doing the actual reads and writes.  This means reads and writes of
  1525.      64K bytes are often broken up into a 65535 byte record and a 1
  1526.      byte record (In fixed mode the write will fail).  Block sizes >=
  1527.      64K (-C128 and greater) should be avoided for this reason.  AIX
  1528.      does not break up read and write requests, but be aware of the
  1529.      situation on other machines.
  1530.  
  1531.      If the tape is written in an unknown block size then set the
  1532.      device configuration in smit to use variable size blocks, use the
  1533.      "dd" command with a large input block size, and pipe it to the
  1534.      restore command.  For example:
  1535.           chdev -l rmt0 -a block_size=0
  1536.           dd if=/dev/rmt0 ibs=128k obs=16k | tar -tvf-
  1537.  
  1538.