Network attached storage (iSCSI)

Source: Internet
Author: User

Instructor: Instructor Zeng Yong of Double Star Technology

I. Working Principles of iSCSI

1.1. Composition of iSCSI
A simple iSCSI system consists of the following parts:
ISCSI initiator or iSCSI HbA
Iscsi target
Ethernet Switch
One or more servers

1.2 iSCSI initiator

ISCSI initiator is a computing software or hardware device. It is responsible for communicating with iSCSI storage devices. There are two connection methods between the iSCSI server and the iSCSI storage device:
The first software-based method is iSCSI initiator (free of charge). After the initiator is installed on the iSCSI server, the initiator software can virtualize the ethernet card as an iSCSI card, the iSCSI data packets are received and sent to implement the iSCSI protocol and TCP/IP protocol transmission between the host and the iSCSI storage device.
Method 2: hardware iSCSI HbA (host bus adapter) HbA hardware, that is, iSCSI initiator hardware. In this way, you must first purchase an iSCSI HbA card and install it on the iSCSI server to achieve efficient data transmission between the iSCSI server and the switch, and between the iSCSI server and the storage device.
Iscsi adapter cards are roughly divided into two categories: toe HbA cards and iSCSI HbA cards. The former is cheaper, while the latter is more efficient, but the latter is very expensive. Representative vendors include adaptec, alacritech, Intel, LSI, and Qlogic. Intel focuses on the development of toe HbA cards.

1.3. iSCSI target

Iscsi target is an iSCSI disk array that can be used to store data or a device with iSCSI functions can be called "iSCSI target ", it is assumed that most operating systems can use some software to convert the system into an "iSCSI target ".
The iSCSI target software can be used to allocate the storage space of the server to the client. The client can use the iSCSI disk like a local hard disk, including partitioning, formatting, and reading and writing it. In addition, each client can write data to the iSCSI disk without interfering with the user, and does not damage the data stored on the server. In addition, iSCSI can restrict permissions through the configuration file. Very flexible.
We know that iSCSI uses the TCIP/IP protocol for communication. Therefore, you only need an Ethernet network to connect the two ends of iSCSI, the storage performance of iSCSI is directly related to this Ethernet, so it is best to use a Gigabit Ethernet switch in the iSCSI network. Poor network equipment will seriously affect the performance of the storage system. That is to say, to configure high-quality M Ethernet and M switches for each server, and provide two links, configure one device switch for two independent ports in each independent array for iSCSI target, finally, connect the vswitch and use this configuration to prevent it. One of the vswitches has a problem. Another one can ensure the normal operation of data.

2. Command Line-based operations:

Target operation:
The host ID is unique for each target,
The Lun ID of the storage device is allocated by the iSCSI target.
The iSCSI drive provides a drive transmitted over an IP network for SCSI requests and responses.

# Yum-y install SCSI-target-utils
#/Etc/init. d/tgtd start
# Chkconfig tgtd on
# Chkconfig -- list tgtd

(1) simulate a controller
# Tgtadm -- LLD iSCSI -- Mode target -- op new -- targetname sxkj. mydisk1 -- TID 1

-- LLD: indicates the driver or interface type.
-- Mode: Target
-- OP: New
-- Targetname: the name of the targename to be created. iqn. XXXXXXX. The name is fixed before and after mydisk1 and is freely defined in the middle.
-- TID: ID

# View
# Tgtadm -- LLD iSCSI -- Mode target -- op show
(2) associate a device with the analog controller
# Tgtadm -- LLD iSCSI -- Mode logicalunit -- op new -- TID 1 -- Lun 1-B/dev/SDB

-- LLD: indicates the driver or interface type.
-- Mode: Target
-- OP: New
-- TID: ID
-- Lun: Lun ID
-B: Specify the device number.

# View
# Tgtadm -- LLD iSCSI -- Mode target -- op show

(3) IP-based authorization
# Tgtadm -- LLD iSCSI -- Mode target -- op bind -- TID 1-I

Cancel authorization
# Tgtadm -- LLD iSCSI -- Mode target -- op unbind -- TID 1-I

Delete a logical volume
# Tgtadm -- LLD iSCSI -- Mode target -- op Delete -- TID 1 -- Lun 1

Delete a target
# Tgtadm -- LLD iSCSI -- Mode target -- op Delete -- TID 1

Initiator operation:
# ISCSI-INAME RedHat: d18ee3c506b.

# ISCSI-INAME-P skkjgongda skkjgongda: fb66a38ae152.

# Vim/etc/iSCSI/initiatorname. iSCSI
Initiatorname = skkjgongda: fb66a38ae152 give your client a fixed name.

Server target discovered
# Iscsiadm-M discovery-T sendtargets-P

Log on to the server:
# Iscsiadm-M node-T sxkj. mydisk1-P
# Iscsiadm-M node-O Delete-T sxkj. mydisk1-P

Log out first.
# Iscsiadm-M node-T sxkj. mydisk1-P all

Delete a discovery:
Iscsiadm-M node-O Delete-T sxkj. mydisk1-P

5. Summarize the essence of simplicity of all steps

An iSCSI single-host file sharing system, for example, a server shares one or more SDB files.
Each client can use a partition in/sdb.
For example, client 1 can use fdisk/SDB to split one/sdb1
For example, client 2 can use fdisk/SDB to split one/sdb2
For example, client 3 can use fdisk/SDB to split one/sdb3
If client 1 and client 2 Use/sdb1 at the same time, the memory will crash. This major bug,

5.1. Environment Description:
Add a 30g sisci hard disk to target on the server.

5.2 Service Installation
(1) install the service
# Yum-y install SCSI-target-utils
(2) modify the configuration file
# Vim/etc/TGT/targets. conf
<Target sxkj. mydisk1>
Backing-store/dev/SDB # If multiple storage devices exist. Directly add one more backing-store
Incominguser Alvin alvin123 # user-based authentication
Initiator-address # IP-based authorized access

(3) restart the service
#/Etc/init. d/tgtd restart
(4) check whether the operation is successful
# Tgtadm -- LLD iSCSI -- Mode target -- op show
5.3 Client installation
(1) install software
# Yum-y install iSCSI-initiator-utils

(2) modify the unique identifier of the initiator
Like target, a unique ID is also required. You can use-P to change the configuration file, and then edit the configuration file for Permanent modification.
# ISCSI-INAME-P sxkjgongda
# Vim/etc/iSCSI/initiatorname. iSCSI
Initiatorname = RedHat: 1c39abfdfa0 # name your own client Initiator

(3) modify the configuration file
# Vim/etc/iSCSI/iscsid. conf
Node. session. Auth. authmethod = chap # enable CHAP authentication
Node. session. Auth. Username = Alvin # users created and bound to the target on the server
Node. session. Auth. Password = alvin123 # Write the password created by the target on the server

(4) discover the targe command
# Iscsiadm-M discovery-D 2-T St-P

(5) restart the service
#/Etc/init. d/iSCSI restart can I see the shared disk?

(6) You can use fdisl to partition the shared disk. And then hung locally

This article from the "cainiao start" blog, please be sure to keep this source

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.