• JD Wallace

Configuring Ubuntu 20.04 Host for iSCSI with FlashArray

Updated: Dec 22, 2020

There seem to be plenty of tutorials out there on configuring RHEL for iSCSI volumes on FlashArray, and while it's pretty similar for Ubuntu, there are some slight variations.


[Update] A previous version of this tutorial would cause the volume automount at reboot to hang. Shout out to Joe Houghes for pointing out the fix. Joe blogs at fullstackgeek.net.


Here is the official Pure Storage iSCSI for Linux documentation, and here is the official Ubuntu iSCSI documentation.


Prepare the FlashArray with the Host, Volume, and Host IQN

1. I'm starting with a clean and patched Ubuntu Server 20.04.1 LTS installation.

2. Install required packages. (These were already installed by default on my server.)

sudo apt install open-iscsi multipath-tools

3. Find the Ubuntu server's IQN. (Run this command on the server.)

sudo cat /etc/iscsi/initiatorname.iscsi

You get output that looks something like this. The last line contains your IQN.

4. Create a new host on the FlashArray. (These commands are run on the FlashArray.)

purehost create UbuntuVM

5. Set the host IQN from the value collected in step 2.

purehost setattr --addiqnlist \
iqn.1993-08.org.debian:01:8a7fa9c0e017 UbuntuVM

6. Create a new volume.

purevol create UbuntuVol --size 2TB

7. Map the volume to the host.

purevol connect UbuntuVol --host UbuntuVM

8. Find the iSCSI interfaces IPs on the FlashArray. (You'll need this in the next section.)

pureport list

You'll get an output that looks something like this. Find the IPs for the iSCSI interfaces.


Linux Host Configuration

1. Back on the Linux host. Add the FlashArray multipath configuration to /etc/multipath.conf.

devices {
  device {
        vendor "PURE"
        product "FlashArray"
        fast_io_fail_tmo 10
        path_grouping_policy "group_by_prio"
        failback "immediate"
        prio "alua"
        hardware_handler "1 alua"
        max_sectors_kb 4096
    }
}

2. Restart multipath service.

systemctl restart multipathd.service

3. Discover the FlashArray target iSCSI portals. (You found these IPs in the last step of the first section. You only need to run this command for one of the IPs.)

sudo iscsiadm -m discovery -t st -p 192.168.1.246:3260

4. Log into the FlashArray iSCSI target portals.

sudo iscsiadm -m node -p 192.168.1.246 --login
sudo iscsiadm -m node -p 192.168.1.247 --login

5. Configure automatic service start and iSCSI login.

sudo iscsiadm -m node --op=update \
-n node.conn[0].startup -v automatic
sudo iscsiadm -m node --op=update \
-n node.startup -v automatic
systemctl enable open-iscsi

After the last command you may be prompted to enter your password several times.

6. Restart iscsid service.

systemctl restart iscsid.service

7. Login to discovered volumes.

sudo iscsiadm -m node --loginall=automatic

Mount Volume and Provision File System

1. Create a mountpoint.

sudo mkdir /mnt/FlashArrayVol

2. Get ID of FlashArray volume.

sudo multipath -ll

3. Create partition.

sudo fdisk /dev/mapper/mpatha
n
p 
1
enter
enter
w 

Option 1 - Ext4 file system

4a. Create a file system.

sudo mkfs.ext4 /dev/mapper/mpatha-part1

5a. Mount the file system.

sudo mount /dev/mapper/mpatha-part1 /mnt/FlashArrayVol

6a. Automatically remount the file system after a host reboot.

First find the volume UUID.

sudo blkid | grep mpatha-part1

Next append the following line to /etc/fstab replacing [YourUUID] with the one from above.

/dev/disk/by-uuid/[YourUUID] /mnt/FlashArrayVol ext4 _netdev 0 0

Option 2 - XFS file system

4b. Create a file system.

sudo mkfs.xfs -b size=4096 -m reflink=1,crc=1 /dev/mapper/mpatha-part1

5b. Mount the file system.

sudo mount /dev/mapper/mpatha-part1 /mnt/FlashArrayVol

6b. Automatically remount the file system after a host reboot.

First find the volume UUID.

sudo blkid | grep mpatha

Next append the following line to /etc/fstab replacing [YourUUID] with the one from above.

/dev/disk/by-uuid/[YourUUID] /mnt/FlashArrayVol xfs _netdev 0 0

I am an employee of Pure Storage.

My statements and opinions on this site are my own and do not necessarily represent those of Pure Storage.

©2020 jdwallace.com.