[stgt] Why LUN0?

Boaz Harrosh bharrosh at panasas.com
Thu Nov 29 12:48:08 CET 2012

On 11/29/2012 03:53 AM, Braun, David wrote:
> I'm trying to understand the need for LUN0. Is this required by the
> iSCSI standard (RFC-3720) or is it an artifact of the implementation? As
> a test I modified a copy of tgtd and tgtadm to allow the "-force"
> argument to the logicalunit delete function and it seems to work. BUT I
> must confess I'm ignorant of what the ramifications could be. Could
> someone explain the need for LUN0 or why I shouldn't be too surprised
> when this hack blows up in my face?

I have a patch which I carry in my tree for ages which removes the
LUN0 ghost and everything works just fine. It was written by
dear Arne Redlich <arne.redlich at googlemail.com>

The only reason you theoretically need that ghost-do-nothing LUN0
is for the time between you load up tgtd and add a target to the
time you then add the first LUN. Because the SCSI mandates that
you have at least LUN0 at all times. And in that time window you
do not have any.

But for my setup it is a no-op because actual connections can only
come in much later in the device bring up and by then I have a real
LUN0 for them.

(The real way to solve this is by not opening up any sockets until
 the first LUN is set, not like today at the target bring-up)

The patch is here:

It is part of the osd-target tree I have here:

Don't forget when you bring up the LUNs to do:
tgtadm --lld iscsi --mode logicalunit \
	--op new --tid $2 --lun 0 ...
                               ^^^---------------- zero here not 1 like before

I don't think you will be able to use the /etc config you will
need to use tgtadm directly. (I think)

> Thanks
> Dave

To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

More information about the stgt mailing list