25.2. Creating an iSCSI 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.iscsi
file accordingly. For example:#
cat /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2006-04.com.example.node1#
vi /etc/iscsi/initiatorname.iscsi
- Discover the target:
#
iscsiadm -m discovery -t st -p target-ip-address
10.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 -l
Logging 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_name
Replace 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/fstab
to 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