Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon

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.

Google Cloud Platform icon

Path Info

Clock icon Intermediate
Clock icon 30m
Clock icon Nov 12, 2018

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. 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
  2. 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
    /> cd iscsi/
    /> luns/ create /backstores/block/test1
    /> acls/ create
  3. Challenge

    Enable and Start the Target iSCSI Service

    Easy enough to do, as root:

    systemctl enable target
    systemctl start target
  4. 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:
  5. 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
    #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 --portal [Private IP of Server] --login

    You should now see the SCSI device (like /dev/sda) when executing the 'lsblk' command

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

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.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans