The Logical Unit Number, or LUN, is an important element in storage devices. But what exactly is it?

LUN, or Logical Unit Number, is an important concept in storage devices. You might hear people talking about it from time to time or come across information about it online. It's a number used in the SCSI (Small Computer System Interface) protocol to identify a logical unit within a storage device.

LUNs Array

But what exactly is it? How does it work? And what types of Logical Unit Numbers are there? In this article, we'll delve into these questions and more. So, let's dive right in.

What is a logical unit number (LUN)?

The Logical Unit Number (LUN) identifies where data should be written on a storage device. Thus, the SCSI protocol requires a series of numbers to identify each LUN. This is why, when using storage, a Storage Area Network (SAN) protocol encapsulates SCSI.

So they would use a number to refer to which logical unit was in use, and SCSI refers to these with numbers, hence the term LUN, or Logical Unit Number. These numbered devices could be anything, including old tape drives.

Or anything that writes data to a physical disk. So, it's a number that refers to a logical disk on a storage area network (SAN). Sometimes the logical disk itself is called a LUN, though most experts would say that's technically incorrect.

A storage device is composed of multiple units, each addressable by an assigned serial number, which we call a logical unit number (LUN).

How does a Logical Unit Number (LUN) work?

For some, understanding how a LUN works on a storage device might be a bit complicated. However, hard disk drives use multiple physical disks to write data. Yet, each unit (physical disk/memory chip) is assigned a serial number.

This serial number is something that SCSI assigns on the fly as needed. So, when a user formats a RAID array or creates partitions, it stores them on separate volumes. Then, to differentiate each volume, SCSI configures a Logical Unit and numbers it.

So when your PC does something simple, like opening a file on a hard drive, it talks to that LUN using the SCSI protocol, and so when a system administrator initiates one of these operations, the computer sends a command descriptor block, or CDB, to the physical storage device.

Then a three-bit logical block address identifies a logical unit within that target, so that the device can start operating on that number and continue writing to that particular storage area.

When that area is full or otherwise used up, the SCSI controller sends the CDB to another physical storage unit, and that LUN becomes the primary one temporarily, until it too is filled.

Logical Unit Number (LUN) Type

Though it might sound like a single type, LUN (Logical Unit Number) actually comes in several varieties. Each type is tailored for specific operations on storage devices. Hence, the numerical type changes depending on the kind of logical unit needed. Here are the four main types:

Mirrored LUN

A mirrored LUN is a fault-tolerant LUN that has two copies of data on different physical disks. This allows for better control over redundancy and backup. It is also the kind of setup used by programs that detect duplicate or redundant files.

A串联LUN (Linked LUN) in American English would be called a "Linked Logical Unit Number" or just a "Linked LUN."

A concatenated LUN's primary task is to combine multiple logical unit numbers into a single entity or volume. It is the type of LUN most commonly used in a RAID group, especially when two LUNs are prohibited from being placed together.

Striped LUN (-striped LUN)

A striped LUN writes data across multiple physical drives using a single logical unit number. This allows for better performance and increased resilience of the individual physical drives because it distributes input/output across the disks.

Striped LUN with parity

A striped LUN with parity is similar to a striped LUN, but with the added feature that parity information is distributed across the physical disks (usually three or more). This ensures that if one disk fails or becomes unavailable, the data on that disk can be reconstructed from the information on the remaining disks.

Logical Unit Number (LUN) Use Cases

A LUN (Logical Unit Number) serves primarily to identify a storage device. While this can vary somewhat depending on the type of LUN in question, the principle is the same. For example, if you create a partition on a drive, you would use a simple LUN to identify that portion of the physical drive.

In addition, LUNs are used to partition and mask a SAN, so that multiple physical LUNs can be mapped by virtualizing each physical sector. As mentioned, the term is used to identify a number, but it can also be used to distinguish the logical unit itself.

Conclusions

These are some key points to know about LUNs, which are essential identifiers for physical drives and a critical component of regular computing operations. As such, understanding LUNs is crucial for grasping storage processes.