The age old question, whats the difference between LUN and a SHARE. And easy way to tell them apart is to see how you access them. Look at the screnshots below and make the connection. LUNS look like drive letters that are Local. Shares look like mapped network drives, or folders from a remote server.

What is a LUN?

 

Picture above: When windows connects to a LUN with a filesystem, it will look like a drive letter

Picture above: Newly connected Luns that dont have a filesystem (and no partition) will come up in the software above.

A LUN is an ambiguous term and sometimes it’s misused.

The correct term is that it’s a Logical Unit Number. It can be used to refer to an entire physical disk (or be part of many disks, as you will see in a moment), to being a subset of a larger physical disk or disk volume. So a LUN can be a whole RAID (or logical volume), or a LUN can be part of a RAID (or logical volume). Sometimes a LUN can be as simple as a file, on a filesystem. The filesystem itself can also be on a RAID, big LOGICAL VOLUME, Partition or drive, or any logical combination of that.

LUNs just provide a logical abstraction, and link if you will, between physical disk devices/volumes/raids/filesystem and the applications that use them.

With SANs, a LUN is usually a drive, or a couple drives.

With NASs, a LUN is usually a single file that pretends & acts like a big disk file (kind of like an ISO file). NASs are usually associated with Shares (see below.)

Sidenote: SANs are usually associated with LUNs, where as NASes are associated with Shares. In reality each can server both purposes. Such as NAS providing both Shares and LUNS.

One example of LUNs, is that LUNs are used with ISCSI. ISCSI makes far away LUNS appear as local drives on the server of choice, the main data connection between the ISCSI LUN and a server which is faking that the drive is local, is some network cables.

ISCSI has an initiators (client software) on a PC such as one running Windows or VMware, then those initiators connect to target groups on targets. Target groups holds LUNs. Each LUN that is connected to via the initiator will show up as a drive on Windows. So if a windows PC connects to a target, with the IP 10.1.1.7 (pretend that’s a SAN or a NAS that has ISCSI – and that this SAN or NAS has Linux as its operating system, this part is unrelated but now we know that the Windows is the initiator, and that the Linux SAN/NAS is the target), and this target has let’s say two groups, group1 and group2. Let’s assume the windows PC didn’t have the password authentication to connect to group2 (this shows that groups have different authentication means), but group1 was open for anyone to connect. So the windows PC connected to group1 which sits on the NAS/SAN with IP 10.1.1.7. Let’s assume this group1 has 3 LUNs.

– Lun1 was 1 TB big and was a 1 TB drive.

– Lun2 was 2 TB and was a file that spanned a RAID volume and sat on an EXT filesystem (imagine a 2TB file sitting on an EXT filesystem, and that EXT filesystem sitting on a RAID, and that RAID consists of let’s say 10 drives).

– Lun3 was a 10 TB big that was the entirety of another RAID (this raid consists of 20 drives)

Note: In reality Lun1, and Lun2 and Lun3 would all be of the same type, here I changed the type of storage underneath the LUN, to show that LUNs can be on anything. And technically this setup would be possible, but it’s so variable that no SAN or NAS manufacturer would ever do this, because it’s simply too complex. Everyone keeps it simple.

 Example: Different storage vendors or different products can use file LUNs, or disk/raid/volume LUNs. Obviously the less layers the faster something is. So the LUNs which are Disk/Raid or volumes are faster than File LUNs. Why? Because File LUN shave to sit on a filesystem which already sit on a Disk/Raid or volume. Notice that extra layer of having to have a filesystem, that’s why file LUNs are generally less performing.

The point of the story, is that the Windows PC only sees the LUNs from the groups it connected to. The LUNs appear / pretend to be like locally attached drives on the actual windows box. Lun1 would appear as say the G drive which would be a 1 TB drive. Lun2 would appear as H drive of size 2 TB. Lun3 would be a 10 TB drive letter like K.

Now to use the LUN, Windows would need to do to the LUN, what it does with drives to make them useable. Initialize them (with MBR or GPT – my advice always use GPT. MBR is for drives/LUNs less than 2TB, GPT is the newer standard that works for any size from 0 TB to Xillion TB), then partition them and install a filesystem like NTFS. The windows Computer Management tool, which has drive/disk management can do all that.

So a LUN, is something that pretends to be like a full drive. I think of a LUN as an ISO file that can sit on a filesystem, or be a raid, or group of volume drives (think LVM), or be a partition, or be a drive.

Also a LUN, doesn’t necessarily have to be ISCSI. You can think of your own local drives as being LUNs.

So a LUN is the actual logical abstraction/virtualization layer between the physical disk/device volume and the application, while the protocols that connect to it be it ISCSI, or FCoE (fiber channel over Ethernet), or FC (fiber channel), or simple SCSI or SATA

So the basic ascii Diagram of LUN looks like this

LUN<–>PROTOCOL<–>OS

LUNs is the disk/drive/volume/file

PROTOCOL is either ISCSI/SATA/SCSI/FC/FCoE etc..

OS is the system/application the LUN connects to and appears as a drive to.

 What is a Share?

 

Picture above: A remote share can be setup as a Mapped Network Drive on a Windows PC connecting to it (Mappened Network Drives are not the same as a normal drive – pictured above in the LUN section)

Picture above: A share can also be accessed from explorer by going to the IP of the device shareing (the SAMBA/CIFS server in this case). In this case going to \\10.9.8.30 in explorer. I see all of the shares that the NAS server 10.9.8.30 provides. Also I can access an idividual share by going to \\10.9.8.30\sharename such as \\10.9.8.30\Main

A share is simply a folder (which can hold many more folders and files), that was given access to be viewed on other computers by different protocols. There is different ways to have a folder become a shares, these are called protocols

So…

A LUN is like locally attached storage, but in reality it could be across the network.

A share is a folder. A folder is part of a LUN that already has a filesystem. A Share is simply a folder that was allowed to be accessed by 1 or few different share protocols

A share can be accessed via many different protocols: HTTP/WebDAV, SAMBA, AFP, NFS, RSYNC.

The most common is SAMBA (which is common with windows & all of the OSes) and AFP (which is mostly common to MAC/OSX). In my honest opinion everyone should switch from AFP to SAMBA, as it does the job better. NFS is the best for Linux systems.

Note: Samba is also commonly called CIFS or simply SMB.

A share is simply a folder across the internet/local net. Have you ever clicked on the Network Neighborhood and saw all of the available folder on different computers. Those are shares.

When you right click on a folder, and go to properties, and enable sharing. You have just made a folder, into a SAMBA/CIFS share. And other peoples, computers will have access to that folder (if you configuring “sharing” and “security” correctly on it)

BONUS TOPIC ON SHARES:

 Now sharing has 2 layers of security

  • The first layer is who you share to. I can choose to share to only the user Bob, or the computers in the IT department.
  • The second layer of security, is files access security. So I said my share is available to Bob, but which files & folders can he read/write/etc? That would be configured with the Security options.

The easiest way to configure shares, is to always all Sharing to everyone. Then Configure who has access to what with the security options. Removing many layers makes a system less complex. Less layers and less complexity means more understanding, and less time solving complex issues down the road, it also means more performance.

2 thoughts on “Luns vs Shares – My explanation on – What is the difference between Shares and Luns?

  1. LUN: transfers from/to LUNs are blocks, offsets…

    Shares: transfers from/to shares are files, directories, links…

Leave a Reply

Your email address will not be published. Required fields are marked *