Zoning a Linux Server to a Storage Array

by [Published on 19 Dec. 2013 / Last Updated on 19 Dec. 2013]

In this article we'll go through the process of connecting a Windows server to a storage array using a linux server.

Introduction

In a recent article, I went through the process of connecting a Windows server to a storage array. I’m going to be doing the same thing in this post but with a Linux server. I’ll concentrate more heavily on some of the Linux aspects of this process in this article while in the other article I concentrated more heavily on zoning the switch. You will need at least some basic Linux knowledge to make this work. The switch zoning is done in pretty much the same way so please check that blog for more details. I will give a high level summary of what needs to be done, though.

It’s important to understand that every environment is different. Here, I’m using EMC equipment and CentOS. However, if you’re using equipment from a different array vendor or a different Linux distribution, some steps may not perfectly match. However, the concepts will all remain the same.

Prerequisites

In order to follow along with this article, you will need the following:

  • Server – A Linux server. In this example I’m using CentOS 5.9, which is almost exactly the same as RedHat.
  • HBAs – Host Bus Adapters for your server. I’ll be using Emulex, but they can be QLogic as well.
  • PowerPath for Linux along with licensing
  • Fibre Channel cables
  • Fibre Channel switches. I’ll be using Brocade.
  • Storage Array. I’ll be using a CX4-120 with a Unisphere WebUI. Any block storage array should work, though.

In this case I’ll be assuming everything has been networked and your Linux server is up and running with a static IP.

Drivers first

Install Drivers for HBAs:

  1. Go to the vendor (Emulex or QLogic) site to find the latest drivers for your version of Linux.
  2. Use WGET to download the driver.
  3. Unpack the drivers by typing:
    tar xzf elx-lpfc-dd-<Linux Distro>-<driver version>.tar.gz
  4. Go into the directory that has been created by typing:
    cd elx-lpfc-dd-<Linux Distro>-<driver version>/
  5. Run the install script by typing:
    ./elx_lpfc_install.sh
  6. Again the examples here are for Emulex. For more information on installing the driver go to this link.
  7. Restart your Linux host

Image
Figure 1

So now we should have HBAs installed and they’re being seen by the operating system. We can double check this by doing the following:

  1. Type: lspci | grep –i Fibre
  2. To see the hosts type: ls /sys/class/fc_host
  3. To show the WWNs type: cat /sys/class/fc_host/host13/port_name and cat /sys/class/fc_host/host14/port_name
  4. Again, this is specific to my example shown below. You may have different hosts. 

Image
Figure 2

EMC PowerPath next

We’ve shown that the driver installation has worked and we have WWNs that we’ll use later during the zoning so it’s time to install PowerPath for Linux. You can download PowerPath for Linux on the EMC support site (support.emc.com). You will need a valid license for this. You’ll also need to make sure you download the proper version of PowerPath for your version of Linux. If you’re using an older version of Linux it may not be compatible with a newer version of PowerPath. I ran into an issue using the RPM installer until I got the right version.

Install PowerPath for Linux:

  1. Use SCP or WinSCP to get PowerPath on to your Linux machine. You can also use wget. Whatever works to get the file on to the Linux host.
  2. Use tar xzf to unpack the RPM much like you did for the drivers above.
    tar xvf EMCPowerPath…tar.gz
  3. Type ls to see if there are multiple RPM files.
  4. Type: rpm –i EMCPowerPath…rpm to install the proper file for your version of Linux.
  5. After the install completes type emcpreg –install to begin the registration process.
  6. Type y to enter a new registration key.
  7. Type in a key.
  8. Press ENTER when done.
  9. Start PowerPath by typing: /etc/init.d/PowerPath start
  10. Make sure PowerPath is running by typing powermt display dev=all

We could also install the Navisphere Host Agent in the case of an EMC array. I’ll leave that part up to the admin, though. If you would like to install it you can also get this software from support.emc.com. Now we’ll move on to zoning the array. Again I’m not going to go through a step-by-step as you can find that in the other blog. The high level overview is to create aliases for both the array ports and the HBAs for the WWNs of these ports. Then we’ll zone the SP ports to each HBA. Finally include the zones in the ZoneConfig and enable the config.

At this point we can hop on the array and register the server. We can also make sure there are four host initiators as we’ve created four paths from the server to the array via the storage switches. If you decided to use the Navisphere Host Agent it should automatically register. You can easily register it manually by going to Hosts>>Host List and then click on the Connectivity Status. Then right click on the new Linux server to go through the registration process. We would then add the host as well as any LUNs we would like connected to it in a Storage Group.

Back on the Linux server if we type the PowerPath command powermt display dev=all we can confirm all of the paths on the server. As you can see from the picture below I have four paths that are all alive. You can see the I/O paths (sdb, sdc, etc) and the storage interfaces (SP B0, A1, A0, B1).

Image
Figure 3

We can see similar information about the physical paths by using the fdisk command on our Linux server as shown below. Disk /dev/sda is the actual local disk on my Linux machine. 

Image
Figure 4

Image
Figure 5

As you can see here we have several physical paths as represented by disks /dev/sdb, /dev/sdc, /dev/sdd, and /dev/sde. Again notice there are four “disks” which match up with our four paths. Each of these paths shows 21.4GB which makes sense because the one LUN I’ve presented to them is about 20GB. At the bottom of the second screenshot we see Disk /dev/emcpowera. This represents a sort of virtual disk. This is the disk we want to format so we can actually use it.

Format the disk:

  1. To show the partitions as above and get the name of your virtual disk type fdisk -l
  2. Type fdisk /dev/emcpowera
  3. To show the current partition table type: P
  4. To create a new partition type: N
  5. To create a primary partition type: P
  6. Follow the wizard to accept the sizing defaults. If you choose you can customize this, but the defaults should work in most cases.
  7. To save the changes type: W
  8. Restart the computer by typing shutdown –r now
  9. Again to show the updated disks type fdisk –l

Summary

That’s pretty much all there is to it. At this point you should be able to start using the shared disk as if it were another drive on your Linux machine. In this article I went through a very basic install of PowerPath. There are several things you can do to customize the configuration of PowerPath. Please see the support documentation on the EMC support site for more information.

Featured Links