Home > UNIX > Determine LUN ID in AIX

Determine LUN ID in AIX

Recently I had to present some new LUN’s from a NetApp to my AIX box. Here is the procedure I used to determine which hdisks were which.

First I had my storage administrator create a Volume and LUN on the Filer and present it to this system. It is utilizing the Fiber Channel. The LUN ID’s were presented as 19 and 23.

On the AIX box I did a cfgmgr –v to install the new disks. The –v is not necessary, but I like verbose mode to see what it is actually doing.

Then I did a lsdev to see which hdisks were available. As you can see below I have 2 disks from the NetApp and 2 local SCSI disks.  I now know my new LUNs were presented to the AIX box as hdisk0 and hdisk1.

root@TEST# lsdev | grep hdisk

hdisk0      Available 06-08-02      MPIO NetApp FCP Default PCM Disk

hdisk1      Available 06-08-02      MPIO NetApp FCP Default PCM Disk

hdisk2      Available 09-08-00-3,0  16 Bit LVD SCSI Disk Drive

hdisk3      Available 09-08-00-4,0  16 Bit LVD SCSI Disk Drive

To determine the LUN ID for each of the hdisks I then ran lsattr. lsattr is used in AIX to determine the attributes of a device. –E is to diplay the effective values and –l followed by the device name is how to specify the hdisk in question.

root@TEST# lsattr -El hdisk0 |grep lun_id

lun_id          0x13000000000000                 Logical Unit Number ID           False

root@TEST# lsattr -El hdisk1 |grep lun_id

lun_id          0x17000000000000                 Logical Unit Number ID           False

Notice the LUN IDs are presented here in HEX format. If you are unable to do HEX > Decimal conversion in your head there is a handy converter at this website.

                HEX 0x13 = Decimal 19

                HEX 0x17 = Decimal 23

With the above information I now know the LUN presented with ID 19 shows up in AIX as hdisk0 and the LUN presented with ID 23 shows up in AIX as hdisk1.

With this information I then used SMIT to create the volume group, logical volumes, filesystems, and mount points.

About these ads
Categories: UNIX
  1. December 20, 2010 at 00:37

    “used it for years before going Chrome: Opera 11 now available http://t.”
    Are you sure that this is true?

    • Ken Santema
      December 20, 2010 at 08:28

      That Opera11 is available? Yep. I have it downloaded and using it now. Just started using it, but so far it has been Chrome fast.

  2. Alex
    October 14, 2013 at 17:12

    Here’s a one-liner to show the LUN IDs of all the disks on your system:

    echo “disk lun id”;lsdev -Cc disk | awk ‘{print $1}’ | while read disk; do LUN=$(lsattr -El $disk | grep lun_id | awk ‘{print $2}’ | awk -F”00000″ ‘{print $1}’); ID=$(printf ‘%d\n’ $LUN); echo “$disk $ID”; done

    Essentially the same thing you did, but using awk to get specific parts of the output and printf to do the hex conversion.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: