Linux – Log in to a single LUN of a target with iscsiadm (open-iscsi)

iscsilinuxopen-iscsiscsi

Is it possible to connect to only a single LUN of an iscsi target when using iscsiadm? I have a target like "iqn.0000-00.iscsi.foo:bar" this target has 1000 LUN's. If I do iscsiadm -m node -l -T iqn.0000-00.iscsi.foo:bar then it connects to all the LUN's and my initiator gets 1000 new devices added. I don't want 1000 devices added.

What I want is something like (note iscsiadm doesn't actually have a "–lun" option):

 iscsiadm -m node -l -T iqn.0000-00.iscsi.foo:bar --lun=42

That way only one device is added on the initiator. In pretty much anything other than iscsiadm (eg. iPXE) you can specify the target like:

iscsi:<srv>:::<LUN>:<targetname> ...

Which allows you to connect to a specific LUN. iscsiadm doesn't seem to support this syntax.

Best Answer

Normally, you'd mask the LUNs on the storage so that only the iqns of the server the LUN is for can access those LUNs. This would mean that when you ask the storage port what LUNs it has for you, it's a short list of just what you actually want to use.

That said, if you don't want to log into everything, you should be able to use iscsiadm --mode node -l manual and configure all the discovered LUNs that you want to log into with node.startup=manual.

Disclaimer: I've never actually done this. The few times I've used iSCSI, I've used LUN masking to ensure that I want to log into everything.

Related Topic