Tech Blog

These are blog entries written by the UNIX Health Check development team. Our team has extensive technical experience on both AIX and Red Hat systems, and we like to share our knowledge with our visitors.

Topics: AIX, System Admin

df -I

The attribute "-I" (capital "i") for the df command can help you to show the actual used space within file systems, instead of giving you percentages with the regular df command:

# df -g
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/hd4           1.00      0.76   25%     5255     2% /
/dev/hd2           4.00      1.20   70%    55403     6% /usr
/dev/hd9var        1.00      0.74   27%     5324     3% /var
/dev/hd3           1.00      0.54   46%      325     1% /tmp
/dev/hd1           1.00      0.97    4%     1334     1% /home
/proc                 -         -    -         -     -  /proc
/dev/hd10opt       0.50      0.31   39%     4162     4% /opt

# df -gI
Filesystem    GB blocks      Used      Free %Used Mounted on
/dev/hd4           1.00      0.24      0.76   25% /
/dev/hd2           4.00      2.80      1.20   70% /usr
/dev/hd9var        1.00      0.26      0.74   27% /var
/dev/hd3           1.00      0.46      0.54   46% /tmp
/dev/hd1           1.00      0.03      0.97    4% /home
/proc                 -         -         -    -  /proc
/dev/hd10opt       0.50      0.19      0.31   39% /opt

Topics: AIX, System Admin

Reset an unknown root password

  • Insert the product media for the same version and level as the current installation into the appropriate drive.
  • Power on the server.
  • Boot the server into SMS mode and Choose Start Maintenance Mode for System Recovery.
  • Select Access a Root Volume Group. A message displays explaining that you will not be able to return to the Installation menus without rebooting if you change the root volume group at this point.
  • Type the number of the appropriate volume group from the list.
  • Select Access this Volume Group and start a shell.
  • At the prompt, type the passwd command to reset the root password.
  • To write everything from the buffer to the hard disk and reboot the system, type the following:
    # sync;sync;sync;reboot

Topics: AIX, System Admin

Converting HEX to DEC

Here's a simple command to convert a hexadecimal number to decimal. For example if you wish to convert hexadecimal "FF" to decimal:

# echo "ibase=16; FF" | bc
255

Topics: AIX, Security, System Admin

Password-less SSH Login

On occasion I have the need to establish trust relationships between Unix boxes so that I can script file transfers. In short, here's how you leverage SSH to do that. Using the example of trying to connect from server "a" to get a file on "b" follow this example:

  • Connect to "a".
  • Type: ssh-keygen -t rsa
  • The default directory for keyfiles will be ~/.ssh/ (if you do not want to be prompted, leave passphrase blank).
  • Copy the contents of .ssh/id_rsa.pub (there should only be one line).
  • Place this line on "b", in ~/.ssh/authorized_keys.
That's it, you should now be able to ssh/sftp/scp from a to b without being prompted for a password!

Topics: HMC, System Admin

Opening a virtual terminal window on HMC version 3.3.6

You may run into an issue with opening a virtual terminal window on an OLD HMC version (version 3.3.6). You can access the HMC through ssh, but opening a terminal window doesn't work. This ocurs when the HMC is in use for a full system partition on a frame:

At the fist attempt to login through ssh to the HMC and running vtmenu:

# ssh -l hscroot hmc
hscroot@hmc's password:
hscroot@lawhmc2:~> vtmenu

 Retrieving name of managed system(s) . . . 

 ----------------------------------------------------------
  Managed Systems:
 ----------------------------------------------------------
   1) 10XXXXX-XXXX
   2) 10YYYYY-YYYY
   3) 10ZZZZZ-ZZZZ

 Enter Number of Managed System.   (q to quit): 3

 ----------------------------------------------------------
  Partitions On Managed System:  10ZZZZZ-ZZZZ
 ----------------------------------------------------------

 Enter Number of Running Partition (q to quit):
Here's where you may get stuck. Vtmenu allows you to select a frame, but won't show show any partition to start a virtual terminal window on. Seems obvious, because there aren't any partitions available (fullSystemPartition only).

The solution is to run: mkvterm -m 10ZZZZZ-ZZZZ. This opens the virtual terminal window all right. When you're done, you can log out by using "~.". And if someone else is using the virtual terminal window, and you wish to close that virtual terminal window, run rmvterm -m 10ZZZZZ-ZZZZ.

In case you're wondering, how to figure out the managed machine name to use with the mkvterm and rmvterm commands, simply run vtmenu first. It shows you a list of managed machines controlled by this HMC.

Topics: AIX, Red Hat / Linux, System Admin

Change the PuTTY title

When you have a lot of Putty screens, or if you frequently login to a host through a jump server, it's very easy to set the title of the Putty window, for exmaple to the hostname of the server you're currently logged into. This way, you'll easily recognize each telnet screen, and avoid entering -possibly destructive- commands in the wrong window:

echo "\033]0;`hostname`\007"
For example, you can add this line to /etc/profile, and have the hostname of the PuTTY title set automatically.

Topics: PowerHA / HACMP, System Admin

Synchronizing 2 HACMP nodes

In order to keep users and all their related settings and crontab files synchronized, here's a script that you can use to do this for you:

sync.ksh

Topics: AIX, Installation, System Admin

Creating a bootable AIX DVD

This is a short procedure how to creat an AIX DVD from a base set of 8 AIX 5.3 CD's:

  1. Copy all CD's using "cp -hRp" to a directory, start with the last CD and work towards the first one. You can do this on either an AIX or a Linux system.
  2. Check that <directory>/installp/ppc contails all install images.
  3. If not already, remove <directory>/usr/sys/inst.images. This directory also might contain all installation images.
  4. Create a link <directory>/usr/sys/inst.images pointing to <directory>/installp/ppc.
  5. Find all .toc files in the directory structure and, if necessary, change all vol%# entries to vol%1 (There should be at least 2 .toc files that need these updates). You have to change vol%2 to vol%1, vol%3 to vol%1, etcetera, up till vol%8.
  6. Create an ISO image with RockRidge extentions:
    # mkisofs -R -o  
    
Now you've created an ISO image that you can burn to a DVD.

Some specific information on burning this ISO image on AIX to a DVD-RAM:

Burning a DVD-RAM is somewhat more difficult than burning a CD. First, it depends if you have a slim-line DVD-RAM drive in a Power5 system or a regular DVD-RAM drive in Power4 systems (not slimline).

Use DLPAR to move the required SCSI controller to a LPAR, in order to be able to use the DVD-RAM drive.

After the DLPAR action of the required SCSI controller is complete, execute: cfgmgr.

After the configuration manager has run, you will end up with either 1 or 2 DVD drives (depending on the actual drives in the hardware frame):
# lsdev -Cc cdrom
cd0 Available 3F-09-00-0,0 SCSI DVD-RAM Drive
cd1 Available 3F-09-00-5,0 16 Bit LVD SCSI DVD-ROM Drive
As you can see, the first is the DVD-RAM, the second is a DVD-ROM. Therefor, we will use the first one (in this sample).

Place a DVD-RAM single sided 4.7 GB Type II disc (partnumber 19P0862) in the drive. DO NOT USE ANY OTHER TYPE OF DVD-RAM DISCS. OTHER TYPE OF DISCS ARE NOT SUPPORTED BY IBM.

In case you have a POWER4 system:

Be sure to use a use the case of the DVD-RAM in order to burn the DVD. DVD-RAM drives in Power4 systems will NOT burn if you removed the DVD-RAM from its case.

Also, be sure to have the latest firmware level on the DVD-RAM drive (see website http://www14.software.ibm.com/webapp/set2/firmware for the correct level of the firmware for your drive). Without this firmware level these DVD-RAM drives are unable to burn Type II DVD-RAM discs. Using lscfg -vl cd0 you can check the firmware level:
# lscfg -vl cd0
cd0  U1.9-P2-I1/Z2-A0  SCSI DVD-RAM Drive (4700 MB)
        Manufacturer................IBM
        Machine Type and Model......DVRM00203
        ROS Level and ID............A132
        Device Specific.(Z0)........058002028F000010
        Part Number.................04N5272
        EC Level....................F74471
        FRU Number..................04N5967
The firmware level of this DVD-RAM drive is "A132". This level is too low in order to be able to burn Type II discs. Check the website for the latest level. The description on this webpage on how to install the DVD-RAM firmware was found to be inaccurate.

Install firmware as follows:

Download the firmware file and place it in /tmp on the server. You will get a filename with a "rpm" extension. Run:
# rpm -ihv --ignoreos <filename>
Example:
# rpm -ihv --ignoreos /tmp/ibm-scsi-dvdram.dvrm00203-A151.rpm
ibm-scsi-dvdram.dvrm00203  #############################
(Beware of the double dash before "ignoreos"!!). This command will place the microcode in /etc/microcode.

Run:
# diag -d cd0 -c -T "download -s /etc/microcode -f"
This will install the firmware. Use the correct DVD-RAM drive (in this case cd0) to install the firmware!!
# diag -d cd0 -c -T "download -s /etc/microcode -f"
Installation of the microcode has completed successfully.
The current microcode for cd0 is IBM-DVRM00203.A151.
Please run diagnostics on the device to ensure that it is
functioning properly.
Use the following command to burn the DVD-RAM:
# /usr/sbin/burn_cd -d /dev/cd0 /install/aix53ml4dvd.iso
Burning a DVD-RAM can take a long time. Variable burn times from 1 to 7 hours were seen!!! A DVD-RAM made in a slim-line DVD drive on a Power5 system can be read in a regular DVD drive on a Power4 system, if the latest firmware is installed on the DVD drive.

On a Linux system you can use a tool like K3B to write the ISO image to a regular DVD+R disc.

Topics: AIX, System Admin

Permanently change hostname

Permanently change hostname for inet0 device in the ODM by choosing one of the following:

Command line method:

# chdev -l inet0 -a hostname=[newhostname]
SMIT fastpath method:
# smitty hostname
Change the name of the node which changes the uname process by choosing one of the following:

Command line method:
# uname -S [newhostname]
Or run the following script:
# /etc/rc.net
Change the hostname on the current running system:
# hostname [newhostname]
Change the /etc/hosts file to reflect the new hostname. Change DNS name server, if applicable.

Topics: HMC, System Admin

Inaccessible vterm on HMC?

It may happen that a virtual terminal (vterm) from an HMC GUI only showes a black screen, even though the Lpar is running perfectly. Here's a solution to this problem:

  • Login to the HMC using ssh as hscroot.
  • Run lssscfg -R sys to determine the machine name of your lpar on the HMC.
  • Run mkvterm -m [machine-name] -p [partition-name].
  • You can end this session by typing "~." or "~~." (don't overlook the "dot" here!).
  • Now go back to your HMC gui via WebBased System Manager and start-up a new vterm. It works again!

Number of results found for topic System Admin: 249.
Displaying results: 161 - 170.