Detailed steps to build iSCSI shared storage under Linux (server emulation Ipsan storage)

Source: Internet
Author: User

First, Introduction

ISCSI (Internet SCSI) technology, developed by IBM Research, is a set of SCSI instructions that can be run on the upper layer of the IP protocol for use by hardware devices, which can enable the SCSI protocol to run on an IP network. Allows routing to be routed on such high-speed Gigabit Ethernet. iSCSI technology is a new storage technology that combines existing SCSI interfaces with Ethernet (Ethernet) technology to enable servers to Exchange data with storage devices that use IP networks.

iSCSI is a TCP/IP-based protocol used to establish and manage inter-connectivity between IP storage devices, hosts, and clients, and to create a storage area network (SAN). SAN makes it possible for the SCSI protocol to be applied to high-speed data transmission networks, which are performed across multiple data storage networks at block level (block-level). The SCSI architecture is based on the C/S mode, and the typical application environment is that the devices are close to each other and the devices are connected by a SCSI bus.

The main functionality of ISCSI is the encapsulation and reliable transmission of large amounts of data between host systems (initiator initiator) and storage devices (target targets) on TCP/IP networks.

The topology of the complete iSCSI system is as follows:

Essentially, the ISCSI initiator is a client device that connects to a service provided by the server (in this case, the ISCSI target) and initiates a request for the service.  The ISCSI initiator software needs to be installed on each Oracle RAC node (RAC1 and RAC2). ISCSI initiators can be implemented either in software or in hardware. Software ISCSI initiators are available for most major operating system platforms. For this article, we will use the free Linux OPEN-ISCSI software driver provided in Iscsi-initiator-utils RPM. ISCSI software initiators are typically used in conjunction with standard network interface cards (NICs), in most cases, Gigabit Ethernet cards. The hardware initiator is an ISCSI HBA (or TCP Offload engine (TOE) card), which is essentially a dedicated Ethernet card on which the SCSI ASIC can offload all work (TCP and SCSI commands) from within the system CPU. ISCSI HBAs can be purchased from many vendors, including Adaptec, Alacritech, Intel, and QLogic.

The iSCSI target is the "server" component of the iSCSI network. It is typically a storage device that contains the information you need and responds to requests from (one or more) initiators. For this article, node Rac1 will be the ISCSI target.

Second, the experimental environment:

1. The operating system shuts down the firewall or opens 3260 ports on the firewall and disables SELinux

2. iSCSI shared storage topology diagram:

3, iSCSI can share a lot of device types, including image files (*.img), partitions (partition), physical hard disks, RAID devices, logical volumes, and so on, I only use the physical disk partition to carry out the relevant tests, other types of people can test their own.

Third, the experimental steps

(i) Configuring iSCSI target:

Scenario 1: Command-line configuration, immediate effect, invalid restart

1. Add a disk partition to target: SDB1

2. Install the package, start the service

[Email protected] ~]# yum install-y scsi-target-utils

[[email protected] ~]# service TGTD start

3. Create target

[[email protected] ~]# tgtadm--lld iSCSI--mode Target--op new--tid 1--targetname IQN.2017-04.COM.COMSYS:ISCSI.FCD ISK

4. Create LUNs

[[email protected] ~]# tgtadm--lld iSCSI--mode logicalunit--op New--tid 1--lun 1--backing-store/dev/sdb1

[[email protected] ~]# tgtadm--lld iSCSI--mode logicalunit--op Delete--tid 1--lun 1 # methods to remove LUNs

5. Authorization

After assigning a LUN to Target, you need to configure access control to use it. You can set access for all users, or you can set access rights based on IP/IP segment or user name authentication.

To add two IP access rights:
[[email protected] ~]# # tgtadm--lld iSCSI--modetarget--op bind--tid 1 --initiator-address 192 .168.1.10
[[email protected] ~]# #tgtadm--lld iSCSI--mode target--op bind--tid 1 --initiator-address192.16 8.2.10

Add access to an IP segment:
[[Email protected] ~] #tgtadm--lld iSCSI--mode target--op bind--tid 1 --initiator-address

To add access to all IPs:
[[Email protected] ~] #tgtadm--lld iSCSI--mode target--op bind--tid 1 --initiator-address All

Note : Access control is an attribute of target, which only adds access control to the target and cannot add access control to a separate LUN.

6. View the information already defined

[[email protected] ~]# tgtadm--lld iSCSI--mode target--op show

Scenario 2: Defined in the configuration file, restart valid

1. Install TGT

[Email protected] ~]# yum install scsi-target-utils-y

2. Configuring the TGT

The main configuration file for the TGT is/etc/tgt/targets.conf, and we'll set up the file below.

The following settings are added at the end of the file:


BACKING-STORE/DEV/SDB1 #指定要发布的设备已划分的分区

Initiator-address all #对于客户端的访问控制, allowing all users to access



The IQN (ISCSI qualified name) name rules are as follows:

The format is: "IQN" + "month" + "." + "Reverse Domain name" + ":" + "Device specific name", the reason is to reverse the domain name is to avoid possible conflicts.


Each backing-store on the same target is called a logical Unit number (Logical unit Number,lun), which has 1 LUNs in the experiment.

Other advanced settings such as, you configure yourself.

Incominguser user1 pass12 #允许user1访问密码pass12

Write-cache off #关闭写缓存

#direct-STORE/DEV/SDC #整块磁盘

3. Start iSCSI Target

[[email protected] ~]# /etc/init.d/tgtdstart # launch target service

[[email protected] ~]# CHKCONFIGTGTD on # boot up automatically

4. View iSCSI Target

[[email protected] ~]# tgtadm--lld iSCSI--mode target--op show

LUN0 is the controller, you can see the size of each LUN and the disk path.

The ISCSI Target setting is now complete.

Detailed steps to build iSCSI shared storage under Linux (server emulation Ipsan storage)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.