Skip to main content
RH254

Creating iSCSI Targets in Centos 7

By July 26, 2014September 12th, 2022No Comments

centos7With Enterprise Linux 7, both Red Hat and CentOS, there is a big change in the management of iSCSI targets. No longer to be have to concern ourselves with installing the yum packages as the software run as part od the standard systemd structure. Initially, of course, there will be nothing using the TCP Port 3260 but once we define a PORTAL , (iSCSI target server) then we will be up and running on the port with little effort from us.

In this demonstration we will use the same server as both the iSCSI target (server) and client(Initiator) but the same will hold true across separate systems. I use CentOS 7 but equally your could use Red Hat Enterprise Linux 7. The back-end store that will will use will be a disk file but a physical disk or LVM could be used. On the initiator we can check that TCP PORT 3260 is not in use: netstat -ant It should not be in use if there are no iSCSI Portals in use on your system. As root from the command line we can enter the management shell with the command: targetcli .

backstores/fileio create test /tmp/test.img 100m
iscsi/ create iqn.2014-07.com.tup:tgt
cd iscsi/iqn.2014-07.com.tup:tgt/tpg1
portals/ create
luns/ create /backstores/fileio/test
set attribute authentication=0
set attribute generate_node_acls=1
set attribute demo_mode_write_protect=0
exit

To ensure that the settings are read upon reboot  install and enable the targetd service. The targetd has no binaries and is mainly Python based and is limited to loading the configuration.

yum install targetd
systemctl enable targetd