Tracing IBM AIX hdisks back to IBM System Storage SAN Volume Controller (SVC) volumes

When working in an IBM AIX® environment that uses the IBM System Storage® SAN Volume Controller (SVC), you need to be able to determine the SVC volumes that represent each AIX hdisk. This article covers the procedure to perform this manually as well as automate the process by using a script. With these skills, you will be able to better manage the storage on your SVC and AIX systems.

Share:

Brian Smith (ixbrian@gmail.com), System Administrator

Photo of Brian SmithBrian Smith is a UNIX/Linux system administrator and lives in Colorado Springs, CO with his wife and two children. He has worked with IBM AIX for the last seven years. His areas of expertise include AIX, IBM PowerVM, shell scripting, Perl programming, and Linux. You can find more information about his work at Brian Smith's AIX / UNIX / Linux / Open Source blog.



01 November 2013

Also available in Chinese Russian

Introduction

SVC is an extremely powerful and versatile SAN virtualization product from IBM. It supports numerous features such as thin provisioning, IBM Real-time Compression™, online data migration, and so on. The management of the SVC is done through a simple web interface that makes working with it very intuitive and easy. However, from an AIX host perspective, it can be time consuming and difficult to map out which AIX hdisk maps back to which SVC volume. If you need to delete a SVC LUN hdisk device from an AIX server, you need to be sure you understand which hdisk maps to which SVC LUN to prevent deleting the wrong LUN. This article covers how to discover which SVC volume backs each AIX hdisk when using the SDDPCM multipathing software on AIX.


Manual tracing

If you only have a couple of AIX hdisks that you need to map back to SVC volumes, the simplest way is to just do it manually. We need to begin by collecting information from the AIX server. This article is geared towards AIX servers using the IBM Subsystem Device Driver Path Control Module (SDDPCM) multipathing software. SDDPCM provides the pcmpath command which is a very powerful command that can, among several other things, gather information about the LUN's visible on the AIX server and that are controlled by SDDPCM. Start by logging in to your AIX server and running the pcmpath query device command. This shows detailed information on the status of each SAN LUN controlled by SDDPCM. One of the items listed for each LUN is a serial number. The serial number is the key that we can use to trace the hdisks back to SVC volumes as the SVC shows this same number as the volume "UID".

Listing 1. Example output of pcmpath query device
# pcmpath query device 
DEV#: 0 DEVICE NAME: hdisk0 TYPE: 2145 ALGORITHM: Load Balance 
SERIAL: 60050763624B79486800000000000004
========================================================================== 
Path#   Adapter/Path  Name    State   Mode    Select    Errors 
0             fscsi0/path0    OPEN    NORMAL  8037977   0 
1             fscsi0/path1    OPEN    NORMAL  8032250   0 
2*            fscsi0/path2    OPEN    NORMAL       62   0 
3*            fscsi0/path3    OPEN    NORMAL       62   0 
4             fscsi1/path4    OPEN    NORMAL  8066256   0 
5             fscsi1/path5    OPEN    NORMAL  8070900   0 
6*            fscsi1/path6    OPEN    NORMAL       62   0 
7*            fscsi1/path7    OPEN    NORMAL       62   0 

DEV#: 1   DEVICE NAME: hdisk1   TYPE: 2145  ALGORITHM: Load Balance 
SERIAL: 60050763624B79486800000000000005
========================================================================== 
Path#   Adapter/Path Name     State   Mode    Select  Errors 
0             fscsi0/path0     OPEN    NORMAL  3009569      0 
1             fscsi0/path1     OPEN    NORMAL  3008052      0 
2*            fscsi0/path2     OPEN    NORMAL       49      0 
3*            fscsi0/path3     OPEN    NORMAL       49      0
4             fscsi1/path4     OPEN    NORMAL  3019297      0 
5             fscsi1/path5     OPEN    NORMAL  3018514      0 
6*            fscsi1/path6     OPEN    NORMAL       49      0 
7*            fscsi1/path7     OPEN    NORMAL       49      0

In Listing 1, we can see that there are two SAN LUNs: hdisk0 and hdisk1. The output also shows that hdisk0 has a serial number of 60050763624B79486800000000000004 and hdisk1 has a serial number of 60050763624B79486800000000000005.

Next, log in to the SVC web interface and go to the Volumes section as shown in Figure 1.

Figure 1. Volumes section on the SVC
Volumes section on the SVC

In the Volumes section, verify that you have the UID column displayed. If you do not see it, right-click in the top header area and select the UID check box to enable this column, as shown in Figure 2.

Figure 2. Enable the UID column if needed
Enable the UID column if needed

Next, click the UID column so the list of volumes is sorted by the UID number. Now, look through the list and find the two serial numbers that we previously recorded from the pcmpath query device AIX output from Listing 1. Each AIX LUN serial number from pcmpath query device should match with one of the SVC volume UID numbers, as shown in Figure 3.

Figure 3. Match the serial number from AIX with UID from SVC
Match the serial number from AIX with UID from SVC

You can see in Figure 3 that the hdisk0 AIX device maps back to the App1_1 SVC volume and the hdisk1 AIX device maps back to the App1_2 SVC volume.


Automating the process

After understanding how to manually map back AIX LUNs to SVC volumes, the next step is to automate the process. This can help you save time and make it practical to accomplish this on an AIX server that might have hundreds of SVC volumes mapped to it.

This article presents a script that can automate this task. The script is run from the AIX server, and the output is a report showing all AIX SDDPCM controlled LUNs and their corresponding SVC information, including the SVC volume name.

Because the script is run on the AIX host, it must also gather information from the SVC for the report. The script supports two different methods to gather the information from the SVC. One method is to have the script connect to the SVC over an SSH connection (using SSH keys or by manually typing the password) to gather the information. However, some system administrators do not have access to SVC. In such cases, the other option is to specify a file. This file must contain the output of the lshostvdiskmap command from the SVC. This makes it possible to have your SAN administrator run the lshostvdiskmap command, send you the output, and still be able to use this script without direct access to SVC.

When you run the script, you either specify a user name and the SVC host as user@svchost or specify the path to the file that contains the previously obtained lshostvdiskmap output. The script is run from an AIX server and creates a report on all of the AIX server's hdisks that are controlled by SDDPCM.

For example, to have the script connect to the SVC named "svchost" as the "user" account over an SSH connection, you can run the command similar to the one in Listing 2.

Listing 2. Example command to run the svc_report.sh script and have it connect to SVC to obtain information
./svc_report.sh user@svchost

To use a file on the AIX server named /tmp/lshost_output that contains the output of the SVC lshostvdiskmap command, use a command such as the one in Listing 3.

Listing 3. Example command to run the svc_report.sh script and have it use a file
./svc_report.sh /tmp/lshost_output

The output of the report looks as shown in Figure 4.

Figure 4. Example report from the svc_report.sh script
Example report from the svc_report.sh script

Click to see larger image

Figure 4. Example report from the svc_report.sh script

Example report from the svc_report.sh script

The report shows the AIX hdisk name, the AIX volume group, the hdisk size, and information from the SVC, such as the volume name and serial number.

The script to create the reports is shown in Listing 4.

Listing 4. svc_report.sh script
#!/usr/bin/ksh 
if ! [ `whoami` = "root" ]; then 
echo "Script must be run as root" 
exit 3 
fi 

if [ -n "$1" ]; then 
if [ -e "$1" ]; then 
svcinfo=`cat "$1"` 
else
svcinfo=`ssh $1 lshostvdiskmap` 
fi 
else 
echo "Specify filename with SVC lshostvdiskmap output in it" 
echo "OR specify username@svchost to retrive info from SVC through SSH" 
echo "example: $0 /path/to/lshostvdiskmap_output" 
echo "example: $0 user@svc1" 
exit 1
fi 

if ! [ -n "$svcinfo" ]; then 
echo "Error: Unable to retrive SVC info" 
exit 2 
fi 
printf  "AIX_Host_Name   AIX_hdisk  AIX_VG       SIZE_MB    "
echo "id SVC_AIX_host  SCSI_id vdisk_id SVC_vdisk_name             SVC_vdisk_UID"
pcmpath query device | egrep "^DEV|^SERIAL" | paste - - | 
awk '{print $5 " " $12}' | while read disk serial; do 
vg=`lspv | grep "^$disk " | awk '{print $3}'` 
size=`getconf DISK_SIZE /dev/$disk` 
printf "%-15s %-10s %-12s %-10s " `hostname -s` $disk $vg $size 
echo "$svcinfo" | grep "$serial *$" || echo "Not found on SVC: $serial" 
done

Conclusion

Tracing AIX hdisks back to SVC volumes is a task that system administrators need to do on a regular basis. It is critical to do this correctly so that no mistakes are made when performing SVC maintenance such as deleting or resizing LUNs. After reading this article, you should be able to manually trace back AIX hdisks to SVC volumes, and also use the script covered in the article to automate this process and save time.


Resources

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into AIX and Unix on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=AIX and UNIX
ArticleID=950533
ArticleTitle=Tracing IBM AIX hdisks back to IBM System Storage SAN Volume Controller (SVC) volumes
publish-date=11012013