- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Cloud

Working with iSCSI Target and Initiator to Mount on Clients
Being able to work with iSCSI block storage on servers and clients is becoming a common skill in today's distributed IT organizations. This activity will allow you to get hands on with setting up both an iSCSI initator and target (client and server) in order to mount that block storage on a system. Once you have completed this activity, you will understand how to make iSCSI storage available and then consume it on a system.

Lab Info
Table of Contents
-
Challenge
Install the Server and Client iSCSI Utilities
Since we are using the single instance as both server and client (target and initiator in this case), we can install what is needed with:
sudo yum install -y targetcli iscsi-initiator-utils
-
Challenge
Create the iSCSI Block Device on the Server
Using the first device on the system of 20gb, you are asked to create a block device that you make available via iSCSI. This will involve the following commands:
As root:
[#/] targetcli /> backstores/block/ create test1 /dev/nvme2n1 /> iscsi/ create iqn.2018-11.com.mylabserver:t1 /> cd iscsi/iqn.2018-11.com.mylabserver:t1/tpg1 /> luns/ create /backstores/block/test1 /> acls/ create iqn.2018-11.com.mylabserver:client
-
Challenge
Enable and Start the Target iSCSI Service
Easy enough to do, as root:
systemctl enable target systemctl start target
-
Challenge
Create the Client Initiator Name
We need to add the client initiator name (which we created in the earlier configration ACL for the target) to the /etc/initiatorname.iscsi file, like so:
InitiatorName=iqn.2018-11.com.mylabserver:client
-
Challenge
Complete the Client 'Initiator' Configuration and Discover (Verify) the Configuration
Within the /etc/iscsi/iscsi.conf file, you will look for, and change, the following values in the file:
node.session.auth.authmethod = CHAP <CHANGE TO> #node.session.auth.authmethod = CHAP
You are COMMENTING OUT the value. You then need to enable and start the service:
systemctl enable iscsi systemctl start iscsi
Discover and verify you can now see the block device:
iscsiadm --mode discovery --type sendtargets --portal [Private IP of Server]
and you should see the target configured.
Restart the iscsi and iscsid services:
systemctl restart iscsi
systemctl restart iscsid
Now make sure you can connect:
iscsiadm --mode node --targetname iqn.2018-11.com.mylabserver:t1 --portal [Private IP of Server] --login
You should now see the SCSI device (like /dev/sda) when executing the 'lsblk' command
About the author
Real skill practice before real-world application
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.