Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the concept of lun in linux

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "what is the concept of lun in linux". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

In linux, lun means logical unit number, a method introduced to use and describe more devices and objects; lun can represent a physical disk, usually in a storage area network or network-attached storage environment, a virtual principal derived from one or more physical disks.

The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What does lun mean in linux

I. the concept of LUN

The full name of LUN is Logical Unit Number, that is, the logical unit number. We know that the number of devices that can be attached to the SCSI bus is limited, usually 6 or 15. We can use Target ID (also known as SCSI ID) to describe these devices. As soon as the device is added to the system, there is a code name. When we distinguish the device, we just say the number and number of the ok.

In fact, the objects we need to describe are far more than that number, so we introduce the concept of LUN, that is, the role of LUN ID is to extend Target ID. There can be multiple LUN Device under each Target, and we usually call LUN Device LUN for short, so it can be said that the description of each device has changed from Target x to Target x LUN y, so it is obvious that our ability to describe the device has been enhanced.

Just as we have a physical hard disk in our computer, we have to partition it into logical disks: such as C disk, D disk and E disk.

So we can sum up that LUN is just a method we introduced to use and describe more devices and objects, and there's nothing special about it.

LUN ID is not equal to a device, just a number, does not represent any physical attributes, in our actual environment, we encounter LUN may be disk space, may be tape drive, or media changer and so on.

What on earth is LUN?

The mystery of LUN (as opposed to some newbies) is that most of the time it is not a visible entity, but a virtual object. For example, an array cabinet, the host side is regarded as a Target Device, then for some special needs, we have to divide the disk space of the disk array cabinet into several small units for the host to use, so there are some logical drives, that is, lower-level logical objects than Target Device. We are used to calling these smaller disk resources LUN0, LUN1, LUN2... What. Due to the mechanism of the operating system, the minimum storage object level recognized by the operating system is LUN Device, which is a logical object, so it is often called Logical Device.

Some people say, I only recognize a disk in my Windows. I don't see any words about LUN. Is it LUN=Physical Disk? The answer is no, as long as you notice that there is a value of LUN in the properties of the disk, just because your Disk is not divided into multiple storage resource objects, but the entire disk is used as a LUN, and LUN ID defaults to zero, that's all.

We have encountered such a problem, for example, someone asked, we have a disk array, connected to two hosts, we divided a LUN for the two hosts to recognize, and then we thought, first, after the operating system divides the disk into two partitions, let the two hosts use two partitions, and then after one host goes down, use cluster software to switch the partition to another host. Is this feasible? The answer is also no, the cluster software operates on disk units that are LUN, not partitions, so this operation is not feasible. Of course, in some environments, which are generally less demanding, different disk partitions can be mounted on multiple hosts, but in this case, disk switching is not actually involved. therefore, in some demanding environments, this situation is not allowed at all.

It is also important to note that in the concept of some manufacturers and some products, LUN ID is bound to a specific Device, such as some belt libraries of IBM, the whole band library has only one Target ID, and then changer,tape drive is assigned to LUN0, LUN1, LUN2. However, we should note that this is only a special design of the product, and it is also a rare case.

Third, what is the difference between LUN and storage volumes?

It is common for people to talk about the difference between storage volumes and LUN, and then argue. From the above, we can know what LUN is. LUN is the abbreviation of Logical unit number, that is, logical unit number. It is actually defined in SCSI-3, not only for storage, but also for all peripherals that use SCSI protocol, such as tape drives, SCSI printers and so on. We know from SCSI-3 's SAM model that the protocol layer of SCSI-3 (or later version) stipulates that for a 16-bit wide SCSI bus, the addressing range is only 16, that is, only 16 peripherals can be mounted, each device is called a target. In order to improve the addressing ability of the bus, another layer is introduced, which stipulates that multiple devices can be virtual (or actually connected) on each target, for example, a tape drive and a printer may be connected on a target, and they share a target address, but in order to distinguish them, they use LUN to distinguish them, the tape drive is assumed to be LUN0, and the printer is assumed to be LUN2, thus solving the addressing problem of multiple devices.

This is an example of a real device connection, and a storage array (such as the HP leftHand P4000 SAN) is the best example of a virtual device. A storage disk array is seen as a Target in the SCSI bus, which occupies a Target address of SCSI, but the storage space of the storage array is too large, so we need to divide it into different parts for different applications to achieve the purpose of centralized storage and centralized management. So in each storage part (or area) we use Lun to distinguish, for example, LUN1 represents the address block 0-1023 and Lun2 represents the address block 1024-65535, and so on. As can be seen from the above, when the computer uses the SCSI standard (note that the term "standard" I use here represents the four layers of the unified SAM model, but does not use the words such as interface, protocol or command, etc.) when connecting to plug-in storage, it uses a bus (BUS)-target (Target)-LUN ternary addressing scheme. Bus refers to how many SCSI buses and SCSI cards are on your computer? The target refers to what is the destination address of the device, commonly known as the SCSI address, on the bus? LUN refers to the logical address and logical unit number assigned by the device on a Target. This addressing scheme and the connection mode of the device are similar to the physical star connection and the logical bus connection.

So what is a storage volume? This starts with the stored volume manager. The storage volume manager is an object in the operating system, which is mainly responsible for the online management of storage block devices. When one of our storage LUN is connected to the computer, the computer finds that the device exists and needs to register with the volume manager. The volume manager provides a virtual interface to register the storage volume, obtains the basic information of the storage LUN, such as space size, ternary address, block size, start and stop address, health, etc., and then creates an abstraction of the corresponding data structure for it, so that the computer can use the volume manager. It can dynamically capture the real-time information of the registered storage LUN and realize dynamic management. After a storage LUN is registered and abstracted by the volume manager, it is regarded as a direct subordinate by the volume manager. It can be divided into smaller areas again, of course, it can also be undivided, and then the segmented or unsegmented storage space is abstracted to establish the relevant data structure for the file system layer to call. Therefore, storage LUN and volume may be the same thing physically, but look at it from different angles and different levels to understand it. Of course, for computers, it is also necessary to find out the needs of these different data processing processes.

This is the end of the content of "what is the concept of lun in linux". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report