David Hedges

  • Home
  • About
  • Contact
  • Business Blog
  • IT Blog

Creating an ISCSI target on RHEL8 / CentOS8

April 13, 2020 by dhedges Leave a Comment

I recently bought a HP server that has 40T of storage outside of the OS array. I had set it up to act as an iscsi storage target for a couple of vmware hosts I run in my lab. Looking around on the internet I was able to find a lot of information on how to create iscsi targets with fileio, but not many that many that talked about utilizing direct access to block storage.

I am going to describe configuring your iscsi target on a block storage device. I am also assuming that you don’t need to open ports in firewalld or have it disabled.

  • locate the device your iscsi storage is on:
    • run: fdisk -l
  • Next install the targetcli package:
    • Run: yum install targetcli -y
  • Run targetcli
  • Create the backstores
    • Run: cd backstores/block
  • Run: create dev=/dev/<storage> name=MyStorage
  • Running “ls” should show something similar to this:
  • Creating the iscsi Targets
    • Run: cd /iscsi
  • Create a iscsi target by creating a custom IQN ( many times the format is iqn.YYYY-MM.com.example:targetdescription )
    • Run: create wwn=iqn.2020-01.com.mydomain:svrstorage
  • Running ls should show something similar to this:
  • Add ACLs for the hosts that will connect
    • Run: cd iqn.2020-10.com.mydomain:svrstorage/tpg1/acls  (using your custome IQN)
    • Create the ACL for the connecting hosts (you must know the IQN of the connecting host)
      • Run: create wwn=iqn.2019-02.com.otherhost:node1
  • Running “ls” should show something like this:
  • We need to map the LUN to the iscsi target
    • Run cd /iscsi/iqn.2020-10.com.mydomain:svrstorage/tpg1/luns  (the IQN being the remote hosts IQN)
    • Run: create /backstores/block/MyStorage
  • Running “ls” should show you something like this
  • Verify it all looks right, and exit
    • Run: cd /
    • Run: ls    and verify that your settings appear correct
  • If all of your devices and ACLs look correct, type exit to save and quit.
  • Start the iscsi target
    • Run: systemctl enable target
      • This will enable the daemon starting each time the server starts up
    • Run: systemctl start target
      • This will start the iscsi target daemon
    • At this point your remote hosts should be able to connect and see the storage you have shared.

Filed Under: IT Blog

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Copyright © 2025 · Beautiful Pro Theme on Genesis Framework · WordPress · Log in