Discovery is the process that makes the targets known to an initiator. It defines the method by which the iSCSI targets are found. The following discovery methods are available:
- SendTargets: This is a native iSCSI protocol that allows an iSCSI server to send a list of available targets to the initiator.
- Service Location Protocol (SLP): Servers use the SLP to announce available targets. The initiator can implement SLP queries to get information about these targets.
- Internet Storage Name Service (iSNS): Targets are discovered by interacting with one or more iSNS servers. iSNS servers record information about available targets. Initiators pass the address and an optional port of the iSNS server to discover targets.
- Static: The static target address is specified.
The following example uses the SendTargets discovery method to discover targets on IP address 192.0.2.1. This command also starts the iscsid daemon if needed.
# iscsiadm -m discovery –type sendtargets –p 192.0.2.102
After discovery, the nodes table and the send_targets tables in the database are updated:
# ls /var/lib/iscsi/nodes
# ls /var/lib/iscsi/send_targets
You can view the database files and directories directly, or you can query the database with the iscsiadm -m discoverydb option.
The following example queries the send_targets table for entries from 192.0.2.102:
# iscsiadm -m discoverydb –t st –p 192.168.1.102
# BEGIN RECORD 22.214.171.1244-7
discovery.startup = manual
discovery.type = sendtargets
discovery.sendtargets.address = 192.168.1.102
discovery.sendtargets.port = 3260
discovery.sendtargets.auth.authmethod = None
discovery.sendtargets.auth.username = <empty>
discovery.sendtargets.auth.password = <empty>
discovery.sendtargets.auth.username_in = <empty>
discovery.sendtargets.auth.password_in = <empty>
discovery.sendtargets.timeo.login_timeout = 15
discovery.sendtargets.use_discoveryd = No
discovery.sendtargets.discoveryd_poll_inval = 30
discovery.sendtargets.reopen_max = 5
discovery.sendtargets.timeo.auth_timeout = 45
discovery.sendtargets.timeo.active_timeout = 30
discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768
# END RECORD
You can also use the –discover option to add (-o new), update (-o update), and delete (-o delete) records from the database. The following example adds new records in the database. If the discovery mechanism discovers records that are not in the database, they are created by using the /etc/iscsi/iscsid.conf discovery settings.
# iscsiadm -m discoverydb –t st –p 192.168.1.102 –o new –discover
The following example updates existing records in the database. If records are returned during discovery that currently exist in the database, they are updated with information from /etc/iscsi/iscsid.conf. No new records are added and stale records are not removed.
# iscsiadm -m discoverydb –t st –p 192.168.1.102 –o update –discover
The following example deletes records from the database. If a record exists in the database, but is not returned during discovery, the record is removed from the database.
# iscsiadm -m discoverydb –t st –p 192.168.1.102 –o delete –discover