Click to See Complete Forum and Search --> : iSCSI and LUN


neuron
05-08-2008, 02:43 PM
Hello,

im not sure this is the right section for the question, but ill post it anyway :)

I'm playing with iscsi and im trying to understand the idea behind LUN, or what LUN is, so basically its not clear for me why LUNs are used, on the iscsi initiator side, i see X discs added to /dev which is equal to the total number of LUNs i have, regardless of the number of targets ... so whats the catch ? ive been expecting to have /dev/sdx1,/dev/sdx2 ..etc when i have multiple LUNs on one iscsi target, so is there any advantage for using multiple luns on a single target ? and anyway, although ive been googling for an explenation of what LUN is actually is, im unable to really understand what it is, except that its a logical representation for a section of the physical device ... isnt that just as saying "a partion" ?

happybunny
05-08-2008, 03:23 PM
In my experiance with fiber SAN's, to the host, a LUN=a single disk.

However, behind the scenes, the SAN that is housing the actual storage may have spread that LUN across many drives, depending on its intended use.

So to the host, you will get a single /dev/sdX for each LUN, which you then manage as if it were local storage (ie, fdisk, mke2fs, mount, etc).

Does this help?

bwkaz
05-08-2008, 07:00 PM
LUN == Logical Unit Number. (Whether that helps or not is a different issue. I suspect it probably doesn't.) :)

The USB storage driver (which uses SCSI commands to talk to the actual device) uses LUNs to represent the different slots in a USB multi-slot reader, for instance. Each slot acts like a different disk, but they're all a single USB device -- so the USB device turns into a SCSI host/channel/id, and each slot is a separate LUN. (SCSI addresses are made of four components: host, channel, id, and lun. Usually there's only one LUN per host/channel/id, but the standard allows multiples.)

As for actual SCSI disk devices, the iSCSI initiator does correctly create a separate disk device per LUN (that's the way it's supposed to work). As for the difference between LUNs and partitions: they might be used to represent the same thing, or they might not be. I'll assume a single iSCSI target with a ton of disks in a huge RAID array (RAID level doesn't really matter). The actual physical partitions on the RAID array device (if there are any) might be exposed as LUNs, in which case they will show up as separate disks to the iSCSI initiator, and will need a second partition table. Or, the whole RAID array might be exposed as a single LUN, and then the partitions that exist on it will show up as partitions to the iSCSI initiator. Or, the administrator may define iSCSI-target-enforced boundaries between LUNs (with multiple LUNs being seen by the initiator), with no partition structure on the disk itself (except what the iSCSI initiator puts there).

Basically, each LUN turns into a separate disk on the initiator side. Those disks can then be partitioned in any manner. :)

neuron
05-09-2008, 01:00 PM
thank you happybunny, bwkaz, this helped me understand pretty much what LUN actually means and how it is treated, but im just wondering now (probably because i followed a how-to that uses single lun for each target) what diffrence can it be if i have 4 targets each with one lun or one target with 4 luns, apparently, from /dev pov, its the same ill have 4 devices sd[a-d] for example, but other wise, what diffrence does it make, does the iscsi perform better when accessing muliple luns on same target for example ? would it be easier to this or that when dont this way or that!

bwkaz
05-09-2008, 07:12 PM
what diffrence can it be if i have 4 targets each with one lun or one target with 4 luns You will have four disk devices in either case.

The difference will be that in the four-LUN case, if just one process crashes (that process being the iSCSI target daemon), you will lose access to all four disks. If you have four different targets with a single LUN each, then if a single one of those four targets crashes, you will only lose access to one disk.

apparently, from /dev pov, its the same ill have 4 devices sd[a-d] for example Yes: in either case you will have four independent disk devices. If the first one is sda, then the fourth will be sdd. (They could also be sdc-sdf, or sdh-sdk, or whatever. Actually, it's remotely possible that they won't even be in order, but I think that most of the time they probably will.)

does the iscsi perform better when accessing muliple luns on same target for example ? I strongly doubt it. I suspect that there will be no noticeable performance difference no matter how you configure it, but if there is any difference at all, I suspect the multiple-target case will be slightly faster. (This is simply because each target is its own process on the other end, and those processes can operate in parallel if you have more than one virtual or physical CPU.)

I strongly suspect that it doesn't really matter, though: I'm guessing that however you have it set up will be fine. :)

neuron
05-10-2008, 06:43 AM
Thank you very much, This was very informative and extremely helpful :)