1

OK, here im talking about centos7 system related iscsi initiator.

When we setup correct iscsi configurations on the files of; /etc/iscsi/initiatorname.iscsia, /etc/iscsi/iscsid.conf we still required to do

iscsiadm --mode discovery --type sendtargets --portal 192.168.1.81 and

iscsiadm --mode node --targetname iqn.2014-08.com.example:t1 --portal 192.168.1.81 --login

Otherwise, even with # systemctl enable iscsi, system wont load scsi targets'.

My question is what actually this iscsiadm tool does.

  • Does it make any configuration change behind the scene because it only has to run just once.
2

There are three parts to the open-iscsi subsystem: the iscsiadm command, the iscsid daemon, and the kernel.

The user-space parts (i.e. iscsiadm and iscsid) keep two databases, of sorts. I say of sorts because the "database" is files and directories, not a real DB.

There is a discovery DB, and there is a target DB.

When you run iscsiadm -m discovery -t st -P IPADDR, you populate the discovery DB, which keeps track of the settings for this target, and you populate the node DB with records from the target(s) discovered.

After this step, you can run iscsiadm -m node to see the nodes discovered.

When you run iscsiadm -m node -t TGT_NAME -P IPADDR -l, you tell iscsiadm/iscsid that you want to find the node that has target name TGT_NAME and portal IP address of IPADDR, and login to it.

You can do both steps, by the way, by running something like:

iscsiadm -m discovery -t st -p IPADDR -l

Or, after discovery, you could run:

iscsiadm -m node -l

to login to all nodes.

I don't have CentOS 7, but I suspect there are at least two iscsi services. If you run systemctl list-unit-files | fgrep iscsi, you may see more than "iscsi.service".

On openSUSE, there are three unit files: iscsid.socket, iscsid.service, and iscsi.service.

The iscsid.socket and iscsid.service files go together to make iscsid socket-activated. The iscsid.service is basically the iscsid daemon.

The iscsi.service file is layered on top of iscsid.service. This service just logs into targets that are marked with a flag that says you want to login at startup time.

Here's a link to how to set up your targets for automatic boot, but this is a SUSE document, so YMMV.

There is also an open-iscsi mailing list you can join: open-iscsi@googlegroups.com

| improve this answer | |
  • As you say executing iscsiadm -m discovery -t st -P IPADDR populates some needed databases for the sack of accessing targets. But, why then we have to configure target informations on /etc/iscsi/initiatorname.iscsi, /etc/iscsi/iscsid.conf in the first place? – krs4keshara May 27 '16 at 1:52
  • Actually no. It's more complicated than that. The "node" database, while useful, is not required. The /etc/iscsi/iscsid.conf contains defaults, so when you populate the "node" database, you create configuration files that get some of their values from iscsid.conf. And the initiatorname.iscsi file sets the name of this computer when talking to others. Each initiator and must have a unique name, usually alone the lines of "iqn.*.*". (I can site a standard for the name, if you wish.) – Lee-Man May 28 '16 at 23:11
  • Well, first thanks for your company for getting correct this iscsi understanding. But, now i need some time to setup a lab to see what your mentions are correct. Will let you know. – krs4keshara May 29 '16 at 16:27
0

When run iscsiadm with --login a config file will be created under /var/lib/iscsi/nodes/. This file holds the specific scsi target related information, which, i think, iscsid daemon uses to access the target.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.