How many number of luns can be shared by a ISCSI target to a initiator?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux
  • Iscsi

Issue

  • What is the maximum number of block devices or partitions I can serve as iSCSI targets in a single OS?
  • How many LUNS can be mapped to a single target?
  • How many LUNS can be mapped to one initiator?

Resolution

  • All the RHEL version < 7.5 has the limit 256(0-255). In later versions of RHEL(ie: > 7.5) the luns per target limitation is 65535, or the system runs out of allocatable memory (whichever comes first).
  • There is no limit on creating a number of backstores.
  • There is a limit of 256 LUNS per Initiator as required by the ISCSI protocol specification. This is irrespective of the RHEL version.

Root Cause

  • LUNs per initiator is hard-coded as required by the ISCSI protocol which exists no matter how you present or carves up the backing stores.

Diagnostic Steps

  • Verify on target server by using targetcli ls command and look for below-highlighted numbers-
o- iscsi ............................................................................ [Targets: 2]
  | o- iqn.2003-01.org.linux-iscsi.server.x8664:sn.699f8cd480bc ....... [TPGs: 1]  <<< 1 Target
  | | o- tpg1 ................................................................... [no-gen-acls, no-auth]
  | |   o- acls ............................................................................ [ACLs: 1]
  | |   | o- iqn.1994-05.com.redhat:2012b45c62c5 .... [Mapped LUNs: 255]  <<< 255 mapped luns per initiator
  | |   o- luns ................................................. [LUNs: 261]  <<<<< LUN per target is under 65K limit
  • To verify on the client side, use /proc/scsi/scsi command:
Host: scsi12 Channel: 00 Id: 00 Lun: 02
  Vendor: LIO-ORG  Model: file2            Rev: 4.0 
  Type:   Direct-Access                    ANSI  SCSI revision: 05

#cat /proc/scsi/scsi | grep -i "Vendor: LIO-ORG"| wc -l
255

  • Trying to map a LUN that is greater than 255 will get errors like Cannot map new lun 255 into ACL iqn.
/iscsi/iqn.20...0bc/tpg1/luns> create /backstores/fileio/file255
Created LUN 255.
Cannot map new lun 255 into ACL iqn.1994-05.com.redhat:2012b45c62c5
/iscsi/iqn.20...0bc/tpg1/luns> create /backstores/fileio/file256 
Created LUN 256.
Cannot map new lun 256 into ACL iqn.1994-05.com.redhat:2012b45c62c5

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.