How to Get the Partition Number on AIX Partitions ?

The uname command has been enhanced to show the partition number using the -L option. If you run uname -L on an AIX partition, you will see the following output:

1 lpar01

Where:

1 Partition number (unique for each partition)
lpar01 Partition name


If you run this command on AIX that is not running in a partitioned environment, you will see the following output:

nt-family: arial,helvetica,sans-serif;”>

NULL host_name

If you need to write a shell script to determine the partition number, it is advised that you use the following code fraction example:

LANG=C uname -Ls |
read junk partition_number partition_name

The -L option of the uname command only returns the partition number and partition name on AIX 5L Version 5.2 or AIX 5L Version 5.1 Recommended Maintenance Level 5100-03 or later, but it returns one additional string (“AIX”) on AIX 5L Version 5.1 Recommended Maintenance Level 5100-02, as shown in the following example:

AIX 1 lpar01

Therefore, if you add the -s option of uname, it ensures that you always receive the consistent output from uname, regardless of the AIX maintenance level.

Leave a Comment

Your email address will not be published. Required fields are marked *

CAPTCHA * Time limit is exhausted. Please reload the CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top