What is LUN on Linux

ISCSI is the technique of sending SCSI data packets over TCP. This makes it possible to integrate remote hard disks and to create a SAN.

For this you need the target, which represents the server of the storage, and the initiator, this describes the system where the hard disk is then remotely mounted.

For this purpose an Ubuntu 16.04. used with HWE kernel. To avoid errors, I use absolute paths in the description.

install necessary packages

It is required, which simplifies the matter through its own command line interface. The package is available in the repositories.

Find the device

I have planned my own device for the test. is for the system and for the backend.

Therefore 2 × 32GB partitions via VirtIO:

Create backend

Now the command line interface can be opened with.

One already creates an overview:
I attach excerpts from this overview under each step.

The backend can consist of:

- Creates a file on a mounted file system. Unless otherwise stated /. A maximum size specification is required, but this is not reserved, so over-provisioning can be made.

- Block device / LVM logical volume

- "Linux pass-through SCSI devices" devices that do without SCSI emulation, which are displayed or listed under, such as SCSI / SAS hard drives.

- creates a RAMdisk, which can be used as a backend.

To do this, jump to the appropriate folder and carry out the appropriate options.

In my case it is.

now also shows the existing backend:

Create ISCSI target names

For this you have to jump under. The target name can be an IQN (iSCSI qualified name) or EUI (extended unique identifier). You can read more about it here.

If no specific naming scheme is necessary, a simple one is sufficient. A name will now be generated.
In my case it was.

bind to IP

The target must still be given the IP address via which it can be addressed.

Since I only have one network interface on the machines, I don't see any advantage in routing the ISCSI over a different IP subnet. Therefore I put the target on the IP of the system.

To do this, you now have to go to the appropriate directory for the. The IP address must be started up on the system, as only a corresponding port is opened here.

Create a LUN

The LUN corresponds to the logical unit number, which is the same as a physical hard disk space. Each SCSI device is identified by a logical number. It is a unique identifier for a single or a group of hard disks.
Several LUNs can be set for one target.

To create it, you have to jump back to the corresponding directory and create the LUN. The number is assigned consecutively.

Access protection

So that not everyone can access the storage, you have to specify which ISCSI initiator is allowed.

Now switch back to the corresponding path. The SCSI initiator name must now be stored here with.

In my structure I have given the initiator, almost the same name. Just changed the hostname from to.

Mapping is also carried out here.

In addition, a user with a password can be created. To do this, go to the folder of the initiator name and followed by.

These are pure users for the ISCSI, this user is not created for the operating system.

Save configuration

If you exit normally via Ctrl + D or you will be asked whether the configuration should be saved. Y is the default and can be selected directly with Enter.

Can also be used to secure intermediate steps.

In order for the settings to be reboot-proof, you must change to the root directory before saving. If you are in a subfolder, not all settings are saved permanently!

author Paddle
Categories File systems, Linux