Topics: AIX, Backup & restore, LVM, Performance, Storage, System Admin
Spreading logical volumes over multiple disks
A common issue on AIX servers is, that logical volumes are configured on only one single disk, sometimes causing high disk utilization on a small number of disks in the system, and impacting the performance of the application running on the server.
If you suspect that this might be the case, first try to determine which disks are saturated on the server. Any disk that is in use more than 60% all the time, should be considered. You can use commands such as iostat, sar -d, nmon and topas to determine which disks show high utilization. If the do, check which logical volumes are defined on that disk, for example on an IBM SAN disk:
# lspv -l vpath23A good idea always is to spread the logical volumes on a disk over multiple disk. That way, the logical volume manager will spread the disk I/O over all the disks that are part of the logical volume, utilizing the queue_depth of all disks, greatly improving performance where disk I/O is concerned.
Let's say you have a logical volume called prodlv of 128 LPs, which is sitting on one disk, vpath408. To see the allocation of the LPs of logical volume prodlv, run:
# lslv -m prodlvLet's also assume that you have a large number of disks in the volume group, in which prodlv is configured. Disk I/O usually works best if you have a large number of disks in a volume group. For example, if you need to have 500 GB in a volume group, it is usually a far better idea to assign 10 disks of 50 GB to the volume group, instead of only one disk of 512 GB. That gives you the possibility of spreading the I/O over 10 disks instead of only one.
To spread the disk I/O prodlv over 8 disks instead of just one disk, you can create an extra logical volume copy on these 8 disks, and then later on, when the logical volume is synchronized, remove the original logical volume copy (the one on a single disk vpath408). So, divide 128 LPs by 8, which gives you 16LPs. You can assign 16 LPs for logical volume prodlv on 8 disks, giving it a total of 128 LPs.
First, check if the upper bound of the logical volume is set ot at least 9. Check this by running:
# lslv prodlvThe upper bound limit determines on how much disks a logical volume can be created. You'll need the 1 disk, vpath408, on which the logical volume already is located, plus the 8 other disks, that you're creating a new copy on. Never ever create a copy on the same disk. If that single disk fails, both copies of your logical volume will fail as well. It is usually a good idea to set the upper bound of the logical volume a lot higher, for example to 32:
# chlv -u 32 prodlvThe next thing you need to determine is, that you actually have 8 disks with at least 16 free LPs in the volume group. You can do this by running:
Note how in the command above the original disk, vpath408, was excluded from the list.# lsvg -p prodvg | sort -nk4 | grep -v vpath408 | tail -8 vpath188 active 959 40 00..00..00..00..40 vpath163 active 959 42 00..00..00..00..42 vpath208 active 959 96 00..00..96..00..00 vpath205 active 959 192 102..00..00..90..00 vpath194 active 959 240 00..00..00..48..192 vpath24 active 959 243 00..00..00..51..192 vpath304 active 959 340 00..89..152..99..00 vpath161 active 959 413 14..00..82..125..192
Any of the disks listed, using the command above, should have at least 1/8th of the size of the logical volume free, before you can make a logical volume copy on it for prodlv.
Now create the logical volume copy. The magical option you need to use is "-e x" for the logical volume commands. That will spread the logical volume over all available disks. If you want to make sure that the logical volume is spread over only 8 available disks, and not all the available disks in a volume group, make sure you specify the 8 available disks:
Now check again with "mklv -m prodlv" if the new copy is correctly created:# mklvcopy -e x prodlv 2 vpath188 vpath163 vpath208 \ vpath205 vpath194 vpath24 vpath304 vpath161
# lslv -m prodlv | awk '{print $5}' | grep vpath | sort -dfu | \
while read pv ; do
result=`lspv -l $pv | grep prodlv`
echo "$pv $result"
done
The output should similar like this:
Now synchronize the logical volume:vpath161 prodlv 16 16 00..00..16..00..00 N/A vpath163 prodlv 16 16 00..00..00..00..16 N/A vpath188 prodlv 16 16 00..00..00..00..16 N/A vpath194 prodlv 16 16 00..00..00..16..00 N/A vpath205 prodlv 16 16 16..00..00..00..00 N/A vpath208 prodlv 16 16 00..00..16..00..00 N/A vpath24 prodlv 16 16 00..00..00..16..00 N/A vpath304 prodlv 16 16 00..16..00..00..00 N/A
And remove the original logical volume copy:# syncvg -l prodlv
# rmlvcopy prodlv 1 vpath408Then check again:
# lslv -m prodlvNow, what if you have to extend the logical volume prodlv later on with another 128 LPs, and you still want to maintain the spreading of the LPs over the 8 disks? Again, you can use the "-e x" option when running the logical volume commands:
You can also use the "-e x" option with the mklv command to create a new logical volume from the start with the correct spreading over disks.# extendlv -e x prodlv 128 vpath188 vpath163 vpath208 \ vpath205 vpath194 vpath24 vpath304 vpath161
Shown below a script that can be used to create a simple comma separated values file (CSV) from NMON data.
If you wish to create a CSV file of the CPU usage on your system, you can grep for "CPU_ALL," in the nmon file. If you want to create a CSV file of the memory usage, grep for "MEM," in the nmon file. The script below creates a CSV file for the CPU usage.
#!/bin/ksh
node=`hostname`
rm -f /tmp/cpu_all.tmp /tmp/zzzz.tmp /tmp/${node}_nmon_cpu.csv
for nmon_file in `ls /var/msgs/nmon/*nmon`
do
datestamp=`echo ${nmon_file} | cut -f2 -d"_"`
grep CPU_ALL, $nmon_file > /tmp/cpu_all.tmp
grep ZZZZ $nmon_file > /tmp/zzzz.tmp
grep -v "CPU Total " /tmp/cpu_all.tmp | sed "s/,/ /g" | \
while read NAME TS USER SYS WAIT IDLE rest
do
timestamp=`grep ${TS} /tmp/zzzz.tmp | awk 'FS=","{print $4" "$3}'`
TOTAL=`echo "scale=1;${USER}+${SYS}" | bc`
echo $timestamp,$USER,$SYS,$WAIT,$IDLE,$TOTAL >> \
/tmp/${node}_nmon_cpu.csv
done
rm -f /tmp/cpu_all.tmp /tmp/zzzz.tmp
done
Note: the script assumes that you've stored the NMON output files in /var/msgs/nmon. Update the script to the folder you're using to store NMON files.A major number refers to a type of device, and a minor number specifies a
particular device of that type or sometimes the operation mode of that
device type.
Example:
In the list above:# lsdev -Cc tape rmt0 Available 3F-08-02 IBM 3580 Ultrium Tape Drive (FCP) rmt1 Available 3F-08-02 IBM 3592 Tape Drive (FCP) smc0 Available 3F-08-02 IBM 3576 Library Medium Changer (FCP)
rmt1 is a standalone IBM 3592 tape drive;
rmt0 is an LTO4 drive of a library;
smc0 is the medium changer (or robotic part) of above tape library.
Now look at their major and minor numbers:
All use IBM tape device driver (and so have the same major number of 38), but actually they are different entities (with minor number of 0, 128 and 66 respectively). Also, compare rmt0 and rmt0.1. It's the same device, but with different mode of operation.# ls -l /dev/rmt* /dev/smc* crw-rw-rwT 1 root system 38, 0 Nov 13 17:40 /dev/rmt0 crw-rw-rwT 1 root system 38,128 Nov 13 17:40 /dev/rmt1 crw-rw-rwT 1 root system 38, 1 Nov 13 17:40 /dev/rmt0.1 crw-rw-rwT 1 root system 38, 66 Nov 13 17:40 /dev/smc0
Topics: AIX, System Admin↑
Longer login names
User names can only be eight characters or fewer in AIX version 5.2 and earlier. Starting with AIX version 5.3, IBM increased the maximum number of characters to 255. To verify the setting in AIX 5.3 and later, you can extract the value from getconf:
Or use lsattr:# getconf LOGIN_NAME_MAX 9
To change the value, simply adjust the v_max_logname parameter (shown as max_logname in lsattr) using chdev to the maximum number of characters desired plus one to accommodate the terminating character. For example, if you want to have user names that are 128 characters long, you would adjust the v_max_logname parameter to 129:# lsattr -El sys0 -a max_logname max_logname 9 Maximum login name length at boot time True
Please note that this change will not go into effect until you have rebooted the operating system. Once the server has been rebooted, you can verify that the change has taken effect:# chdev -l sys0 -a max_logname=129 sys0 changed
Keep in mind, however, that if your environment includes IBM RS/6000 servers prior to AIX version 5.3 or operating systems that cannot handle user names longer than eight characters and you rely on NIS or other authentication measures, it would be wise to continue with the eight-character user names.# getconf LOGIN_NAME_MAX 128
Topics: AIX, Installation, NIM, System Admin↑
Nimadm
A very good article about migrating AIX from version 5.3 to 6.1 can be found on the following page of IBM developerWorks:
http://www.ibm.com/developerworks/aix/library/au-migrate_nimadm/index.html?ca=drs
For a smooth nimadm process, make sure that you clean up as much filesets of your server as possible (get rid of the things you no longer need). The more filesets that need to be migrated, the longer the process will take. Also make sure that openssl/openssh is up-to-date on the server to be migrated; this is likely to break when you have old versions installed.
Very useful is also a gigabit Ethernet connection between the NIM server and the server to be upgraded, as the nimadm process copies over the client rootvg to the NIM server and back.
The log file for a nimadm process can be found on the NIM server in /var/adm/ras/alt_mig.
For example, if you wish to add the bos.alt_disk_install.rte fileset to a SPOT:
List the available spots:
List the available lpp sources:# lsnim -t spot | grep 61 SPOTaix61tl05sp03 resources spot SPOTaix61tl03sp07 resources spot
Check if the SPOT already has this file set:# lsnim -t lpp_source | grep 61 LPPaix61tl05sp03 resources lpp_source LPPaix61tl03sp07 resources lpp_source
No output is shown. The fileset is not part of the SPOT. Check if the LPP Source has the file set:# nim -o showres SPOTaix61tl05sp03 | grep -i bos.alt
Install the first fileset (bos.alt_disk_install.boot_images) in the SPOT. The other fileset is a prerequisite of the first fileset and will be automatically installed as well.# nim -o showres LPPaix61tl05sp03 | grep -i bos.alt bos.alt_disk_install.boot_images 6.1.5.2 I N usr bos.alt_disk_install.rte 6.1.5.1 I N usr,root
Note: Use the -F option to force a fileset into the SPOT, if needed (e.g. when the SPOT is in use for a client).# nim -o cust -a filesets=bos.alt_disk_install.boot_images -a lpp_source=LPPaix61tl05sp03 SPOTaix61tl05sp03
Check if the SPOT now has the fileset installed:
# nim -o showres SPOTaix61tl05sp03 | grep -i bos.alt bos.alt_disk_install.boot_images bos.alt_disk_install.rte 6.1.5.1 C F Alternate Disk Installation
You can restrict a certain user account to only access a single folder. This is handled by file /etc/ftpaccess.ctl. There's a manual page available within AIX on file ftpaccess.ctl:
# man ftpaccess.ctlIn general, file /etc/ftpusers controls which accounts are allowed to FTP to a server. So, if this file exists, you will have to add the account to this file.
Here's an example of what you would set in the ftpaccess.ctl if you wanted user ftp to have login to /home/ftp. The user will be able to change directory forward, but not outside this directory. Also, when user ftp logs in and runs pwd it will show only "/" and not "/home/ftp".
If the user is required to write files to the server with specific access, for example, read and write access for user, group and others, then this can be accomplished by the user itself by running the FTP command:# cat /etc/ftpaccess.ctl useronly: ftp
To further restrict the FTP account to a server, especially for accounts that are only used for FTP purposes, make sure to disable login and remote login for the account via smitty user.ftp> site umask 111 200 UMASK set to 111 (was 027) ftp> site umask 200 Current UMASK is 111
Topics: AIX, System Admin↑
PS1
The following piece of code fits nicely in the /etc/profile file. It makes sure the PS1, the prompt is set in such a way, that you can see who is logged in at what system and what the current path is. At the same time it also sets the window title the same way.
H=`uname -n`
if [ $(whoami) = "root" ] ; then
PS1='^[]2;${USER}@(${H}) ${PWD##/*/}^G^M${USER}@(${H}) ${PWD##/*/} # '
else
PS1='^[]2;${USER}@(${H}) ${PWD##/*/}^G^M${USER}@(${H}) ${PWD##/*/} $ '
fi
Note: to type the special characters, such as ^], you have to type first CRTL-V, and then CTRL-]. Likewise for ^G: type it as CTRL-V and then CTRL-G.
Second note: the escape characters only work properly when setting the window title using PuTTY. If you or any of your users use Reflection to access the servers, the escape codes don't work. In that case, shorten it to:
if [ $(whoami) = "root" ] ; then
PS1='${USER}@(${H}) ${PWD##/*/} # '
else
PS1='${USER}@(${H}) ${PWD##/*/} $ '
fi
VIM on many different types of installations will create both swap files and backup files.
How to disable VIM swap and backup files:
Go into your _vimrc file. Add these lines to the bottom:
set nobackup set nowritebackup set noswapfile
Topics: AIX, Networking, System Admin↑
IP alias
To configure IP aliases on AIX:
Use the ifconfig command to create an IP alias. To have the alias created when the system starts, add the ifconfig command to the /etc/rc.net script.
The following example creates an alias on the en1 network interface. The alias must be defined on the same subnet as the network interface.
# ifconfig en1 alias 9.37.207.29 netmask 255.255.255.0 upThe following example deletes the alias:
# ifconfig en1 delete 9.37.207.29


