Article

Connecting Fedora 8 to iSCSI Targets on an EMC Celerra SAN


About:
Author: Dr. Duncan J. Potter, July 2008.

NB:
This is an incomplete write-up.
References to the original servers and SANS used has been removed for security. A number of outstanding questions remain and the article is incomplete. It is published here as it may nonetheless be helpful to anyone wishing to establish an iSCSI connection to an EMC Celerra SAN.

Reference Section

  1. Setup an iSCSI Initiator
    Brief article that summarises most of what this page covers.

  2. Linux Open-iSCSI Initiator
    In-depth reference article.

  3. Open-iSCSI and SUSE Linux
    In-depth reference article, not quite the same as our iscsi-inititor-utils package but still very helpful.

  4. MAN page of iscsi.conf
    As it says on the tin, the core configuration file manual page.

What this article will cover

  1. Installation of the iSCSI client software, iscsi initiator utils, on a Fedora 8 server

  2. Connection to an EMC SAN via iSCSI and discovery of LUNS

  3. Configuration of the iSCSI client software to mount two preconfigured iSCSI LUNS on an EMC SAN.

What this article assumes

  1. You have root access to your Fedora system (naturally)

  2. iSCSI LUNS have been made available to your Fedora system on the SAN
    (This is covered fully elsewhere but is briefly touched upon here too)

1. Connection to the Fedora 8 Server (fedora.mydept)

Key Facts

Our Server: fedora.mydept.ac.uk (abbrev. fedora)
Server OS: Fedora 8
LAN: eth0 - IP: 137.195.x.y
Server Login: melogin

SSL & Configuring the Fedora Environment

(You may wish to jump straight to the next section which deals with installing the iSCSI client software).

Access to the server is via SSL from a Windows XP host.

  1. On the XP host, download and install the freeware PuTTY SSL client.
  2. Use PuTTY (putty.exe) to connect to fedora via SSH.
  3. Login as user account melogin.

    Check the Linux environment and configure according to one's taste:

  4. Edit the .bashrc file to create some useful aliases:
    fedora> vi .bashrc

    and enter

    alias ls-'ls -F'

    [vi reminder: "i" = Insert mode, :w writes file, :q quits, ESC exits a mode]

  5. As vi is not everyone's cup of tea, one may use the PSFTP (PuTTY Secure FTP) executable to transfer a single binary of the nanoemacs (ne) editor to the server.
    • Start PSFTP (it asks for the host to connect to) and login as melogin.
    • Check the local and remote working directories:
      > lwd
       C:/
      > pwd
       /u1/others/melogin
      

    • Copy the ne binary from the root of C:\ on the XP host to the Fedora machine:
      > put ne
      > quit
      

    • Using PuTTY and SSH, login to the Fedora machine, perform an lroot, then move & rename the binary:
      	
      > su -lroot
      > cp /u1/others/melogin/ne /sbin
      > chmod a+rx /sbin/ne
      > mv /sbin/ne /sbin/ue
      
      

      Why rename the binary? Only because the author is familiar with issuing the ue (microemacs) command and for basic editing, there's no difference between the nano and micro versions of the software.

  6. Let us examine the current disk environment:
    fedora> df -h
    
    Device        Capacity    Use   Mount
    /dev/sda1     29G         53%   /
    /dev/sda2     29G         2%    /var
    /dev/sda5     137G       1%    /data0
    /dev/sda6     137G       1%    /data1
    /dev/sda7     137G       1%    /data2
    tmpfs		2G          1%    /dev/shm
    

  7. Now change to root and check out the shell environment:
    fedora> su -lroot
    [root@fedora~#] 
    [root@fedora~#] pwd
    			 /root
    [root@fedora~#] 
    

    Check the PATH environment variable as sometimes, on Fedora, this excludes /sbin:

    [root@fedora~#] printenv PATH

    (affirm that it does contain /sbin)

    Finally, check the OS version:

    [root@fedora~#] uname -r
    			 2.6.25.14_69.fc8
    

2. Obtain and install the iSCSI Initiator Utils Package

The package named iSCSI Initiator Utils permits iSCSI client access for Linux systems to iSCSI Targets.

  1. First, check if it this package is already installed:
    [root@fedora~#] rpm -q iscsi-initiator-utils
    			(nothing found)
    

  2. Search for the package with YUM, hoping it resides in a Fedora repository:
    [root@fedora~#] yum search iscsi-initiator-utils
    			 iscsi-initiator-utils.x86_64
    

    One can check the version from http://www.rpmfind.net - indeed, this is the appropriate version.

  3. Install the package using YUM:
    [root@fedora~#] yum -y install iscsi-initiator-utils
    			 Installed! iscsi-initiator-utils.x86_64 0.6.2.0.865-0.2.fc8
    

3. Configure the iSCSI Initiator Utils Package

There are four main things to know about the iSCSI Initiator Utils package.

  1. Let us check the service configuration files, the startup and running status of the iSCSI service:
    [root@fedora~#] cd /etc/iscsi
    [root@fedora~#] ls
    			 iscsid.conf 
    			 initiatorname.iscsi
    [root@fedora~#]
    [root@fedora~#] chkconfig --list | grep iscsi
    			(service iscsi and iscsid are ON for runlevels 3,4 & 5)
    [root@fedora~#]
    [root@fedora~#] service iscsi status
    			 service iscsi is stopped
    [root@fedora~#]
    [root@fedora~#] service iscsid status
    			 service iscsid is stopped		
    			
    

    Observe that there are two services, iscsi and iscsid, but one is believed to be an alias of the other.
    After installation, neither is running, which is good because we have some configuration to perform.

  2. The iscsi service will identify this server via a unique, but user changeable, name called the iscsi initiator name.

    Open configuration file /etc/iscsi/initiatorname.iscsi in an editor of your choice

    [root@fedora~#] ue /etc/iscsi/iscsi/initiatorname.iscsi

    Locate the line starting with InitiatorName=
    The last portion of this line, that which follows the colon, may be editied so as to provide a more human-readable identifier for this iSCSI client which is something we will need shortly.

    For our Fedora server the line was edited to look as follows:

    InitiatorName=iqn.2005-03.org.open-iscsi:fedora001

  3. Now we require to edit the other configuration file, /etc/iscsi/iscsid.conf, to incorporate information on this iSCSI initiator name and the remote iSCSI system to which we wish to connect.

    A word of clarification: iSCSI Target
    When configuring an iSCSI SAN, the term Target refers to a collection of LUNS on the SAN which some remote client (Linux server) wishes to connect with. However, when we are talking about the iscsi initiator utils package, the term target refers to the iSCSI initiator name. (Or do I have this very wrong?)

    Open /etc/iscsi/iscsid.conf in an editor and add the two lines shown:

    [root@fedora~#] cd /etc/iscsi
    [root@fedora~#] ue /etc/iscsi/iscsid.conf
    DiscoveryAddress=137.195.a.b:3260
    TargetName=iqn.2005-03.org.open-iscsi:fedora001
    

    The DiscoveryAddress should be the IP and port number (default: 3260) of the iSCSI Target on the SAN. Here the actual IP address has been hidden for security, you would substitute your own Celerra IP address here, naturally.

    The TargetName is actually the iSCSI Initiator name on our Fedora server - but I do need to check that, be careful, these notes are incomplete.

4. Discovery of, and login to, iSCSI SAN Targets

So, the iSCSI initiator utils package has been installed, the service is not running, and all the configuration has been completed on the Linux end. Only four steps remain:

Before doing any of this, we must configure the SAN to allow connection from this Fedora host.

This brief operation is covered in the four Highslide-enabled graphics below.
In the example screens here we have a Celerra iSCSI Target with the name iSCSI_macs to which we wish to connect our Fedora server.

Celerra Manager Wizard Step 1: Locate the iscsi_macs Target

Login to the Celerra Manager and locate the iscsi folder on the left-hand panel.
In the right-hand pane, locate the Targets tab.
Locate iscsi_macs target then right-click and select Properties from the popup menu .

(Remember, use the left and right arrow keys in this tutorial to navigate to the next slide or Escape to exit this slide).

Celerra Manager Wizard Step 2: Add a new LUN Mask to the iscsi_macs Target

Once you have selected Properties, the right-hand panel changes to two tabs: Target and LUN Mask.

In the LUN Mask tab click on the new button.

(Remember, use the left and right arrow keys in this tutorial to navigate to the next slide or Escape to exit this slide).

Celerra Manager Wizard Step 3: Add the new LUN Mask Details

Complete the details for the new LUN Mask.
Remember, this will grant access to the remote Fedora server with iSCSI Initiator name iqn.2005-03.org.open-iscsi:fedora001.

Here we grant access to LUNS 0 and 1 (at the time of writing, we have only two LUNS in iSCSI target macs_iscsi).

(Remember, use the left and right arrow keys in this tutorial to navigate to the next slide or Escape to exit this slide).

Celerra Manager Wizard Step 4: View all LUN Mask Details

Finally we see all LUN Masks for the iscsi_macs target, with our newly added Fedora server at the bottom.

Remember, not more than one remote server should connect to the same iSCSI LUN at the same time. Multiple entries here indicate systems used in testing.

(Remember, use the left and right arrow keys in this tutorial to navigate to the next slide or Escape to exit this slide).

Now that the SAN will permit access from our iSCSI client software, there are two steps involved in connection to the SAN: discovery of iSCSI targets, and login to those targets. It is useful to establish an alias for the commands used as they're quite involved.

  1. Create useful alias entries.
    As root, create the following alias entries in .bashrc (here with the microemacs editor, you could use vi just as easily):
    Below, IP number 137.195.a.b represents the Celerra SAN (replace with the IP number for your own SAN, naturally).
    [root@fedora~#] cd /root
    [root@fedora~#] ue .bashrc
    
    				alias is-discovery='iscsiadm -m discovery -t sendtargets -p 137.195.a.b:3260'
    				alias is-login='iscsiadm -m mode -t iqn.1992-05.com.emc:ck2000629002240000-2 -p 137.195.a.b -l'
    				alias is-logout='iscsiadmin -m node --logoutall=all'		
    [root@fedora~#]
    [root@fedora~#] . /.bashrc
    				
    

    Here, t stands for iSCSI Target and p is the iSCSI portal of the SAN.
    The portal represents an ethernet device (either physical or logical on the SAN) inside of which we may think of a number of iSCSI Targets as residing. One portal (ethernet device) may represent a single gateway to a number of Celerra systems connected together, inside of which multiple iSCSI targets may have been created. This is why we have both a portal and a target, and not just one or the other.

  2. Start the iSCSI service
    [root@fedora~#] service iscsi start
    [root@fedora~#] service iscsi status
    			 service iscsi is running
    
    

  3. Perform iSCSI discovery of Targets using the above alias:
    [root@fedora~#] is-discovery
    			 137.195.a.b.3260,1 iqn.1992-05.com.emc:ck2000629002240000-2
    
    

  4. Login to the above iSCSI targets. In this configuration no CHAPS passwords have been set for simplicity.
    [root@fedora~#] is-login
    

  5. If the login went well, we should have two new iSCSI LUNS presenting themselves as local disks.
    Let's check - recall that before, we had only /dev/sda.
    [root@fedora~#] fdisk -l
    		/dev/sda
    		/dev/sdb
    			/dev/sdb1
    		/dev/sdc
    			/dec/sdc1
    

    The devices /dev/sdb1 and /dev/sdc1 are are two iSCSI LUNS.

  6. Importantly, we sometimes need to know how to dismount these LUNS, which is performed by logging out of the iSCSI session as follows:
    [root@fedora~#] iscsiadmin -m node --logoutall=all
    

 

5. Mounting the iSCSI LUNS

Now that we have discovered and logged-in to the iSCSI SAN, we wish to mount the LUNS. There is one thing to remember.

We get around this by using disk labels. A disk label stays with a disk (or LUN) no matter which system may mount it.

  1. Once we have our LUNS available, we label them as follows:
    [root@fedora~#] tune2fs -L mylun1 /dev/sdb1
    [root@fedora~#] tune2fs -L mylun2 /dev/sdc1
    		
    

    One needs do this only once (it has been done for the two iSCSI LUNS created for MACS to this point).

  2. Create mount points for the LUNS. Here we creat mount points under /mnt:
    [root@fedora~#] cd /mnt
    [root@fedora~#] mkdir /mnt/sdb
    [root@fedora~#] mkdir /mnt/sdc
    		
    

  3. Edit /etc/fstab and specify that mounting be done by label.
    The _netdev ensures that the network service has started before any attempt to mount a device is made:
    [root@fedora~#] ue /etc/fstab
    
    #device			mountpoint		Filesys		Options		backup		fsck
    LABEL=mylun1	/mnt/sdb		ext3		_netdev		0			0
    LABEL=mylun2	/mnt/sdc		ext3		_netdev		0			0
    		
    

    Now mount all _netdev devices:

    [root@fedora~#] mount -a -t _netdev		
    

    The mount should now persist across reboots.