7장. Configuring an iSCSI initiator
An iSCSI initiator opens a session to connect to an iSCSI target. The iSCSI service is started on-demand by default after running iscsiadm. If root is not on an iSCSI device or no nodes have node.startup = automatic, the service will not start until iscsiadm triggers iscsid or kernel modules.
Run the systemctl start iscsid command as root to force the iscsid service to run and iSCSI kernel modules to load.
7.1. Creating an iSCSI initiator 링크 복사링크가 클립보드에 복사되었습니다!
Create an iSCSI initiator to connect to the iSCSI target to access the storage devices on the server. For more information, see the targetcli(8) and iscsiadm(8) man pages on your system.
Prerequisites
You have an iSCSI target’s hostname and IP address:
- If you are connecting to a storage target that the external software created, find the target’s hostname and IP address from the storage administrator.
- If you are creating an iSCSI target, see Creating an iSCSI target.
Procedure
Install
iscsi-initiator-utilson client machine:# dnf install iscsi-initiator-utilsStart the
iscsidservice:# systemctl start iscsidCheck the initiator name:
# cat /etc/iscsi/initiatorname.iscsi InitiatorName=iqn.2006-04.com.example:888If the ACL was given a custom name in Creating an iSCI ACL, update the initiator name to match the ACL:
Open the
/etc/iscsi/initiatorname.iscsifile and modify the initiator name:# vi /etc/iscsi/initiatorname.iscsi InitiatorName=custom-nameRestart the
iscsidservice:# systemctl restart iscsid
Discover the target and log in to the target with the displayed target IQN:
# iscsiadm -m discovery -t st -p 10.64.24.179 10.64.24.179:3260,1 iqn.2006-04.com.example:444 # iscsiadm -m node -T iqn.2006-04.com.example:444 -l Logging in to [iface: default, target: iqn.2006-04.com.example:444, portal: 10.64.24.179,3260] (multiple) Login to [iface: default, target: iqn.2006-04.com.example:444, portal: 10.64.24.179,3260] successful.Replace 10.64.24.179 with the target-ip-address.
You can use this procedure for any number of initiators connected to the same target if their respective initiator names are added to the ACL as described in the Creating an iSCSI ACL.
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 the
/var/log/messagesfile.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/fstabfile to mount the file system automatically when the system boots:# vi /etc/fstab /dev/disk_name /mount/point ext4 _netdev 0 0Replace disk_name with the iSCSI disk name and /mount/point with the mount point of the partition.