Topics: AIX, System Admin
Control-M
When exchanging text files between Windows and AIX systems, you often run into ^M (CTRL-M) characters at the end of each line in a text file. To remove these ugly characters:
tr -d '^M' < [inputfile] > [outputfile]To type the ^M character on the command line: press CTRL, then type v and the m.
Another way: download this zip archive: controlm.zip (1KB).
This zip archive includes 2 files: unix2dos and dos2unix, which you can run on AIX:
To convert a Windows file to Unix file:
# dos2unix [filename]
It's a good idea to centralize the shell history files for ease in tracking the actions done by the users:
Create a ${hist_dir}. Add the following lines to the /etc/profile file:
export HISTFILE=/${hist_dir}/${LOGNAME}_`date "+%Y%m%d_%H%M%S"`
export HISTSIZE=2000
Topics: AIX, System Admin↑
FTP umask
A way to change the default 027 umask of ftp is to change the entry in /etc/inetd.conf for ftpd:
ftp stream tcp6 nowait root /usr/sbin/ftpd -l -u 117This will create files with umask 117 (mode 660). Using the -l option will make sure the FTP sessions are logged to the syslogd. If you want to see these FTP messages in the syslogd output, then you should add to /etc/syslog.conf:
daemon.info [filename]
How do you send an attachment via e-mail from AIX to Windows? Uuencode is the answer:
# uuencode [source-file] [filename].b64 | mail -v -s "subject" [email-address]For example:
# uuencode /etc/motd motd.b64 | mail -v -s "Message of the day" email@hostname.comThe .b64 extension gets recognized by Winzip. When you receive your email in Outlook, you will have an attachment, which can be opened by Winzip (or any other unzip tool).
You can combine this into a one-liner:
# ( echo "This is the body";uuencode /etc/motd motd.b64 ) | mail -s "This is the subject" email@hostname.comIf you want to attach tar of gzip images to an e-mail, you can also simply use those extensions to send through email, as these extensions are also properly recognized by Winzip:
# uuencode file.tar file.tar | mailx -s "subject" email@hostname.com # uuencode file.tar.gz file.tar.gz | mailx -s "subject" email@hostname.com
Topics: AIX, System Admin↑
DLpar with DVD-ROM
Adding a DVD-ROM with DLpar is very easy. Removing however, can be somewhat more difficult, especially when you've run cfgmgr and devices have been configured. This is how to remove it. Remove all cdrom devices found with lsdev -Cc cdrom:
Then remove all devices found with:# rmdev -dl cd0 # rmdev -dl ide0
# lsdev -C | grep pciAll PCI devices still in use, can't be removed. The one not in use, is the PCI device where the DVD-ROM drive on was configured. You have to remove it before you can do a DLPAR remove operation on it. Now do your DLPAR remove operation.
Topics: AIX, System Admin↑
Defunct processes
Defunct processes are commonly known as "zombies". You can't "kill" a zombie as it is already dead. Zombies are created when a process (typically a child process) terminates either abnormally or normally and it's spawning
process (typically a parent process) does not "wait" for it (or has yet to "wait" for it) to return an exit status.
It should be noted that zombies DO NOT consume any system resources (except a process slot in the process table). They are there to stay until the server is rebooted.
Zombies commonly occur on programs that were (incompletely) ported from old BSD systems to modern SysV systems, because the semantics of signals and/or waiting is different between these two OS families.
See: http://www.hyperdictionary.com/dictionary/zombie+process
Let's say you have a helpdesk, where they must be able to run a script under user-id root to check or monitor a system:
First, create a script, you wish your helpdesk to run.
Modify your /etc/inetd.conf file and add:
check stream tcp wait root /usr/local/bin/script.shWhere script.sh is the script you've written.
Modify your /etc/services file and add:
check 4321/tcpYou may change the portnumber to anything you like, as long as it's not in use.
Now, you may run:
# telnet [system] 4321And your script will be magically run and it's output displayed on your screen. If the output of the script isn't displayed on your screen very long, just put a sleep command at the end of your script.
Use the following command to find any files that no longer have a valid user and/or group, which may happen when a group or user is deleted from a system:
# find / -fstype jfs \( -nouser -o -nogroup \) -ls
Topics: AIX, System Admin↑
Cleaning file systems
It sometimes occurs that a file system runs full, while a process is active, e.g. when a process logs its output to a file. If you delete the log file of a process when it is still active, the file will be gone, but the disk space will usually not be freed. This is because the process keeps the inode of the file open as long as the process is active and still writes to the inode.
After deleting the file, it's not available as file anymore, so you can't view the log file of the process anymore. The disk space will ONLY be freed once the process actually ends.
To overcome it, don't delete the log file, but copy /dev/null to it:
# cp /dev/null [logfile]This will clear the file, free up the disk space and the process logging to the file will just continue logging as nothing ever happened.
Topics: AIX, System Admin↑
Resizing the jfs log
In general IBM recommends that JFS log devices be set to 2MB for every 1GB of data to be protected. The default jfslog for rootvg is /dev/hd8 and is by default 1 PP large. In some cases, file system activity is too heavy or too frequent for the log device. When this occurs, the system will log errors like JFS_LOG_WAIT or JFS_LOG_WRAP.
First try to reduce the filesystem activity. If that's not possible, this is the way to extend the JFS log:
- Determine which log device to increase. This can be determined by its
Device Major/Minor Number in the error log:
# errpt -a
An example output follows:
The preceding numbers are hexadecimal numbers and must be converted to decimal values. In this exmpale, hexadecial 000A 0003 equals to decimal numbers 10 and 3.Device Major/Minor Number 000A 0003
- Determine which device corresponds with these Device Major/Minor Numbers:
# ls -al /dev | grep "10, 3"
If the output from the preceding command reveals that the log device the needs to be enlarged is /dev/hd8 (the default JFS log device for rootvg), then special actions are needed. See further on. - Increase the size of /dev/hd8:
extendlv hd8 1
- If the jfslog device is /dev/hd8, then boot the machine into Service Mode and access the root volume group and start a shell. If the jfslog is a user created jfslog, then unmount all filesystems that use the jfslog in question (use mount to show the jfslog used for each filesystem).
- Format the jfslog:
# logform [jsflog device]
For example:logform /dev/hd8
- If the jfslog device is /dev/hd8, then reboot the system:
# sync; sync; sync; reboot
If the jfslog is a user created jfslog, then mount all filesystems again after the logform completed.


