Ch 27 -- AIX
UNIX Unleashed, Internet Edition
- 27 -
AIX
by Chris Byers
If someone were to ask you how much you knew about AIX or RS6000, what would your
response be? Everything? An adequate amount? What's AIX?
Obviously, no one person could possibly know everything there is to know about
every version of AIX running on all platforms, given IBM's astounding variety of
hardware and software.
This chapter takes an in-depth look into many of the common questions that people
often have about their particular system, with each section focusing on a specific
area of AIX. The areas covered are:
- General Concepts
- Smit & System Administration
- Backups
- Memory and Process Management
- Shell, Commands, InfoExplorer
- Video and Graphics
- Networking
- Miscellaneous Administration
- C/C++ Programming
- FORTRAN Programming
- GNU and Other Public Domain Software
- Third-Party Products
- Miscellaneous FAQs
This arrangement will make it easier to quickly find information on the specific
topic you have questions about. This chapter is comprehensive, but not all-inclusive.
If you can't find the specific answer to a problem you are having, there's a good
possibility you will at least find clues to solve your particular problem.
General Concepts
In this section, we will deal with some basic concepts of AIX.
What Are the Differences Between AIX and Other UNIX
Flavors?
AIX has several text files located in /usr/lpp/bos with specific information
that is useful for someone coming over from another flavor of UNIX.
The README file in particular goes into some general information on the
differences, as does the bsd file. The bsd file is particularly
useful to someone from a BSD or System V background.
AIX generally is a combination of System V and BSD. In creating the operating
system, IBM followed the conventions of IEEE, POSIX 1003.1, ANSI C, FIPS, and the
X/Open Issue 3.
What Is Meant by the Object Database and What Does It
Do?
Unlike most UNIX flavors, AIX provides a "layer of abstraction", allowing
one to dynamically reconfigure the system kernel without the necessity of rebooting.
AIX uses the Object Database to allow this dynamic configuration. It stores the
bulk of system management information in /etc/objrepos, /usr/lib/objrepos,
and /usr/share/lib/objrepos. The Object Database Manager (ODM) is used to
administer the files, or objects, in those directories.
The ODM is simply a set of library routines and programs that enable basic object
oriented database facilities used to modify the system dynamically.
The System Management Utility Tool menu, known as SMIT, should, in most cases,
be used to manipulate the system object classes.
How Can I Tell Which Version of AIX I Have?
In version 3.2.5 and above, you can run the oslevel command. Check out
the options you have with this command by using the -h option.
On all versions, you can use the command lslpp -h bos.obj to show all
the database lines that refer to the Basic Operating System (BOS). This will also
show the specific fix ID and release number of each patch loaded onto the system,
as well as the date and time of loading and whether or not the loading and commit
were successful.
Starting with AIX 3.2.4, the OS was broken down into subsystems to help avoid
confusion with multiple versions of patches and fixes. This way an update can be
applied to an entire subsystem.
You can also use another option with lslpp (for example, lslpp -m
bos.obj) to show the specific updates and levels the system is running. It is
highly recommend that you update to at least 3.2.4, unless you have an application
that can run only on earlier versions.
The SMIT Utility
SMIT is a very handy system administration utility. Like SAM in HP-UX and admintool
in Solaris, it simply compiles all the required command line commands with all the
correct options needed to perform a task. These are stored in your home directory
in the files smit.log and smit.script.
Because AIX has a layer of abstraction, certain system commands might not only
be named differently, but they might work quite differently as well. SMIT can keep
you out of trouble in most cases, so even if you are used to command line administration,
it is well worth your while to pick up SMIT.
How Would I Import an /etc/passwd and /etc/group
File from Another Machine?
To do this successfully, you need to run usrck and pwdck on
/etc/passwd, and run grpck on /etc/group. AIX will then
incorporate the passwords and groups into its database.
How Would I Get Rid of the running man in SMIT (GUI
Interface)?
You can either just use the text version of SMIT by running smitty, or
you can add an alias to your .kshrc file:
alias smit="smit -C"
How Do I Clean Up utmp?
This was a problem found while running X11R5 on AIX version 3.2. This can be alleviated
by adding the following lines at the top of the X11R5mit/clients/xterm/main.c
file:
#ifdef AIXV3
#define USE_SYSV_UTMP
#define HAS_UTMP_UT_HOST
#define WTMP_FILENAME "/var/adm/wtmp"
#endif
For xterminal sessions that will go into the wtmp file, you need to define
-DWTMP in the Imakefile and be sure the WTMP_FILENAME
is set to the right directory and filename.
How Do I Run fsck on /usr?
Any time you run fsck on a file system, it must be unmounted. Unfortunately,
you cannot unmount /usr because /bin is symbolically linked to
/usr/bin. In addition, /etc/fsck is symbolically linked to /usr/sbin/fsck.
The workaround to this is to boot from the boot or maintenance disks and enter
the maintenance mode. At this point, you should enter getrootfs hdisk0 sh
instead of getrootfs hdisk0. You can then run "fsck /dev/hd2".
How Can I Run fsck on the Root File System?
Like the /usr file system, you must boot from the maintenance or boot
disks and get into maintenance mode. At this point, however, at the prompt you must
type /etc/continue hdisk0 exit (hdisk0 should be replaced with
the boot disk if it's not the same). You can then run the fsck:
fsck /dev/hd4
How Can I Create a File System that is Greater Than
2 GB in Size?
With the advent of AIX 4.1, it became possible to create file systems greater
than 2 GB in size (up to 64 GB). However, each individual file was still limited
to only 2 GB.
A limit can also be placed on accounts for file sizes. If a limit is enabled,
it defaults to 1 MB. You can change this setting in either smit users or
the file /etc/security/limit.
Previous to 4.1, the largest file systems were 2 GB because the largest signed
integer possible was 2**31-1. The only way to get around this limitation
is to use "raw" partitions (also known as non-file systems).
Is It Possible to Shrink the Size of the /usr
File System?
Yes, but it isn't easy. The following sections outline the procedures for each
version of AIX.
AIX 3.1
- 1. Make a backup of /usr find /usr -print | backup -ivf /dev/rmt0.
2. Shutdown into maintenance mode: shutdown -Fm.
3. Export LANG=C.
4. Remove the file system and the logical volume. Ignore an error about the
dpmsg not found. Umount /usr rmfs /usr.
5. Make a new logical volume named hd2. Mount it on rootvg
with the desired size.
To do this, run the following command:
Mklv -yhd2 -a'e' rootvg NNN
- where NNN is equal to the number of 4 MB partitions.
6. Create a file system on /dev/hd2.
rfs -vjfs -dhd2 -m'/usr' -Ayes -p'rw'
- 7. Mount the new /usr/file system and manually check on it.
/etc/mount /usr
df -v
- 8. You must restore from the tape at this point. If you skip this step,
you won't be able to reboot your system!
restore -xvf /dev/rmt0
- 9. Now just sync and reboot your system. You will now have a smaller /usr
file system.
If You're Using AIX 3.2É
- 1. Remove all the unnecessary files from /usr.
2. Double-check to make sure all the file systems in the root volume group
are mounted. Those that aren't mounted won't be restored to the reinstalled system.
3. Type the command mkszfile. This creates the file /.fs.size
that contains a list of the active file systems in the root volume group that will
be included in the installation procedure.
4. Now change the size of /usr by editing the .fs.size file.
For example, if the /usr is set to 48 MB, the line for /usr in
.fs.size will read rootvg 4 hd2 /usr 12 48 jfs. The 12 shows the
number of 4 MB physical partitions used, making 48 MB. The physical partition size
is 4 MB by default on most systems, except for the model 320, which has a default
PP size of 2 MB. In order to reduce the size of /usr from 48 to, say, 32
MB, edit that line to read rootvg 4 hd2 /usr 8 32.
NOTE: Do not enter a size that will be
less than that required to fit all of the files back onto /usr during re-installation.
Doing so will cause the procedure to fail, and you'll really be up a creek then.
- 5. Enter the following command:
chdev -l rmt0 -a block=512 -T
- 6. At this point, make sure to unmount all filesystems that are not in
the root volume group.
7. Do a varyoff of all user-defined volume groups if any are present.
varyoffvg VGname
- 8. If any user-defined volume groups exist, then export them.
exportvg VGname
- 9. Now put a tape in the tape drive and do a mksysb.
mksysb /dev/rmt0
- By doing this, you are doing a complete system backup, including information
from the .fs.size file, which is used during the installation procedure
for defining how large the file systems will be.
10. Now re-install the system from the mksysb tape you created, using
the procedures for BOS installation from a System Backup. If you are using a version
previous to 3.2.5, you must choose the option "Install AIX with Current System
Settings" for the logical volume size changes to take effect. If you
are using version 3.2.5, you need to select the option "Install from a mksysb
tape".
11. After you are done re-installing, you can then import any of the user-defined
volume groups you exported with the following command:
importvg -y VGname Pvname
- VGname is the volume group name you are importing and PVname
is can be the name of any one of the physical volumes in the volume group.
12. Now varyon the user-defined volume groups.
varyonvg VGname
Now you have a reduced file system. As you can see, this is a real pain, especially
with the downtime and the chance of loosing critical data, so it's best to make the
sizes small to start with. Increasing the size of file systems is much easier.
How Can I Change the Tunable Parameters in the Kernel,
such as the Number of Processes Per User?
There are two ways of doing this. You can either use SMIT or you can use lsattr
to view the current settings and chdev to change the parameters. An example
of using lsattr to check the number of processes is:
# lsattr -E -l sys0 -a maxuproc
maxuproc 40 Maximum # of processes allowed per user True
If you want to increase it, you would do the following:
# chdev -l sys0 -a maxuproc=200
sys0 changed
If you want to use SMIT, follow these choices in the menu:
"System Environments and Processes"
"Change / Show Operating System Parameters"
At this screen, you change the parameters by overtyping these fields:
"Maximum number of PROCESSES allowed per user"
"Maximum number of pages in block I/O BUFFER CACHE"
"Maximum number of Kbytes of real memory allowed for MBUFS"
You can also toggle these fields:
"Automatically REBOOT system after a crash (false/true)"
"Continuously maintain DISK I/O history (true/false)"
Can You Mount a Floppy as a File System?
Yes. It will, however, only allow read-access to that disk. That's because, starting
with 3.1.5, AIX cannot create a journal log on a disk, because IBM only intended
this strategy to be used for temporary access for read-only data.
If you build a file system and mount it on a floppy, it must always be unmounted
after use and during the system backup procedures, or this could error out.
To make a file system on a floppy:
- 1. Create a subdirectory on another file system and put all the files
intended to go into the file system there.
2. You must create a prototype file that will contain information about the
new file system.
proto /(directory) > (filename)
- 3. Put a formatted floppy in the drive, and then edit the prototype file
and change the first line to <noboot> 0 0.
4. Enter the following command to make the file system on the floppy:
mkfs -p (filename) -V jfs /dev/fd0
- 5. Create the directory where you will mount the floppy-based file system,
usually called /mnt. To mount the file system:
mount -r -V jfs /dev/fd0 /mnt
- 6. To unmount the file system, just use the umount command as
you usually do.
umount /dev/fd0
Just about the only thing this is useful for is if you are going to use it for
utility programs or other data that will remain static. Unfortunately, the only way
to make changes to anything on this file system is to copy the directory from the
floppy into another directory, make the changes, and remake the file system using
the preceding steps.
Why Does the Swapper Take Up So Much Paging Space?
When you see this from the ps utility, it is actually showing the entire
paging space plus real memory allocated when it shows the swapper process. This is
just the way that ps reads that processes, so it is actually normal behavior.
How Can I Reduce the Size of the Default Paging Size
on hd6?
To do this, you should follow this procedure:
- 1. Create a temporary paging space.
mkps -s 20 -a rootvg
- 2. Change the default paging space so it's not used at the next boot-up.
chps -a n hd6
- 3. Edit the /etc/rc.boot to change to change swapon /dev/hd6
(in AIX 3.1, edit the /etc/rc.boot4 file) to swapon /dev/paging00.
4. You have to update the information in boot logical volume for 3.1.
bosboot -a for 3.2: bosboot -a -s hdisk0
- 5. Now you should shutdown and reboot the system.
6. When you're system comes back up you should remove the current hd6
and create a smaller one.
rmps hd6 mklv -y hd6 -t paging rootvg <paging space size in 4Mb blocks>
- 7. Edit the /etc/rc.boot (or /etc/rc.boot4) file again
to change the swapon value back.
swapon /dev/hd6
- 8. You also have to update the boot logical volume again.
3.1: bosboot -a 3.2: bosboot -a -d hdisk0
- 9. Now you change the current paging device (paging00) to an
inactive state for the next boot.
chps -a n /dev/paging00
- 10. Finally, shutdown, reboot again, and remove paging00 when
it comes back.
rmps paging00
You can display your paging space at any time with the command lsps -a.
How Do You Make Boot Disks for AIX 3.2?
This will require you to have four disks already formatted. To create the appropriate
disks, you must do the following:
- 1. For the boot disk, run bosboot -d /dev/fd0 -a.
2. For the display disk, run mkdispdskt.
3. For the display extension disk, run mkextdskt.
4. And for the Install/Maintenance disk, run mkinstdskt.
How Can I Get Rid of a Committed lpp (Licensed
Program Product)?
The only way to do this (that I could find, anyway) is to install the lpps/ptfs
with the force option and then reject the particular package.
In AIX 4.1, there is a new option for installp. The -u option
can be used to remove the lpps.
Is It Possible to Log Information about FTP Accesses
to a Log File?
You can do this relatively simply be doing the following:
- 1. Add the following line to /etc/syslog.conf.
daemon.debug /tmp/daemon.log
- 2. Create the log file and restart the syslog daemon.
# touch /tmp/daemon.log # refresh -s syslogd
- 3. Now you must modify your inetd.conf through SMIT. Using smit
inetdconf you will add the -l and the -d option.
Now all of the syslog messages from ftpd and other daemons will
now appear in the file /tmp/daemon.log.
By Default, Where Does AIX Keep All the Log Files?
To see where your specific machine is sending logs, look in the /etc/syslog.conf
file. This will define which type of errors go into which log files.
By default, the system log files are:
/var/adm/messages |
For system mail messages |
/var/adm/lpd-errs |
For lp daemon errors |
/var/log/authlog |
For authentication messages |
/var/log/syslog |
For general system messages |
After Installing Updates, What's the Best Way to Recover
Lost Space?
While installing packages, installp creates a large number of files in
/usr, which it uses to clean up the system after failed or rejected installs
as well as for de-installing the uncommitted lpps.
After you have fully committed the packages, you can safely remove these files,
which can be anywhere from hundreds to thousands.
These files end up being located in directories associated with their product;
the directories being named /usr/lpp/(product abbreviation)/deinstl* and
/usr/lpp/(product abbreviation)/inst_U4*.
NOTE: If you have a number of other machines
with NFS mounts to /usr, you shouldn't use this because these files
mentioned are needed for the clients.
If I'm Given an inode Number, Can I Actually
Find the Associated File?
There is a little known option in the find command that allows you to
do just that:
find /(mountpoint) -xdev -inum NNNN -print
where NNNN is the inode number.
What Can I Use for Performance Monitoring?
There are some tools available in /usr/lpp/bosperf to monitor traces,
I/O events, CPU stats, virtual memory, disk block usage, kernel extensions, and many
other events.
rmms is also a tool to see how different memory size configurations will
impact performance.
Another good text-based tool is monitor, which allows you to easily monitor the
following events:
- CPU usage
- Process events
- Virtual and real memory usage
- Load average
- Paging information
- Disk I/O
- TTY I/O
- Network activity
- The top CPU users
- NFS operations
- A detailed disk I/O screen (-disk option)
- A detailed network I/O screen (-net option)
- A toggle between screens
This file is available from the FTP site ftp.funet.fi:pub/unix/AIX/RS6000/monitor-1.12.tar.Z.
Another monitor that can be used on X-based systems is called xsysstats.
This is available from the FTP site ftp.x.org:/contrib.
How Can I Find Out What Virtual Printer a Print Queue
Is Using?
By using the command lsvirprt without any options, it will run in an
interactive mode. This will bring up a menu of all virtual printers on the system
with queue and device for each one.
Why Are There Two srcmstrs Running My Machine?
This happens on a system that either has no console or a system with an asysnc
terminal as the console that is either not attached or turned off. One of the symptoms
of this situation is that a second srcmstr runs. This one is useless because
you can't use the sstop/startscr commands, refresh inetd, and the
qdaemon won't start.
There is, however, a simple way to resolve this. Start the SMIT chgtty
menu and add the keyword clocal as values in the associated brackets:
STTY attributes for RUN TIME
STTY attributes for LOGIN
How Can I Change the tty Name Associated with
a PhysicalPort?
First you get into the smit interface by typing smit. Then you choose
the devices option. Next you choose the TTY option, then the Change
/ Show characteristics of a TTY menu. Here you can change the name of the port
number associated with the tty, as well as other options for various settings such
as line speed.
Can I Use mksysb to Copy an Entire System to
Another Box?
To do this, you can use the following steps on the master machine to clone an
AIX system:
- 1. Delete the password from root.
2. In the /etc/group file you must get rid of the last line containing
a + sign, which is used by NIS.
3. You must change the run level designations at least for rc.nfs
and the rc.tcpip from level 2 to level 3 in the /etc/inittab file.
(This is to prevent them from being started with the new system.) These can be changed
by editing the /etc/inittab file and changing the number in the second field
of the lines. The first field of these lines will be rcnfs and rctcpip,
respectively.
4. Boot the master machine into service mode and change the name and ip
address to avoid collisions.
5. Clear all the temp files (/tmp, /usr/tmp, and /usr/spool/lpd/stat).
6. Run the mkszfile utility and edit it to be sure /usr/
is as small as possible.
7. You can now do a mksysb from the command line.
When you load the mksysb on the new machine for the first time, it will
be able to boot into the normal mode. You can now get in as root, change the files
back to the original settings, and continue configuring the new system.
The same must be done to the master machine if you intend to keep it operational.
How Can You Force mksysb to Retain timestamps?
From version 3.2.5 on, the bosrest command preserves timestamps and permissions.
The pax command will do this as well.
In AIX 3.2.2, /usr/lpp/bosinst/bosnet (net installations) and bosrest,
the pax c commands, all have the available option -pmop, where the
m tells it to not retain the modification times. All you have to do is change
all the -pmop options to -pop and remake your mksysb tapes.
What's a Good Way of Updating a Number of Machines to
3.2.5?
If you don't have many machines, this may not be worth your while, as it involves
a number of lines of scripting. If you do have a network of machines to update, then
this is for you.
- 1. Get the PMP3250 tape from AIX support, PTF (Program Temporary Fix)number
U493250.
2. Create a file system with 240 MB of space and mount it as /pub/pmp3250
(on an lv called /dev/pmp3250).
3. Install the PTF U422467 from the tape with the command installp -Bxacgq
-d /dev/rmt0 bos.obj 3.2.0.0.U422467.
4. Create a script to load the tape in the new file system:
#!/bin/ksh
#@(#) mktape2disk.sh creates files from tape on disk
#This will change the name prefix
NAME="f"
# from file #i to file #j
integer i=1
integer j
#test arguments
if [ -z "${1}" ]
then
echo "/nusage: $(basename ${0})<drive_no><#files>n"
echo "t<drive_no>: tape drive number (e.g. 0)"
echo "t<#files> :number of files to copy from the tapen"
exit
fi
devices=/dev/rmt${1}.1
# test arguments
if [ -z "${2}" ]
then
echo "nousage: $(basename ${0})<drive_no><#files>n"
echo "t<drive_no>: tape drive number (e.g. 0)"
echo "t<#files>: number of files to copy from the tapen"
exit 1
fi j=${2}
tctl -f ${device} rewind
if [ $? -ne 0 ]
then
exit 1
fi
# This will create the tape
while [ ${i} -le ${j} ]
do
echo "Copy file #${i} of #${j} from (${device}) to disk as (${NAME}${i})"
dd if=${device} of="${NAMW}${I}" bs=200k
i=i+1
done
tctl -f ${device} rewind
exit 0
- Now that you have created the script, you can run it as follows:
# cd /pub/pmp3250
# mktape2disk.sh 0 447 (this will make it read the 447 files from rmt0)
- 5. You must create a new .toc file.
# cd /pub/pmp3250 # inutoc . # pg .toc
- 6. Then you must create another script called runme.sh into the
PMP directory:
#!/bin/ksh
#@(#) runme.sh for PMP3250
#
INSTP="/usr/sbin/installp"
LOG="/tmp/installp.log"
TEE="/usr/bin/tee"
PATCHDIR=$(pwd)
#
/usr/bin/cp /usr/lpp/info/data/ispaths /usr/lpp/info/data/ispaths.save
#
INFODIR="/usr/lpp/info/$LANG/aixmin"
/usr/bin/mkdir ${INFODIR} 2>/dev/null >/dev/null
if [ ! -w ${INFODIR} ]
then
print "nt*ERROR* Can not (write) acces [${INFODIR}]."
print "tPlease unmount CD or NFS file systems.n"
exit -1
fi
#
# Commit all the PTF's
#
${INSTP} -Xc all 2>&1 | ${TEE} ${LOG}.0
#
# Install latest installp patch
#
${INSTP} -Bxacgq -d ${PATCHDIR} bos.obj 3.2.0.0.U422463 2>&1 | ${LOG}.1
#
# Install latest installp patch
#
${INSTP} -Bxacgq -d ${PATCHDIR} bos.obj 3.2.0.0.U422467 2>&1 | ${LOG}.6
# Now run the ptfdir clean utility.
#
/usr/sbin/ptfdir_clean -y -f -v 2>&1 | ${TEE} ${LOG}.2
#
# Install the PMP version 1
#
/usr/lib/instl/sm_inst installp_cmd
-T m -q -a -g -B
-d ${PATCHDIR}
-S `3250 AIX Maintenance Level U493250'
-c -N -X
2>&1 | ${TEE} ${LOG}.3
#
# Install the PMP version 2
# /usr/sbin/update_all
#
# Install the latest installp patch
#
/usr/bin/lppchk -v | ${TEE} ${LOG}.4
#
# Show the level of installp patch
#
/usr/bin/lslpp -m bos.obj | ${TEE} ${LOG}.5
#
# Reboot now.
#
sync;sync
print - "nntDone ......reboot now !n"
exit 0
- 7. Now that you have created the scripts you can run them on your server.
Before you do, however, it is best to check your installation instructions first.
# cd /pub/pmp3250 # ./runme.sh # /etc/shutdown -Fr
- 8. When the system comes up, you can export the PMP directory as read-only
to all clients.
9. To update a client system, first mount the PMP file system from the server.
Then cd to the mounted file system. Run the runme.sh, unmount the
PMP file system, and reboot. Your system should now be updated.
Is There a General Fix Strategy for AIX?
In AIX 3.1, the strategy was to do cumulative updates, so every few months IBM
would put all of the available fixes on one big package and send it to all their
client sites. Except for the occasional emergency patch, there was no method for
tracking them. Chances are that if you weren't careful and you got a second patch,
you would load it and overwrite the first.
IBM tried a selective fix strategy for AIX 3.2 to support individual fixes. These
packages would contain information about other fixes that were required for that
fix to work properly. By using this strategy, it allowed the installed fixes to be
tracked so that they did not become overwritten. Initially, this had certain problems:
- None of the fixes were cumulative. You might not receive all of the fixes for
a certain product. This could create a situation where you could rediscover other
problems that were already fixed.
- Since it was decided to fix the problems as they were reported instead of waiting
until the next release, the number of fixes grew proportionately.
- Each fix could propagate a number of other fixes, which could grow quite large.
Each installation also became quite complicated as a result of this, which greatly
lengthened the installation times.
As the AIX 3.2.4 was developed, a large amount of effort was put into resolving
the problems with selective fixes, as well as improving AIX 3.2. At this point everything
was split into subsystems, which are logically related files. The advantage of this
was that changes to a subsystem were unlikely to affect other subsystems, meaning
much fewer problems with patches and fixes. Now, with 3.2.4:
- Every subsystem package is cumulative, with all the fixes and enhancements to
date for that particular subsystem.
- The cumulative subsystem packages is tested as a separate whole entity.
- There are quite a few less fix packages because the number of subsystems is far
fewer that the number of fixes and enhancements.
- The propagation of problems caused by fixes is significantly reduced because
each subsystem package only relies on other subsystem packages.
- Since the number of fix packages is smaller, installation time goes down dramatically.
The icing on the cake came with the Preventative Maintenance Package (PMP). PMP
allows you to install the latest cumulative subsystem package, which can be installed
by selecting a single fix. Along with PMP came the oslevel command, which
shows what packages are installed and at what level the operating system is running.
Why Is the Fix I Received So Large for My 3.2.4?
This fix might be part of the 3.2.5 update. AIX 3.2.5 is really just a PMP for
3.2.4. This contains all of the fixes to date, including enhancements to support
the PowerPC model 250, as well as the high-end RS/2 model 590 and 990. It also has
support for new disk and tape drives, graphics and adapters, and so on.
Why Couldn't I Just Build a Fix on 3.2.4?
In fact, there is no such thing as 3.2.1, 3.2.2, or 3.2.4 for that matter. These
are just handles that have been put on the fixes and enhancement levels of the 3.2
base. If the fix for a specific problem was built before 3.2.5 came along, you can
get the older version. If your fix was available for the first time in a 3.2.5 subsystem,
then that's the only version of the fix in existence.
In AIX, Can I Have More than an Eight-Character Password?
You can create a password that is greater than eight characters in length, but
all of the characters over the eighth will be ignored.
If you are running NIS, you will have to be careful about the passwords on other
machines. They all must be eight characters or less to be compatible with AIX.
If you are running DCE, you can save more than eight characters to the password
because DCE supports kerberos, which is an X windows function.
Can I Get More ptys than the 64 Limit?
SMIT will only allow 64 ptys, but you can get around this by manually
changing the ODM files. This can be done by doing the following:
odmget -q"attribute=num and uniquetype=pty/pty/pty"PdAt |
sed "s/0-64/0-512/" |
odmchange -q"attribute=num and uniquetype=pty/pty/pty" -o PdAt
chdev -l pty0 -anum=256 -P
reboot
Are There Any Fixes that I Should Be Aware of?
There have been problems that need to be taken care of in sendmail and
xterm. The associated patch tapes are designated as follows:
sendmail |
This fix is available as U426396 |
xterm for X11R4 |
This is available as U422575 |
xterm for X11R5 |
This is available as U425811 |
How Can I Remove a Non-Existent Physical Volume from
the ODM?
To do this, you have to use reducevg with the pvid instead of
the disk name. The pvid will actually be given in error messages that occurs
when you run a command to modify a volume group or the logical volume on the disk.
To get rid of the missing disk from the database, just enter the following command:
reducevg -f <pvid>
I Can't Seem to Kill a Process with quit, kill,
or stop. How Can I Kill It?
You are probably out of luck. If there is I/O pending in a device driver and the
driver doesn't get the signal, then you simply can't kill it. You can only reboot
to get it out of the process list.
You can do a trace on the process by using the following command:
# echo trace -k $(expr<pid> / 256) | crash | tee stack
You can use that stack trace to find out what's wrong on the system. (You'll probably
have to send it to an IBM system engineer to decipher it though.)
Is There a Way to See console Messages?
You can use the swcons command to redirect the console to a file, or
you can use the chcons command to permanently move the messages to a file.
What Should I Do If I Loose the Root Password?
You don't have to do anything as radical as reloading AIX and restoring everything
from tape (checked your backups lately?). Just follow this procedure:
- 1. Boot from the boot disks, tape, or CD.
2. At the Installation/Maint menu, select item 4, "Start a limited function
maintenance shell."
3. At the # prompt, enter the command:
getrootfs hdisk N
- (where N is the number of the disk on rootvg)
4. When the # prompt comes back, you will be logged in as root in
single user mode.
5. While here, cd to the /etc/security directory and edit
the passwd file. Here you need to delete the three lines under root and
save the file.
6. Now you can give root a new password with passwd command.
7. Now all you have to do is shut down and reboot in normal mode.
8. Write down that password and lock it up in a safe place. Just don't forget
where you put it.
On Running a chlv a Warning Appears. Is the
First 4 KB of the LV Okay?
On raw partitions the first 4 KB is used to store control block information. Some
applications, particularly databases such as Oracle and Sybase, will actually overwrite
this section. Any command that calls getlcb will give a warning but succeed
anyway because the control block information also exists in ODM. Do not run synclvodm
unless you really want to erase this first 4k and replace it with the ODM control
block information.
Doing Backups
This is one of the more important sections of the chapter, since backups often
equal job security!
How Do I Do Remote Backups?
There are a couple of ways of doing this. The first (and by far the simplest)
is a tar command:
tar -b1 -cf - . | rsh REMOTEHOST "dd ibs=512 obs=1024 of=/dev/TAPEDEVICE"
Because mksysb will not back up to remote tape devices, you have to create
a script to make it do your bidding. I ran across this script originally written
by Frank Kramer from IBM. The following will work for remote backups:
#!/bin/ksh
# @(#) Create a backup tape of the private user data.
#=================================================================#
# Script : usave.sh #
# Author : F. Kraemer #
# Date : 92/02/19 #
# Update : 92/10/29 #
# Info : the ultimative backup script #
# Example: usave.sh /dev/rmt0 - save to local tape #
# usave.sh /save/save.me - save to local file #
# usave.sh /tmp/pipe - save to remote tape #
#-----------------------------------------------------------------#
PS4="(+) "
#set -x
PROG=$(basename $0)
HOST=$(hostname)
TODAY=$(date +%H:%M:%S)
#
# cleanup
#
cleanup ()
{
ec=$1
error=$2
case "$ec"
in
"$USAGE_EC") # usage error
error="Usage:t$PROG DeviceNamen" 1>&2
;;
"$NOTAP_EC") # Tape error
error="error:t$PROG: $DEVICE is not available on the system.n" 1>&2
;;
"$LISTE_EC") # list error
error="error:t$PROG: could not create tar list for $LOGNAME.n" 1>&2
;;
"$NOTAR_EC") # tar command error
error="error:t$PROG: tar command failed.n" 1>&2
;;
"$PIPEP_EC") # pipe error
error="error:t$PROG: mknod command failed.n" 1>&2
;;
"$NORSH_EC") # rsh error
error="error:t$PROG: rsh - Remote Shell command failed.n" 1>&2
;;
"$RHOST_EC") # remote host error
error="error:t$PROG: Remote Host unknown.n" 1>&2
;;
*)
;;
esac
case "$DEVICE"
in
#
# Fix the block size if $DEVICE is a tape device
#
/dev/rmt[0-9]*)
echo "nt$PROG: Rewinding tape to begin.........(please wait)n"
tctl -f $DEVICE rewind 2>/dev/null
;;
*) ;;
esac
rm -f ${LIST} ${PIPE} 2>/dev/null
[ -n "$error" ] && echo "n${error}n"
trap '' 0 1 2 15
exit "$ec"
}
#
# Variables
#
USAGE_EC=1 # exit code for usage error
NOMNT_EC=2 # exit code wrong device name
NOTAP_EC=3 # exit code no tape available
LISTE_EC=4 # exit code backup list error
NOTAR_EC=5 # exit code for wrong tar
TRAPP_EC=6 # exit code for trap
PIPEP_EC=7 # exit code for pipe
RHOST_EC=8 # exit code for bad ping
NORSH_EC=9 # exit code for bad rsh
DEVICE="$1" # device to tar into
LIST="/tmp/.tar.$LOGNAME.$$" #
REMOTEH="" # Remote host for backup
REMOTET="" # Remote tape for backup
tapedev= #
PIPE="/tmp/pipe" # Pipe for remote backup
#
# main()
#
tput clear
echo "nt$PROG started from $LOGNAME@$HOST on $TERM at $TODAY.n"
rm -f $LIST 2>/dev/null
#
# Trap on exit/interrupt/break to clean up
#
trap "cleanup $TRAPP_EC "Abnormal program termination. $PROG"" 0 1 2 15
#
# Check command options
#
[ "$#" -ne 1 ] && cleanup "$USAGE_EC" ""
#
# Check device name
#
[ 'expr "$DEVICE" : "[/]"' -eq 0 ] && cleanup "$NOMNT_EC"
"$PROG: Backup device or file name must start with a '/'."
#
# Check tape device
#
case "$DEVICE"
in
#
# Fix the block size if $DEVICE is a tape device
#
/dev/rmt[0-9]*)
#
echo "nt$PROG: Verify backup media ($DEVICE)............n"
#
# see if a low or high density tape device was specified
# (eg rmt0.1)
density="'expr $DEVICE :
"/dev/rmt[0-9]*.([0-9]*)"'"
#
# strip /dev/ from device name and
# get the base name (eg translate:
# /dev/rmt0.2 to rmt0)
#
tapedev="'expr $DEVICE :
"/dev/(rmt[0-9]*)[.]*[0-9]*"'"
#
# Check if the tape is defined in the system.
lsdev -C -c tape -S Available -F "name" | grep $tapedev >/dev/null 2>&1
rc=$?
[ "$rc" -ne 0 ] && cleanup "$NOTAP_EC" ""
#
# Restore old tape name.
#
[ "${density:-1}" -lt 4 ] && density=1 || density=5
DEVICE="/dev/${tapedev}.${density}"
echo "nt$PROG: Insert a tape in ($DEVICE)........(press enter)n"
read TEMP
echo "nt$PROG: Rewinding tape to begin...........(please wait)n"
tctl -f $DEVICE rewind 2>/dev/null
;;
#
# Backup is done on remote host. The remote shell facility
# must be set up and running.
#
${PIPE}*)
#
echo "nt$PROG: Assuming remote backup via network.n"
echo "t$PROG: Enter name of Remote Host ===> c"
read REMOTEH
echo "nt$PROG: Pinging Remote Host to test connection.n"
ping ${REMOTEH} 1 1 >/dev/null 2>&1
rc=$? # give up unknown host
[ "$rc" -ne 0 ] && cleanup "$RHOST_EC" ""
JUNK=$(rsh ${REMOTEH} "/usr/sbin/lsdev -C -c tape -S Available")
rc=$? # give up rsh failed
[ "$rc" -ne 0 ] && cleanup "$NORSH_EC" ""
echo "t$PROG: Available Tapes on ${REMOTEH} are :nntt${JUNK}n"
echo "t$PROG: Enter name of Remote Tape (e.g. /dev/rmt0) ===> c"
read REMOTET
echo "nt$PROG: Insert tape on ${REMOTEH} in ${REMOTET}..(press enter)"
read TEMP
echo "t$PROG: Rewinding Remote Tape ${REMOTET} on ${REMOTEH}.n"
rsh ${REMOTEH} "tctl -f ${REMOTET} rewind"
rc=$? # give up rsh failed
[ "$rc" -ne 0 ] && cleanup "$NOTAP_EC" ""
rm -f ${PIPE} 2>/dev/null
mknod ${PIPE} p
rc=$? # give up mknod failed
[ "$rc" -ne 0 ] && cleanup "$PIPEP_EC" ""
cat ${DEVICE} | rsh ${REMOTEH} "dd of=${REMOTET} obs=100b 2>/dev/null" &
;;
*) ;;
esac
#
# Prepare the list
#
echo "nt$PROG: Create list of files to be saved...."
find $HOME -print > $LIST
rc=$?
[ "$rc" -ne 0 ] && cleanup "$LISTE_EC" ""
#
# tar the files
#
echo "nt$PROG: Changing current directory to (/)...."
cd / > /dev/null 2>&1
echo "nt$PROG: Running tar format backup from user ($LOGNAME)...."
tar -cvf "$DEVICE" -L "$LIST"
rc="$?"
[ "$rc" -ne 0 ] && cleanup "$NOTAR_EC" ""
#
# Backup completed
#
TODAY=$(date +%H:%M:%S)
echo "nt$PROG ended at $TODAY............................nn"
cleanup 0
How Can I Put Multiple Backups on One 8mm Tape?
You can do this one of two ways. Both of these methods use the device /dev/rmt0.1
because it is non-rewinding.
In the first solution, you can use either rdump or backup with /dev/rmt0.1.
Here is an example:
# rsh remote1 -l root /etc/rdump host:/dev/rmt0.1 -Level -u /u
# rsh remote2 -l root /etc/rdump host:/dev/rmt0.1 -Level -u /u
# tctl -f /dev/rmt0.1 rewind (this will rewind the tape)
These commands are implemented from the host. In order to restore the table of
contents of the first, I would use:
# restore -f /dev/rmt0.1 -sl -tv
In this example, the -sl flag tells restore to go to the first
record on the tape. If you type the exact command again to get the second record,
the -sN (where N is an integer) tells it to go to N records
from this spot.
The second solution uses a script created by Steve Knodle at Clarkson University.
The Dump.sh file contents are:
CONTENTSFILE='date |dd conv=lcase |sed -e 's/19//' |awk '{print $6 $2 $3}''
set -x
LEVEL=$1
shift
backup -c -b 56 -$LEVEL -uf /dev/rmt0.1 /
backup -c -b 56 -$LEVEL -uf /dev/rmt0.1 /usr
backup -c -b 56 -$LEVEL -uf /dev/rmt0.1 /u
tctl -f /dev/rmt0 rewind
touch /usr/local/dumps/Contents.$CONTENTSFILE
echo "Dumping /" >>/usr/local/dumps/Contents.$CONTENTSFILE
restore -t -s 1 -f /dev/rmt0.1 >>/usr/local/dumps/Contents.$CONTENTSFILE
echo "Dumping /usr" >>/usr/local/dumps/Contents.$CONTENTSFILE
restore -t -q -s 1 -f /dev/rmt0.1 >>/usr/local/dumps/Contents.$CONTENTSFILE
echo "Dumping /u" >>/usr/local/dumps/Contents.$CONTENTSFILE
restore -t -q -s 1 -f /dev/rmt0.1 >>/usr/local/dumps/Contents.$CONTENTSFILE
tctl -f /dev/rmt0 rewind
Is It Possible To Make an Exact Duplicate of a Tape
Over the Network?
Yes. It would be easy enough to move the contents to a temporary file, but if
disk space is a consideration (and when isn't it?), then we would have to be a little
more inventive.
This script should work, but be careful in a heterogeneous network:
LOCAL=/dev/<tape_dev>
REMOTE=/dev/<tape_dev>
dd if=$LOCAL ibs=64k obs=512 | rsh <remote_host> dd ibs=512 obs=64k of=$REMOTE
Daniel Packman wrote the following Perl script to convert every function code
into AIX for compatibility on tape formats:
#!/bin/perl
# Wrapper to convert input rmt requests to
# AIX 3.2 ioctl numbers. We pass on all commands we don't understand
# I0 MTWEOF -> I10 STWEOF write and end-of-file record
# I1 MTFSF -> I11 STFSF forward space file
# I2 MTBSF -> I12 STRSF reverse space file
# I3 MTFSR -> I13 STFSR forward space record
# I4 MTBSR -> I14 STRSR reverse space record
# I5 MTREW -> I6 STREW rewind
# I6 MTOFFL -> I5 STOFFL rewind and unload tape
# I7 MTNOP -> I0 (no-op? should ignore following count)
# I8 MTRETEN-> I8 STRETEN retension tape, leave at load point
# I9 MTERASE-> I7 STERASE erase tape, leave at load point
#I10 MTEOM (position to end of media ... no ibm equivalent?)
#I11 MTNBSF (backward space file to BOF ... no ibm equivalent?)
@iocs = (10,11,12,13,14,6,5,0,8,7);
open(RMT,"|/usr/sbin/rmt") || die "Can't open pipe to rmtn";
select(RMT);
$| = 1;
while (<STDIN>) {
s/(^I)(d$)/I$iocs[$2]/;
exit 0 if $_ =~ /^[Qq]/;
print RMT $_ ; }
exit 0;
How Do I "Unstick" a Hung Tape Drive?
This happens when a process accesses a tape drive and the process stops or exits,
yet still holds onto the drive. When this happens, the process cannot be ended until
the machine is rebooted (as we saw in a previous FAQ). There are certain reset functions
that can be used with the SCSI bus to reset the device.
One is a Bus Device Reset (a standard SCSI message) to the tape drive using the
following program. If this doesn't work, then a full SCSI Bus Reset will be sent,
which will reset every device on that SCSI controller, which is quite extreme. (This
could affect certain disk drives, so take care in using this utility.) Sometimes
this is the only way to reset a tape device, short of rebooting the machine. The
code is as follows:
/* taperst: resets the tape drive by sending a BDR to the drive. */
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/scsi.h>
int main(int argc, char **argv)
{
/* This can be run only by root */
if (argc != 2) {
fprintf(stderr, "Usage: %s /dev/rmt#n", argv[0]);
return 1;
}
if (openx(argv[1], O_RDONLY, 0, SC_FORCED_OPEN) < 0) {
perror(argv[0]);
return 2;
}
return 0;
}
Can I Read a mksysb Tape with tar?
You should be able to do this by running the following commands:
# tctl fsf 3
# tar xvf /dev/rmt0.1 ./<filename>
Memory and Process Management
This section covers some of the more commonly asked questions about process management.
Does AIX Eat Up More Paging Space than Other UNIX Systems?
In most cases, yes. The virtual memory manager in AIX uses a technique called
early allocation of paging space. As a page is allocated in RAM and is not an NFS
or disk file storage page, then it is considered as a working storage page. These
working stored pages are commonly an application's stack, data, and any shared memory
segments. So, when a program's stack is increased and RAM is accessed the virtual
memory manager will allocate space in RAM and space on the paging device.
The result is that even before the RAM gets filled up, paging space is already
being used.
So How Much Paging Space Will I Need?
Generally, the guideline is to have twice the amount of RAM in disk space set
aside for paging. This may be too simplistic to cover every situation, however. For
example, in a machine that is used mainly for data storage versus heavy duty computations,
this would actually be a lot of wasted space, because it is unlikely that a stack
will grow to the size of the amount of RAM on the system. However, it's always better
to be on the safe side and stick to this guideline if you are unsure.
TIP: You should never have more than one
paging space per disk as this will severely hinder your I/O throughput. Also, try
to get as much RAM as you can on your system. The more you get, the better it will
run.
Why Do I See No Free RAM Pages in vmstat?
The OS is probably using RAM as a great big disk buffer. If you open up a file
and leave it there and nothing else needs the RAM, then it will stay there until
you close the file.
Since There Are No Free RAM Pages Showing, Am I Out
of RAM?
More than likely, no. Because disk files will be mapped into RAM, if vmstat
shows lots of RAM pages free, then it could be possible that you have too much RAM.
What Are the avm and fre Fields from
vmstat Anyway?
The avm field will tell you how much Active Virtual Memory AIX is interpreting
as being in use. This will closely resemble the paging space that is in use. This
number doesn't have a thing to do with the amount of RAM you are using, nor does
it include your mapped files (disk files).
You can tell how much RAM is on your system by running the command:
/usr/sbin/bootinfo -r
The fre field shows the number of free page frames. It is normal for
this number to be less than 500 pages. If this number is consistently greater than
4000 pages, then you actually have more memory than you need in this machine.
What Does the ps Show About Memory Reports?
If you use the ps vg, you can get a per process tally of the memory usage
by running procfess. The man pages are a little fuzzy, but this
should help in understanding what is being reported:
- RSS--This will tell you how much RAM is currently being used for the text and
data segments for a particular process in KB units. This value will always be a multiple
of 4 because memory is allocated in 4kb segments.
- %MEM--This gives the fraction of RSS divided by the total size of RAM being utilized
by a particular process. Because RSS is just a subset of the total resident memory
usage for a process, the %MEM value will always be lower than the actual value.
- TRS--This will indicate how much RAM resident memory is currently in use in the
text segment for a particular process in KB units. In all cases, this will be equal
to or less than RSS.
- SIZE--This will tell you how much paging space is allotted for this processes
for the text and data segments in units of KB. If the executable file is on a local
file system, the page space usage for text will be 0. If the executable is on an
NFS file system, the page space usage will be greater than 0. This number may be
greater than or less than RSS, depending on how much of the process is paged in.
RSS can be larger because RSS counts text, where SIZE doesn't.
- TSIZ--This is basically a useless field that serves no purpose.
The fields here only report on a process's text and data segments. The segment
size that cannot be reported on to date are:
- The text portion of shared libraries (segment 13).
- Open or in-use files. The open files are cached in memory as individual segments,
unlike the traditional kernel cache buffer scheme.
- The shared data segments that are created with shmat.
In 3.1, the %MEM and RSS report for process 0 are bogus values. The RSS value
is misleading large because the kernel segment 0 is counted twice.
To sum up, ps isn't very god at measuring system memory usage. It gives
some indication of where some of the memory goes, but many of the questions remain
unanswered about the total usage.
What Is kproc?
kproc (which is always PID 514) is simply the kernel's idle process.
Shells, Commands, and the InfoExplorer in AIX
This section will cover some of the questions often asked about shells, command
and the InfoExplorer program in AIX.
What's the Best Way To Give More Information in My Shell
Prompt?
The three major shells have different ways of doing this.
In the Korn shell, there is a variable in that can be set. This is the PS1 variable,
and it can be set manually as follows:
$ export myhost='hostname'
$ PS1='$LOGNAME@$myhost $PWD $'
This will give you a prompt with your login name, the hostname of the machine,
and the current directory, followed by the $ sign.
Note that this will only last as long as you are currently logged in. You will
lose this as soon as you log out. In the Korn shell, you can set this variable permanently
in the $HOME/.profile file.
In the C shell, you can do the following to set your prompt:
% set myhost='hostname'
% alias cd `chdir !* >/dev/null; set prompt="$LOGNAME@$myhost $cwd % "'
% cd
In the Bourne shell, there is no PS1 or set prompt, so for all intents and purposes
there is no easy way of doing this. In most cases, using the Korn shell over the
Bourne shell is highly recommended because it is mostly just an enhancement to the
Bourne shell.
How Can I Set Up My Korn Shell To Use Emacs
for Command Mode Editing Instead of the vi Editor?
There is a way of doing this that is undocumented. The key mappings can be bound
in your .kshrc file by adding the following lines:
alias __A='echo " |