1.12. Logging In to an iSCSI Target
As mentioned in Section 1.2, “iSCSI”, the iSCSI service must be running in order to discover or log into targets. To start the iSCSI service, run:
service iscsi start
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 1.2.1, “iSCSI API” and Section 1.11, “Scanning iSCSI Interconnects”.