Show Table of Contents
25.2. Creating an iSCSI Initiator
After creating a target with
targetcli as in Section 25.1, “Target Setup”, use the iscsiadm utility to set up an initiator.
In Red Hat Enterprise Linux 7, the iSCSI service is lazily started by default: the service starts after running the
iscsiadm command.
Procedure 25.7. Creating an iSCSI Initiator
- Install
iscsi-initiator-utils:#yum install iscsi-initiator-utils -y - If the ACL was given a custom name in Section 25.1.6, “Configuring ACLs”, modify the
/etc/iscsi/initiatorname.iscsifile accordingly. For example:#cat /etc/iscsi/initiatorname.iscsiInitiatorName=iqn.2006-04.com.example.node1#vi /etc/iscsi/initiatorname.iscsi - Discover the target:
#iscsiadm -m discovery -t st -p target-ip-address10.64.24.179:3260,1 iqn.2006-04.com.example:3260 - Log in to the target with the target IQN you discovered in step 3:
#iscsiadm -m node -T iqn.2006-04.com.example:3260 -lLogging in to [iface: default, target: iqn.2006-04.com.example:3260, portal: 10.64.24.179,3260] (multiple) Login to [iface: default, target: iqn.2006-04.com.example:3260, portal: 10.64.24.179,3260] successful.This procedure can be followed for any number of initators connected to the same LUN so long as their specific initiator names are added to the ACL as described in Section 25.1.6, “Configuring ACLs”. - Find the iSCSI disk name and create a file system on this iSCSI disk:
#grep "Attached SCSI" /var/log/messages#mkfs.ext4/dev/disk_nameReplace disk_name with the iSCSI disk name displayed in/var/log/messages. - Mount the file system:
#mkdir /mount/point#mount/dev/disk_name/mount/pointReplace /mount/point with the mount point of the partition. - Edit the
/etc/fstabto mount the file system automatically when the system boots:#vim /etc/fstab/dev/disk_name/mount/point ext4 _netdev 0 0Replace disk_name with the iSCSI disk name. - Log off from the target:
#iscsiadm -m node -T iqn.2006-04.com.example:3260 -u

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.