Skip to main content
Pure1 Support Portal

Configuring iSCSI on Linux for the Pure FlashArray

This document goes over the configuration and best practices to configure iSCSI in Linux.  In this example, we have used RHEL 6.x, but this procedure has also been tested on Ubuntu.  The steps below use commands with example IP addresses and IQNs.  When running the commands, replace the IPs and the IQNs with your own.

Pre-requisites

  1. Make sure that you are using our Linux Best Practices before proceeding. 
  2. If your iSCSI interfaces are on the same subnet, please reference the workaround at the bottom of this document for additional steps. 
  3. The LUN should be attached to the host, via your iSCSI switch before starting this procedure.
  4. Configure the iscsi-initiator service on RHEL and enable at bootup.
    To do this please see the following RHEL KB: How to configure the iscsi-initiator in Red Hat Enterprise Linux?
  5. Ensure that device-mapper-multipath is installed, if not see RHEL KB: Multipath packages not installed by default when root drive is not a multipath drive.

Connect to the LUN and Prepare the Pure FlashArray with the Host, LUN, and Host IQN

  1. RHEL Host:
    1. Get the IQN of the host initiator using cat /etc/iscsi/initiatorname.iscsi for example: 
      # cat /etc/iscsi/initiatorname.iscsi
      InitiatorName=iqn.1994-05.com.redhat:bffc5f96a7fb 
  2. FlashArray: 
    1. Create your Host entry, create your LUN(s), and then enter the IQN for the RHEL6 host into Pure for the host entry you just created.
  3. RHEL Host: 
    1. You can now discover the IQN of the Pure FlashArray (Any IP address that the array uses for iSCSI traffic should work:
      # iscsiadm -m discovery -t st -p 10.124.3.158
      10.124.3.159:3260,1 iqn.2010-06.com.purestorage:flasharray.38e69528198fee76
      10.124.3.158:3260,1 iqn.2010-06.com.purestorage:flasharray.38e69528198fee76
      
  4. FlashArray:
    1. Confirm the above IQNs are the correct IQNs (you want to make sure you are connecting to the correct array):
      # pureport list
  5. RHEL Host:
    1. Log the iSCSI sessions into Pure by running the following command (one session or more sessions if wanting to use multipath):
      # iscsiadm -m node -T iqn.2010-06.com.purestorage:flasharray.38e69528198fee76 -p 10.124.3.159 -l
      # iscsiadm -m node -T iqn.2010-06.com.purestorage:flasharray.38e69528198fee76 -p 10.124.3.158 -l
    2. Open iSCSI initiator (i.e iscsiadm) utility provides a feature to create multiple interfaces.
      # iscsiadm -m iface -I <iface name> -o new
    3. "You may then take the "-l" off the above command to display info about the iSCSI target:"
      # iscsiadm -m node -T iqn.2010-06.com.purestorage:flasharray.38e69528198fee76 -p 10.124.3.159
      # iscsiadm -m node -T iqn.2010-06.com.purestorage:flasharray.38e69528198fee76 -p 10.124.3.158
    4. Now update the newly created interface with a unique initiator name:
      # iscsiadm -m iface -I <iface name> -o update -n iface.initiatorname -v <initiator name>
    5. Rediscover paths from the new interface:
      # iscsiadm -m discovery -t st -p 10.124.3.159:3260
    6. Log in to the target IP with this newly created interface:
      # iscsiadm -m node --targetname iqn.2010-06.com.purestorage:flasharray.38e69528198 -I <iface name> -p 10.124.3.159 --login
    7. To add automatic login at boot: 
      # iscsiadm -m node -T iqn.2010-06.com.purestorage:flasharray.38e69528198<wbr/>fee76 -p 10.124.3.159 --op update -n node.startup -v automatic
      # iscsiadm -m node -T iqn.2010-06.com.purestorage:flasharray.38e69528198<wbr/>fee76 -p 10.124.3.158 --op update -n node.startup -v automatic

      -OR-
      # iscsiadm -m node -L automatic
    8. Confirm the Pure LUNs are listed on the host. 
      # lsscsi

Create a Partition

From RHEL6
  1. List the actual LUNs and note the path for your new Pure LUN:
    # fdisk -l 
  2. Enter fdisk for the new LUN using the path. (steps for LVM (pvcreate, vgcreate, lvcreate) will be added here later):
    # fdisk /dev/sdb
  3.  See info about the LUN:
    # p
  4. Create New Partition:
    # n
  5. Select either Extended or Primary (choosing Extended in this example)
    # e
  6. Choose size or use default number "1" to use entire LUN:
    # 1
  7. Create New "logical" partition inside the above partition which is basically a container:
    # n 
  8. Choose the letter "l" for logical:
    # l
  9. Choose size or use the default number "1" to use entire LUN:
    # 1
  10. Check for new partition and logical partition and note down the Device path (this example uses /dev/sdb5):
    # p
  11. Write to the partition table to sync it and confirm connectivity:
    # w
    # ctrl-c to exit fdisk

Format LUN to ext4 Filesystem

You have a few options:

No automatic unmap:

# mkfs.ext4 /dev/sdb5

Or, to enable automatic unmap for our thin-provisioning array, use the '-o discard' option when formatting:

# mkfs.ext4 -o discard /dev/sdb5

This will cause the RHEL 6.x to issue the UNMAP command, which in turn causes space to be released back to the array for any deletions in that ext4 file system.  This will only work on Physical RDM datastores, discard will not work on a disk mapped virtually via ESX.

Create the Mount Point for the Partition and Mount the Partition

  1. Create a directory where you'll mount the Pure LUN partition:
    # mkdir /mnt/iscsi
  2. Find and copy the UUID of the partition so you may use the UUID to mount an iscsi LUN partition:
    # blkid
  3. Backup the fstab file. 
    # cp /etc/fstab /etc/fstabBAK
  4. Add the UUID to the fstab file (in this example the UUID is 3c2aecaf-2dc0-47e1-aa39-e43e6f96d84c):
    # vim /etc/fstab

    EXAMPLE OF EDITED FSTAB FILE (our LUN partition is the last row):

    /dev/mapper/vg_quahogrhe6-lv_root /                       ext4    defaults        1 1
    
    UUID=447642c9-d5cd-4a1c-8479-e38ee1147b70 /boot                   ext4    defaults        1 2
    
    /dev/mapper/vg_quahogrhe6-lv_swap swap                    swap    defaults        0 0
    
    tmpfs                   /dev/shm                tmpfs   defaults        0 0
    
    devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
    
    sysfs                   /sys                    sysfs   defaults        0 0
    
    proc                    /proc                   proc    defaults        0 0
    
    UUID="3c2aecaf-2dc0-47e1-aa39-e43e6f96d84c"     /mnt/iscsi   ext4    _netdev 0 0

    Note:  we are using '_netdev' so the system does not try and mount the partition until after networking is up.

  5. Save and exit the file.
  6. Mount the partition:
    # mount /mnt/iscsi

     or

    # mount -a

     or if you require to mount the partition as read-only:

    # mount -o rw /mnt/iscsi
  7.  Verify the partition is mounted (this will also list the options for the mounted partition.  i.e.  "/dev/sdb5 on /data type ext4 (rw,_netdev)"):

    # mount
  8.  Confirm that the /mnt/iscsi folder is connected to the partition:

    # df -h /mnt/iscsi

Helpful Links