Wednesday, November 15, 2006

Part 1 - AIX Command - Daily Used

Introduction
We all know that AIX has a vast array of commands that enable us to do multitudes of tasks. Depending on what we need to accomplish we use only a certain subset of these commands. These subsets differ from user to user and from need to need. However, there are a few core commands that we all use. We need these commands either to answer our own questions or to provide answers to the support professionals' queries.

In this article we will discuss some of these core commands. The intent is to provide a list that can be used as a ready reference. While the behavior of these commands should be identical in all releases of AIX, they have been tested only under AIX 5.1.

Note that the bootinfo command discussed in the following paragraphs is NOT a user-level command and is NOT supported in AIX 4.2 or later.

Commands

Kernel
To display if the kernel is 32-bit enabled or 64-bit enabled, type:

bootinfo -K

How can I change from one kernel mode to another?

/unix is a symbolic link to the booted kernel. To find out what kernel mode is running, enter ls -l /unix and see what file /unix is linked to. Following are the three possible outputs from ls -l /unix command and their corresponding kernels:

 
/unix -> /usr/lib/boot/unix_up              # 32 bit uniprocessor kernel 
/unix -> /usr/lib/boot/unix_mp              # 32 bit multiprocessor kernel
/unix -> /usr/lib/boot/unix_64              # 64 bit multiprocessor kernel       

During the installation process, one of the 32-bit kernels, appropriate to the hardware, is enabled by default. The system can be changed to boot up in 64-bit kernel mode by using the following commands:

 
ln -sf /usr/lib/boot/unix_64    /unix
ln -sf /usr/lib/boot/unix_64    /usr/lib/boot/unix
bosboot -ad  /dev/hdiskxx
shutdown -r

The /dev/hdiskxx directory is where the boot logical volume /dev/hd5 is located. To find out what xx is in hdiskxx, run the following command:

 
 lslv -m hd5
 

Hardware
64-bit hardware is required to run the 64-bit kernel. All pSeries 64-bit hardware can run either the 64-bit kernel or the 32-bit kernel. If you don't know whether your hardware is 64-bit or not, type the following command:

bootinfo -y

How much real memory does my machine have?

To display real memory in kilobytes, type:

bootinfo -r    

or

lsattr -El sys0 -a realmem 

Can my machine run AIX 5.2?

AIX 5.2 runs only on what is called Common Hardware Reference Platform (CHRP). If you don't know whether your hardware belongs to this class, type the following command:

# /usr/sbin/bootinfo -p  

If it does not return the string chrp it is not capable of running AIX 5.2.

In AIX 5.2, the 32-bit kernel is installed by default. The 64-bit kernel, along with JFS2 (enhanced journaled file system), can be enabled at installation time.

What attribute values do the devices in my system have?

To list the current attribute values for the tape device rmt0, type:

 
lsattr -l rmt0 -E

To list the default attribute values for the tape device rmt0, type:

lsattr -l rmt0 -D

To list the possible values of the login attribute for the tty device tty0, type:

lsattr -l tty0 -a login -R

To display system level attributes, type:

lsattr -E -l sys0

How many processors does my system have?

To display the number of processors on your system, type:

lscfg | grep proc

How many hard disks does my system have and which ones are in use?

To display the number of hard disks on your system, type:

lspv

How do I get detailed configuration of my system?

You can get detailed configuration information for your system with the lscfg -pv command. The -p flag displays platform specific device information. This flag is applicable to AIX 4.2.1 or later. The -v flag displays Vital Product Data (VPD) found in the Customized VPD object class.

For example, to display details about the tape drive rmt0, type:

 
lscfg -vl rmt0

How do I find out the Chip type, System name, Node name, Model Number etc.?

The uname command provides details about your system.

uname -p

Displays the chip type of the system. For example, powerpc.

uname -r

Displays the release number of the operating system.

uname -s

Displays the system name. For example, AIX.

uname -n

Displays the name of the node.

uname -a

Displays the system name, nodename,Version, Machine id.

uname -M

Displays the system model name. For example, IBM, 7046-B50.

uname -v

Displays the operating system version

uname -m

Displays the machine ID number of the hardware running the system.

uname -u

Displays the system ID number.

AIX
What Version, Release and Maintenance Level of AIX is running on my system?

oslevel -r

or

lslpp -h bos.rte

How do I change the size of a filesystem?

To increase /usr filesystem size by 1000000 512-byte blocks, type:

chfs -a size=+1000000 /usr

How do I mount a cd?

mount -V cdrfs -o ro /dev/cd0  /cdrom

How do I get the IP address of my machine?

ifconfig -a

or

host Fully_Qualified_Host_Name

For example, host cyclop.austin.ibm.com.

Which fileset contains a particular binary?

To show the fileset that contains /usr/bin/vmstat, type:

lslpp -w /usr/bin/vmstat

To show the fileset that contains /usr/bin/svmon, type:

which_fileset svmon

How to determine if all filesets of Maintenance Levels are installed on your system?

instfix -i | grep ML

How to determine if a fix is installed on your system?

To determine if IY24043 is installed, type:

instfix -ik IY24043

How to verify if filesets have required prerequisites and are completely installed?

To show which filesets need to be installed or corrected, type:

lppchk -v

How to get a dump of the header of the loader section and the symbol entries in symbolic representation?

dump -Htv

How to determine the amount of paging space allocated and in use?

lsps -a

Volume Groups and Logical Volumes
How to create a volume group?

Use the following command, where spartition_size sets the number of megabytes in each physical partition where the partition_size is expressed in units of megabytes from 1 through 1024. The size variable must be equal to a power of 2 (for example 1, 2, 4, 8). The default value is 4.

mkvg -y name_of_volume_group -s partition_sizelist_of_hard_disks

How to Create a Logical Volume?

mklv -y name_of_logical_volumename_of_volume_groupnumber_of_partition

Queries about Volume Groups

To show volume groups in the system, type:

lsvg

To show all the characteristics of rootvg, type:

lsvg rootvg

To show disks used by rootvg, type:

lsvg -p rootvg

How to Add a Disk to a Volume Group?

extendvg   VolumeGroupName   hdisk0 hdisk1 ... hdiskn 

How to Replace a Disk?

1. extendvg VolumeGroupNamehdisk_new

2. migratepv hdisk_bad hdisk_new

3. reducevg -d VolumeGroupNamehdisk_bad

How to Mirror a Logical Volume?

1. mklvcopy LogicalVolumeNameNumberofcopies

2. syncvg VolumeGroupName

Conclusion
Admittedly, a list such as this can be helpful in quickly answering some of your own questions. Obviously it does not cover everything that you might need. You can extend the usefulness of such a list by adding other commands that would answer questions which are not covered here.

No comments: