Configure iSCSI network storage in CentOS 6.3

Source: Internet
Author: User

Configure iSCSI network storage in CentOS 6.3

I. Introduction

ISCSI (internet SCSI) is a SCSI instruction set that is used by hardware devices and can run on the upper layer of the IP protocol, this command set allows you to run the SCSI protocol on an IP network so that it can select routes on high-speed Gigabit Ethernet. ISCSI is a new storage technology that combines existing SCSI interfaces with Ethernet technologies to allow servers to exchange data with storage devices using IP networks.

ISCSI is a TCP/IP-based protocol used to establish and manage the connection between IP storage devices, hosts and clients, and create a storage area network (SAN ). SAN makes it possible to apply the SCSI protocol to high-speed data transmission networks. Such transmission is performed between multiple data storage networks at the block-level. The SCSI structure is based on the C/S mode. The common application environment is that devices are close to each other and these devices are connected by the SCSI bus.

The main function of iSCSI is to encapsulate and reliably transmit large amounts of data between the host system (initiator) and the storage device (target) on the TCP/IP network.

The complete iSCSI system topology is as follows:

Ii. experiment environment

Operating System: CentOS release 6.3 (Final)

ISCSI Target: 192.168.1.21/scsi-target-utils-1.0.24-12.el6_5.i686

ISCSI Initiator: 192.168.1.22/iscsi-initiator-utils-6.2.0.873-10.el6.i686

Firewall disabled/iptables: Firewall is not running.

SELINUX = disabled

Iii. Preparations

There are many types of devices that can be shared by iSCSI, including image files (*. img), partition, physical hard disk, raid device, logical volume, etc. Below we will prepare several of them for testing. You can test other types by yourself.

3.1 simulate an image

Create an image file of MB in the/srv directory of the iSCSI Target.

# Mkdir/srv/iscsi

# Dd if =/dev/zero of =/srv/iscsi/disk1.img bs = 1 M count = 200

# Ll-lh/srv/iscsi/disk1.img

4. Configure iSCSI Target

4.1 install tgt

CentOS comes with the scsi-target-utils software. We use this software to set the target.

# Yum-y install scsi-target-utils

4.2 configure tgt

The main configuration file of tgt is/etc/tgt/targets. conf. Next we will set and modify the file.

Add the following settings at the end of the file:

<target iqn.2014-07.dev.iscsi-target:iscsidisk>     backing-store /srv/iscsi/disk1.img     backing-store /dev/sdb1     backing-store /dev/vg0/lv1     backing-store /dev/sdd </target>

Note:

Iqn = iSCSI Qualified Name

The iSCSI target naming rules are as follows:

Iqn.2014-07. dev. iscsi-target: iscsidisk

Iqn. Year-month. Domain Name anti-write. device identification

Each backing-store on the same target is called a Logical Unit Number (LUN). In this experiment, there are four Luns.

Other advanced settings include initiator-address and incominguser.

4.3 start iSCSI target

#/Etc/init. d/tgtd start

# Chkconfig tgtd on

# Netstat-tulnp | grep tgt

5. Configure iSCSI Initiator

5.1 install initiator

# Yum-y install iscsi-initiator-utils

5.2 set startup

# Chkconfig iscsid on

# Chkconfig iscsi on

5.3 Configuration document

The configuration document of initiator is located in/etc/iscsi/. There are two files in this directory: initiatorname. iscsi and iscsid. conf,

Iscsid. conf is its configuration file, initiatorname. iscsi is the name marked with initiator, and its default name is InitiatorName = iqn.1994-05.com. redhat: b45be5af6021. We can change it based on the actual situation. Here we change it to InitiatorName = iqn.2014-07. dev. iscsi-initiator: initiator.

-M discovery // detects target-t sendtargets // specifies the target IP address and port through the iscsi protocol-p IP: port // if no port is written, the default value is 3260.

5.5 view nodes

The Results Detected by iscsiadm are written to/var/lib/iscsi/nodes/. Therefore, you only need to start/etc/init. d/iscsi can automatically connect to the correct target at the next boot.

# Ll-R/var/lib/iscsi/nodes/

5.7 view disk Information

# Fdisk-l

David Camp

  • For technical exchange, add the QQ group:

System O & M Technology: 296513821

  • For business cooperation, contact the author QQ: 562866602
  • My ID: mchina_tang
  • Write to me: mchina_tang@qq.com
  • My address: Suzhou, Jiangsu Province

We always believe that sharing is a virtue |We Believe, Great People Share Knowledge...

Related Article

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: info-contact@alibabacloud.com 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.