Connect to an iSCSI LUN in Linux with Open-iSCSI

Overview

To interact with an iSCSI LUN in Linux-based operating systems, users must connect to the LUN by entering a series of commands in the terminal based on the operating system being used to perform the interactions.  The tool used to interact with an iSCSI LUN in a Linux-based OS is dependent upon the type and version of the OS installed on the device.  If you are running the following operating systems or higher, the tool used to connect to the LUN is Open-iSCSI:

  • CentOS 5
  • RedHat ES 5
  • Fedora Core 6
  • Fedora Release 7
  • Debian
Follow the steps below to connect to an iSCSI LUN in Linux-based operating systems with Open-iSCSI

Connect to an iSCSI LUN

  1. Retrieve  the iSCSI details listed below from the Customer Portal.  Refer to View iSCSI Storage Details.

    • iSCSI IP Address or URL
    • iSCSI User Name
    • iSCSI Password

  2. Determine if the Open-iSCSI package has been installed on the operating system.

  3. If the Open-iSCSI package…

    Then

    Has been installed

    Proceed to the next step.

    Has not been installed

    Intsall the open-iscsi package.  Use the command below that applies to your current operating system.

     

    • CentOS 5, RedHat ES 5, Fedora Core 6, Fedora Release 7, or higher

                    yum install iscsi-initiator-utils

    • Debian

                    apt-get install open-iscsi


  4. Determine if you are connecting to the iSCSI LUN in Debian.

  5. If connecting to iSCSI in…

    Then

    Debian

    Enter the following command in the terminal to fix the file paths for iscsiadmin:

         ln -s /etc/{iscsid.conf,initiatorname.iscsi} /etc/iscsi/

    Another OS

    Proceed to the next step


  6. Some newer version of the iscsi-iniator-utils use initiatorname.conf also, so open the /etc/iscsi/initiatorname.conf file with your preferred text editor and edit it to look like the following

        InitiatorName= iqn.2014-01.com.example:node1.target1

  7. Enter the following command in the terminal to back up the original configuration of the iscsid.conf configuration file:

           cp /etc/iscsi/iscsid.conf{,.save}

  8. Open the configuration (/etc/iscsi/iscsid.conf) with your preferred text editor.
  9. Replace the contents of the configuration with the following configuration details:
             node.startup = automatic
        node.session.auth.username = ISCSI_USER
        node.session.auth.password = ISCSI_PASS
        discovery.sendtargets.auth.username = ISCSI_USER
        discovery.sendtargets.auth.password = ISCSI_PASS
        node.session.timeo.replacement_timeout = 120
        node.conn[0].timeo.login_timeout = 15
        node.conn[0].timeo.logout_timeout = 15
        node.conn[0].timeo.noop_out_interval = 10
        node.conn[0].timeo.noop_out_timeout = 15
        node.session.iscsi.InitialR2T = No
        node.session.iscsi.ImmediateData = Yes
     
       node.session.iscsi.FirstBurstLength = 262144
        node.session.iscsi.MaxBurstLength = 16776192
        node.conn[0].iscsi.MaxRecvDataSegmentLength = 65536

                           
  10. Start the iscsid program.  Refer to the table below for the appropriate command to enter in the terminal based on your OS:

  11. Operating System

    Command

    CentOS 5+


    /etc/init.d/iscsi start

     

    Fedora Core 6+

    Fedora Release 7+

    RedHat ES 5+

    Debian

    /etc/init.d/open-iscsi restart


  12. Enter the following command in the terminal to run a discovery against the iSCSI target host.

            iscsiadm -m discovery -t sendtargets -p ISCSI_TARGET_HOST


                Note: Replace the ISCSI_TARGET_HOST token with the iSCSI IP Address.

  13. Restart the the iSCSI service.  Refer to the table below for the appropriate command to enter in the terminal based on your OS:

  14. Operating System

    Command

    CentOS 5


    /etc/init.d/iscsi restart

     

    Fedora Core 6

    Fedora Release 7

    RedHat ES 5

    Debian

    /etc/init.d/open-iscsi restart


An additional drive will now appear on the system.  You may print out the drive device with the following command at any time:

        find /sys/devices/platform/host* -name block\* -exec ls -la '{}' \; | sed s#^.*../block/#/dev/#g