A logical unit number (LUN) is a unique identifier for designating an individual or collection of physical or virtual storage devices that execute input/output (I/O) commands with a host computer, as defined by the Small System Computer Interface (SCSI) standard.
SCSI is a widely implemented I/O interconnect that commonly facilitates data exchange between servers and storage devices through transport protocols such as Internet SCSI (iSCSI) and Fibre Channel (FC). A SCSI initiator in the host originates the I/O command sequence that is transmitted to a SCSI target endpoint or recipient storage device. A logical unit is an entity within the SCSI target that responds to the SCSI I/O command.
How LUNs work
LUN setup varies by system. A logical unit number is assigned when a host scans a SCSI device and discovers a logical unit. The LUN identifies the specific logical unit to the SCSI initiator when combined with information such as the target port identifier. Although the term LUN is only the identifying number of the logical unit, the industry commonly uses LUN as shorthand to refer to the logical unit itself.
The logical unit may be a part of a storage drive, an entire storage drive, or all of parts of several storage drives such as hard disks, solid-state drives or tapes, in one or more storage systems. A LUN can reference an entire RAID set, a single drive or partition, or multiple storage drives or partitions. In any case, the logical unit is treated as if it is a single device and is identified by the logical unit number. The capacity limit of a LUN varies by system.
A LUN is central to the management of a block storage array in a storage-area network (SAN). Using a LUN can simplify the management of storage resources because access and control privileges can be assigned through the logical identifiers.
LUN zoning and masking
LUN zoning provides isolated paths for I/O to flow through a FC SAN fabric between end ports to ensure deterministic behavior. A host is restricted to the zone to which it is assigned. LUN zoning is generally set up at the switch layer. It can help to improve security and eliminate hot spots in the network.
LUN masking restricts host access to designated SCSI targets and their LUNs. LUN masking is typically done at the storage controller, but it can also be enforced at the host bus adapter (HBA) or switch layer. With LUN masking, several hosts and many zones can use the same port on a storage device, but they can see only the specific SCSI targets and LUNs they have been assigned.
LUNS and virtualization
A LUN constitutes a form of virtualization in the sense that it abstracts the hardware devices behind it with a standard SCSI method of identification and communication. The storage object represented by the LUN can be provisioned, compressed and/or deduplicated as long as the representation to the host does not change. A LUN can be migrated within and between storage devices, as well as copied, replicated, snapshotted and tiered.
A virtual LUN can be created to map to multiple physical LUNs or a virtualized capacity created in excess of the actual physical space available. Virtual LUNs created in excess of the available physical capacity help to optimize storage use, because the physical storage is not allocated until the data is written. Such a virtual LUN is sometimes referred to as a thin LUN.
A virtual LUN can be set up at the server operating system (OS), hypervisor or storage controller. Because the virtual machine (VM) does not see the physical LUN on the storage system, there is no need for LUN zoning.
Software applications can present LUNs to VMs running on guest OSes. Proprietary technology such as VMware’s Virtual Volumes can provide the virtualization layer and the storage devices to support them with fine-grain control of storage resources and services.
Types of LUNs
The underlying storage structure and logical unit type may play a role in performance and reliability. Examples include:
- Mirrored LUN: Fault-tolerant LUN with identical copies on two physical drives for data redundancy.
- Concatenated LUN: Consolidates several LUNs into a single logical unit or volume.
- Striped LUN: Writes data across multiple physical drives, potentially enhancing performance by distributing I/O requests across the drives.
- Striped LUN with parity: Spreads data and parity information across three or more physical drives. If a physical drive fails, the data can be reconstructed from the data and parity information on the remaining drives. The parity calculation may have an impact on write performance.