当前位置: 首页 > Linux > 正文

iSCSI target(Server) setup/config on Linux(RHEL,CentOS,SL etc..)

Intr

iSCSI is an Internet Protocol (IP)-based storage networking standard for linking data storage facilities. By carrying SCSI commands over IP networks, iSCSI is used to facilitate data transfers over intranets and to manage storage over long distances.

iSCSI is a client-server protocol. the server side is called ‘target’, while the client side is referred as the ‘ initiator’. Both target and initiator are uniquely identified by a string called the iSCSI Qualified Name(iQN).

 

Clients (called Initiators) sends SCSI commands (CDBs) to SCSI storage devices (Linux-IO Targets) on remote servers over internet. Unlike traditional Fibre Channel, which requires special-purpose cabling, iSCSI can be run over long distances using existing network infrastructure.

There are two different type of target, one is hardware based(iSCSI storage box), the other is software based. Here I’m going to show you how to config server side target on Linux. In this example, I’m using SL6.4, same to RHEL6.4, CentOS6.4, also can be reference to other Linux distributions.

Package installation

Start iSCSI target service

To start target service

To stop target service

Add device to iSCSI target

Two ways to add device to iSCSI target. The following examples in different way creates a target with id 1 (the iqn is iqn.2015-01.com.fibrevillage.pps11:pps11.target1) and adds a logical unit (backed by a block device /dev/mapper/ddnlun1) with lun 1.

Note:

backing-store or direct-store directives where backing-store refers to either a file or a block device, and direct-store refers to local SCSI devices. In the example below, it’s a block device.

Command line, using tgtadm and tgt-admin

Step1: Create a target device

Step2: Add a logic unit

Step3: Enable target to accept any initiator

Step4: Save the configuration

Direct modify the configuration file, /etc/tgt/targets.conf

Add the following lines to /etc/tgt/targets.conf

Then, restart tgt service, that’s it.

Note about iSCSI IQN:

iSCSI Qualified Name (IQN)
Format: The iSCSI Qualified Name is documented in RFC 3720, with further examples of names in RFC 3721. Briefly, the fields are:
  • literal iqn (iSCSI Qualified Name)
  • date (yyyy-mm) that the naming authority took ownership of the domain
  • reversed domain name of the authority (e.g. org.alpinelinux, com.example, to.yp.cr)
  • Optional “:” prefixing a storage target name specified by the naming authority.
From the RFC:

List iSCSI targets

Restart iSCSI target service

Query iSCSI target

More advanced parameters setting

Specify lun id instead of using auto assignment, add the following line in the targets.conf file for the target

lun 2

Also, you can add parameters such as

vendor info, product info etc..

Here is a small example:

 

More parameters you can find in default /etc/tgt/targets.conf,

For example, on iscsi client, you can see the output of the iscsi target device

 

本文固定链接: http://t.yjsec.com/index.php/2018/03/02/412/ | 下一站

该日志由 admin 于2018年03月02日发表在 Linux 分类下, 你可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客。
原创文章转载请注明: iSCSI target(Server) setup/config on Linux(RHEL,CentOS,SL etc..) | 下一站

iSCSI target(Server) setup/config on Linux(RHEL,CentOS,SL etc..):等您坐沙发呢!

发表评论

快捷键:Ctrl+Enter