RHCE Objectives: Configure a system as either an iSCSI target or initiator that persistently mounts an iSCSI target
http://www.certdepot.net/rhel7-configure-iscsi-target-initiator-persistently/
Actually this page is pretty clear. I followed it and it worked just fine.
Create the image drives for use by clients:
yum install targetcli
targetcli
> cd /backstores/fileio > create shareddata /opt/shareddata.img 100M > cd /iscsi > create iqn.2017-02.pri.internal:target > cd iqn[tab]/tpg1/luns > create /backstores/fileio/shareddata > cd ../acls > create iqn.2017-02.pri.internal:client > cd iqn[tab] > set auth userid=cschelin > set auth password=password > exit
systemctl enable target
systemctl start target
firewall-cmd –permanent –add-port=3260/tcp
firewall-cmd –reload
On the client side:
yum install -y iscsi-initiator-utils
cd /etc/iscsi
vi initatorname.iscsi
Change the iqn to iqn.2017-02.pri.internal:client
vi iscsid.conf
Uncomment and update the authmethod, username, and password
systemctl enable iscsi
systemctl start iscsi
iscsiadm –mode discovery –type sendtargets –portal 192.168.1.203
iscsiadm –mode node –targetname iqn.2017-02.pri.internal:target –portal 192.168.1.203 –login
mkfs.xfs /dev/sdb
blkid /dev/sdb (get uuid)
vi /etc/fstab
Add UUID pointing to mnt, ext4, _netdev 0 0
mount -a