All of the instructions below will be for Red Hat Enterprise Linux 8. If using a different Operating System ensure that the correct process is followed to add any required iSCSI modules and customize storage parameters for the best performance.
See the Linux Recommended Settings or the iSCSI Best Practices for Windows Server and FlashArray for more information.
Step 1: When Logged in Drop to the Root User
sudo -i
[ec2-user@ip-172-26-1-196 ~]$ sudo -i
[root@ip-172-26-1-196 ~]#
Step 2: Install Required Modules for iSCSI Connectivity
The required library name is iscsi-initiator-utils.
dnf install iscsi-initiator-utils
[root@ip-172-26-1-196 ~]# dnf install iscsi-initiator-utils
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:01:15 ago on Wed 21 Jul 2021 02:17:25 PM UTC.
Dependencies resolved.
==============================================================================================================================================================================================================================================================
Package Architecture Version Repository Size
==============================================================================================================================================================================================================================================================
Installing:
iscsi-initiator-utils x86_64 6.2.1.2-1.gita8fcb37.el8 rhel-8-baseos-rhui-rpms 379 k
Installing dependencies:
iscsi-initiator-utils-iscsiuio x86_64 6.2.1.2-1.gita8fcb37.el8 rhel-8-baseos-rhui-rpms 100 k
isns-utils-libs x86_64 0.99-1.el8 rhel-8-baseos-rhui-rpms 105 k
Transaction Summary
==============================================================================================================================================================================================================================================================
Install 3 Packages
Total download size: 584 k
Installed size: 2.4 M
Is this ok [y/N]:
Step 3: Install device-mapper-multipath Software
The device mapper software could already be installed on the system, this can be checked with the following command:
rpm -qa | grep device-mapper-multipath
[root@ip-172-26-1-196 ~]# rpm -qa | grep device-mapper-multipath
device-mapper-multipath-0.8.4-10.el8.x86_64
device-mapper-multipath-libs-0.8.4-10.el8.x86_64
Step 4: Configure Device Rules for FlashArray Block Storage
Review the required /etc/multipath.conf and UDEV rules for the relevant operating system in Linux Recommended Settings.
Step 5: Create an iSCSI Host on FlashArray for the EC2 Instance
On the operating system retrieve the iSCSI internet qualified name (iqn):
[root@ip-172-26-1-196 ~]# cat /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.1994-05.com.redhat:3754fc4ffcf
Record the initiator name iqn and navigate to the FlashArray user interface.
In the FlashArray user interface under Storage navigate to the Hosts view. Under Hosts select the + in the top right hand corner to create a new host.
Provide a name for the host and then select Create.
Once the host has been created navigate to it and select the 3 ellipses in the top right hand corner of Host Ports. In the drop down list select Configure IQNs...
Provide the IQN from Step 5 then select Add.
Step 6: Connect a Volume to the EC2 iSCSI Host
Once the host has been created a volume can be connected to it. Navigate to the Volumes view in Storage. To create a new volume select the + in the top right hand corner of the Volumes section.
Provide a name and capacity for the volume.
Once the volume has been created it can be connected to a host. Navigate to the new volume and select the three ellipses in the top right hand corner of Connected Hosts and select Connect.
In the Connect Hosts dialog select the host to connect and then select Connect.
The volume will now show it is connected to the EC2 instance.
Step 6: Discover and Connect to the iSCSI Target
To discover the IP address and target IQN from the initiator, use the iscsiadm utility with the discovery mode, replacing the IP address or host name after -p with the relevant address for your FlashArray IP address.
iscsiadm -m discovery -t sendtargets -p <IP Address or Hostname>
The response should provide all of the IP addresses that target can be reached on and the iqn of the FlashArray.
[root@ip-172-26-1-196 ~]# iscsiadm -m discovery -t sendtargets -p 10.21.194.55
10.21.194.55:3260,1 iqn.2010-06.com.purestorage:flasharray.593f4fa440d6bf67
10.21.194.57:3260,1 iqn.2010-06.com.purestorage:flasharray.593f4fa440d6bf67
10.21.194.56:3260,1 iqn.2010-06.com.purestorage:flasharray.593f4fa440d6bf67
10.21.194.58:3260,1 iqn.2010-06.com.purestorage:flasharray.593f4fa440d6bf67
Once the target name has been ascertained use the iscsadm utility in node mode to login to the target:
iscsiadm -m node --targetname <array iqn> -p <Array IP Address> -l
Repeat the steps for each IP address, ensuring that each login is met with success.
[root@ip-172-26-1-196 ~]# iscsiadm -m node --targetname iqn.2010-06.com.purestorage:flasharray.593f4fa440d6bf67 -p 10.21.194.55 -l
Logging in to [iface: default, target: iqn.2010-06.com.purestorage:flasharray.593f4fa440d6bf67, portal: 10.21.194.55,3260]
Login to [iface: default, target: iqn.2010-06.com.purestorage:flasharray.593f4fa440d6bf67, portal: 10.21.194.55,3260] successful.
[root@ip-172-26-1-196 ~]# iscsiadm -m node --targetname iqn.2010-06.com.purestorage:flasharray.593f4fa440d6bf67 -p 10.21.194.56 -l
Logging in to [iface: default, target: iqn.2010-06.com.purestorage:flasharray.593f4fa440d6bf67, portal: 10.21.194.56,3260]
Login to [iface: default, target: iqn.2010-06.com.purestorage:flasharray.593f4fa440d6bf67, portal: 10.21.194.56,3260] successful.
[root@ip-172-26-1-196 ~]# iscsiadm -m node --targetname iqn.2010-06.com.purestorage:flasharray.593f4fa440d6bf67 -p 10.21.194.57 -l
Logging in to [iface: default, target: iqn.2010-06.com.purestorage:flasharray.593f4fa440d6bf67, portal: 10.21.194.57,3260]
Login to [iface: default, target: iqn.2010-06.com.purestorage:flasharray.593f4fa440d6bf67, portal: 10.21.194.57,3260] successful.
[root@ip-172-26-1-196 ~]# iscsiadm -m node --targetname iqn.2010-06.com.purestorage:flasharray.593f4fa440d6bf67 -p 10.21.194.58 -l
Logging in to [iface: default, target: iqn.2010-06.com.purestorage:flasharray.593f4fa440d6bf67, portal: 10.21.194.58,3260]
Login to [iface: default, target: iqn.2010-06.com.purestorage:flasharray.593f4fa440d6bf67, portal: 10.21.194.58,3260] successful.
After login ensure that each iscsi node will be logged into automatically with the following iscsiadm command syntax:
iscsiadm -m node --targetname <Array iqn> -p <IP Address or Hostname of Array> -o update -n node.startup -v automatic
Ensure that multipath paths to the same device has been found using the multipathutility:
multipath -ll
[root@ip-172-26-1-196 ~]# multipath -ll
3624a9370668f1ab9b15f4bc400013a54 dm-0 PURE,FlashArray
size=2.0T features='0' hwhandler='1 alua' wp=rw
`-+- policy='service-time 0' prio=50 status=active
|- 3:0:0:1 sda 8:0 active ready running
|- 1:0:0:1 sdb 8:16 active ready running
|- 0:0:0:1 sdd 8:48 active ready running
`- 2:0:0:1 sdc 8:32 active ready running
Step 7: Create a filesystem on the Volume and Ensure it is Mounted at startup
Format the file system, this example uses the XFS file system, using the multipath device identified in Step 6:
mkfs.xfs /dev/mapper/<device>
[root@ip-172-26-1-196 ~]# mkfs.xfs /dev/mapper/3624a9370668f1ab9b15f4bc400013a54
meta-data=/dev/mapper/3624a9370668f1ab9b15f4bc400013a54 isize=512 agcount=4, agsize=134217728 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1
data = bsize=4096 blocks=536870912, imaxpct=5
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=262144, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
Discarding blocks...Done.
Use the blkid utility to identify the volume ID.
blkid
Note the UUID="xxxx" value as this will be used to mount the volume persistently.
[root@ip-172-26-1-196 ~]# blkid
/dev/nvme0n1: PTUUID="f34b923a-6ce9-4cef-841e-82ec5d63653c" PTTYPE="gpt"
/dev/nvme0n1p1: PARTUUID="07c6574c-7f85-4859-9689-c8090f35545a"
/dev/nvme0n1p2: UUID="d35fe619-1d06-4ace-9fe3-169baad3e421" BLOCK_SIZE="512" TYPE="xfs" PARTUUID="25a742d0-6b18-4c26-951a-2b99f1be934d"
/dev/mapper/3624a9370668f1ab9b15f4bc400013a54: UUID="3f220348-9b9f-4f22-bb00-3c28bb26e892" BLOCK_SIZE="512" TYPE="xfs"
In /etc/fstab add a line similar to the below, mounting the volume at the required location:
UUID=3f220348-9b9f-4f22-bb00-3c28bb26e892 /var/lib/mysql xfs _netdev 0 0
Once the /etc/fstab entry has been created and saved use the mount -a command to mount all devices in /etc/fstab (It may be necessary to create the directory first):
mount -a
Use the df command to check if the volume has been mounted successfully.
df -h
/dev/mapper/3624a9370668f1ab9b15f4bc400013a54 2.0T 15G 2.0T 1% /var/lib/mysql