A reader recently asked: What is a LUN, and why do we have to create one rather than use the disk as it is? A logical...
unit number is a unique identifier that enables separate devices in a storage subsystem to be addressed by Fibre Channel, iSCSI or SCSI network protocols. LUNs also enable a host to distinguish among the different physical devices in a SAN. Block storage capacity is presented, either in whole or in portions, as individual volumes or mount points.
Although its origin is disk storage, LUN management may also be required on all-flash and hybrid arrays. In some cases, this can be avoided if the SSD translation layer uses a log-structured file system, enabling the ingest of data of varying block sizes. Otherwise, LUNs are needed to ensure an all-flash block array does not overload the CPU with misaligned writes. This also helps to reduce flash endurance and stranded capacity.
What is a LUN?
A LUN can refer to an entire physical disk or a subset of a larger physical disk or disk volume. The physical disk or disk volume could be:
- an entire single disk drive;
- a partition (subset) of a single disk drive; or
- a disk volume from a RAID controller comprising multiple disk drives aggregated together for larger capacity and redundancy.
LUNs provide a logical reference point for managing block storage arrays shared over a SAN. A LUN represents a logical abstraction, much like a virtualization layer between the physical disk device or volume and the applications. The term virtualization has been used to mean many things; thus, the virtualization police may or may not agree to a LUN being a layer of virtualization.
In addition, a LUN can be used to present a larger or smaller view of the disk storage to the server. For example, if you partition a disk drive into smaller pieces for your application or system needs, the subsegments would share a common SCSI target ID address with each partition being a unique LUN.
Another example of a LUN is a RAID controller in which multiple disk drives are mirrored (RAID 1) or striped with parity (RAID 5) to create a larger physical disk volume. A LUN would be used to represent the virtual disk devices made up of the disks in the RAID group. So, you may not need to create a LUN to use a disk device. For example, if you are simply attaching several JBOD disks to a server via SCSI, USB drive, Fibre Channel (FC) or whatever interface you prefer, LUNs may not have to be created. If you are using a SCSI disk and you have not subdivided it into partitions, the device would show up with a unique SCSI ID target and default to LUN 0. Note that you will want to ensure that devices are properly addressed to avoid conflicts.
To determine if you need a LUN, evaluate the type of storage you have, how it is configured and how you will use it. Most likely, unless you are using a JBOD or a single disk device, you will use LUNs as an abstraction layer to access your storage.
How LUNs work
A LUN is an artifact that predates the rise of flash storage. When disk drives formed the heart of the data center, what was needed was a way to carve physical disk capacity into logical slices of capacity, such that the OS could read and write files. In addition, storage administrators needed to partition all the disk capacity on a SAN to enable attached server hosts to access the storage.
LUNs use SCSI commands on block-level shared storage systems. By contrast, NAS is based on either NFS or SMB protocols. File servers mirror traditional client-server computing, with a single head node acting as the IP address for a NAS cluster. NFS-based storage is considered a more lightweight method for multiple filers to access shared data stores.
Storage administrators rely on LUNs to manage discrete volumes that are shared by users of a SAN. This is where the virtualization analogy comes into play. Much like server virtualization enabled partitions to be created on one box, LUNs carve up the disk capacity to build blocks of data on a physical disk drive, although sometimes on a virtual disk drive or virtual machine (VM). A virtualized server allocates each partition to specific compute tasks. LUNs provide the same versatility for storage, enabling one disk to be apportioned to support multiple OSes or application workloads.
Howard Marks, chief scientist at DeepStorage.net, explains why working on a per-VM basis is far more productive than taking a snapshot of a LUN, which may contain just one useful VM in a large pool of data.
The LUN is designed to simplify storage, although it is hardly an uncomplicated matter. A LUN enables an administrator to assign access controls on a varying basis to different storage use cases. Rather than separate permissions for a disk and a storage array, a LUN enables users to consistently set up the different permissions to interoperate with any underlying storage.
One thing to be aware of when assigning LUNs is that most OSes limit the maximum LUN size to 16 TB. This is essential to note if you expect to resize your LUNs at some point to exceed the capacity limit. Most systems include a LUN resize command that automates the process, provided you don't exceed the capacity limit.
To set up a LUN with FC, the individual server that accesses the LUN must be specified, along with the host bus adapter port it will use. Using iSCSI requires an extra step since iSCSI does not directly connect to a LUN. Instead, an iSCSI target identifies the IP addresses that are authorized to access the specified logical disk volume.
LUN zoning and LUN masking
Now that we've answered the question, "What is a LUN, and how does it work?" the next step is to discuss security features that will ensure users and servers see only those storage resources they are allowed to access.
LUN zoning isolates a single server to a specific logical unit or associates a group of servers with a logical unit. LUN zoning also enables a storage administrator to allocate bandwidth by assigning particular ports to a zone.
Once LUN zoning is completed, the LUN masking process subdivides port access so that only the LUNs authorized to access a specific server can access the corresponding port.
LUN storage configuration and virtualization guide
How many storage LUNs does a server need?
Configuring a LUN for better virtual machine performance