Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

25.16. Logging in to an iSCSI Target

As mentioned in Section 25.7, “iSCSI”, the iSCSI service must be running in order to discover or log into targets. To start the iSCSI service, run:
# systemctl start iscsi
When this command is executed, the iSCSI init scripts will automatically log into targets where the node.startup setting is configured as automatic. This is the default value of node.startup for all targets.
To prevent automatic login to a target, set node.startup to manual. To do this, run the following command:
# iscsiadm -m node --targetname proper_target_name -p target_IP:port -o update -n node.startup -v manual
Deleting the entire record will also prevent automatic login. To do this, run:
# iscsiadm -m node --targetname proper_target_name -p target_IP:port -o delete
To automatically mount a file system from an iSCSI device on the network, add a partition entry for the mount in /etc/fstab with the _netdev option. For example, to automatically mount the iSCSI device sdb to /mount/iscsi during startup, add the following line to /etc/fstab:
/dev/sdb /mnt/iscsi ext3 _netdev 0 0
To manually log in to an iSCSI target, use the following command:
# iscsiadm -m node --targetname proper_target_name -p target_IP:port -l

Note

The proper_target_name and target_IP:port refer to the full name and IP address/port combination of a target. For more information, refer to Section 25.7.1, “iSCSI API” and Section 25.15, “Scanning iSCSI Interconnects”.