Building IP storage networks with iSCSI storage technology

Source: Internet
Author: User

This article focuses on how to build an iSCSI storage System for a PC architecture, where we select a common, well-performing, multi-disk-capable PC server as iSCSI target, and choose a mature and stable iSCSI target software Iscsitarget, The basic configuration environment is shown in table 1:
Table 1

The target host third hard disk (the hard disk is identified as/DEV/SDC) as the iSCSI shared disk, the hard disk size is 10G, respectively shared to a Windows host and a Linux host, the basic structure of 1 is as follows:

Figure 1

The following is a detailed introduction to iSCSI Network Storage setup.

installation of the iSCSI target software
installation of the Iscsitarget software is performed on the target host, That is the 192.168.12.246 host set above, here we choose the target software is iscsitarget, readers can from http:// Iscsitarget.sourceforge.net download the appropriate version, download the iscsitarget-1.4.20.1.tar.gz, and then start the compilation installation:
[[email protected] iSCSI] #tar-XZVF iscsitarget-1.4.20.1.tar.gz
[[email protected] iSCSI] #cd iscsitarget-1.4.20.1
[[Email  protected] iscsitarget-1.4.20.1] #make
[[email protected] iscsitarget-1.4.20.1] #make install
 iscsitarget after installation, the/etc/iet/directory will be created, this directory has iscsitarget related configuration files, then you can start the Iscsitarget service, the command to start or close the Iscsitarget service is as follows:
[[email protected] iscsi]# service iscsi-target       
Usage:/etc/ Init.d/iscsi-target {Start|stop|restart|condrestart|status}
If you want the Iscsi-target service to run automatically, you need to do the following:
[[Email  protected] iSCSI] #chkconfig--level iscsi-target on
ends, Iscsitarget installation is complete.

Second, configure a simple ISCSI target
 iscsi Enterprise target with a master profile of/etc/iet/ Ietd.conf, the options in this file are all commented out by default, and when these options are needed, the comments are removed.
  Open the ietd.conf file, first find a line similar to the following:
#Target iqn.2001-04.com.example:storage.disk2.sys1.xyz
This option indicates that the iSCSI Target name, first the "#" number is removed, Target's name in the same subnet should be unique, the standard naming method is:
iqn.yyyy-mm.<reversed domain Name>[:identifier]
Where:
? &NBSP;IQN: Indicates "ISCSI qualified Name", referred to as IQN.
? &NBSP;YYYY-MM: Represents the year-month. This is 2001-04.
?  reversed Domain Name: Indicates the inverted domain name, here is com.example.
?  identifier: Indicates the identification code, here is storage.disk2.sys1.xyz.
Next, to set the LUN (Logical Unit number), find a line similar to the following:
#Lun 0 path=/dev/sdb,type=fileio,scsiid=xyz,scsisn=xyz
Put the preceding "# "Number is removed," Lun 0 path=/dev/sdb "means block device number 0, mapped disk is/dev/sdb," Type "value FileIO is the default, can be used for disk, file and LVM, which is set to" FileIO ", It is used primarily for storage sharing on a disk. Readers can change path to the device identity of the storage partition that needs to be shared, depending on their situation. This assumes that the shared device is identified as/DEV/SDB.
At this point, a simple iSCSI target has been configured and finally started the Iscsi-target service:
[[email protected] iscsi]# Services Iscsi-target start

Third, configure iSCSI initiator on Windows
The following actions are performed on initiator Windows hosts, that is, the IP is the 192.168.12.136 host.
Microsoft's support for iSCSI initiator is quite complete, and readers can get iSCSI initiator software from the Microsoft website for free, with the URL http://www.microsoft.com/WindowsServer2003/ Technologies/storage/iscsi/default.mspx
, the version of this chapter download is Initiator-2.08-build3825-x86fre.exe, and the next step is to show you how to get windows to connect to iSCSI Target.
After the ISCSI initiator is installed, the boot icon will be found on the desktop, after you start Microsoft ISCSI Initiator, select the second paging label "Discovery", and then click the "Add" button in the "Target Portals" section Jump out of the "Add Target Portal" window, as shown in 2:

Figure 2

Under this window, complete the iSCSI target IP address and port, the iSCSI target address is the address of the target host set above, the iSCSI target port default is 3260, unless there is a special setting, complete, click OK button.
Next, select the third paging label "Targets", 3, you can see that iSCSI initiator has detected the name of the iSCSI target, but at this time the iSCSI target is still in the "inactive" status, click "Log on" below button, and then pops the "Log on to Target" window and then presses the "OK" button to activate target, when the iSCSI target has changed from "inactive" status to "Connected" status. 4 and Figure 5 are as follows:

Figure 3

Figure 4


Figure 5

To this end, the Windows system has identified the shared disk partitions provided by iSCSI Target, and through Windows Disk Manager you can see the newly added disk partitions, as shown in 6:



Figure 6

You can now partition, format, and mount the shared disk using the Disk management features of Windows.

iv. Configuring iSCSI Initiator
on Linux   The following operations are performed on Linux hosts on initiator, that is, the IP is the 192.168.12.26 host.
1  Install Linux version iSCSI initiator
Now the mainstream Linux distribution has its own iSCSI initiator, or OPEN-ISCSI, if the system is not installed, Simply locate the iscsi-initiator-utils-6.2.0.871-0.16.el5.i386.rpm package via the disc, install it via RPM, or automatically install it via Yum, as follows:
[[email  Protected] Initiator iSCSI] #yum install iscsi*
When the installation is complete, the/ETC/ISCSI main program configuration directory is generated, and the other related files are installed in:
/etc/iscsi/ iscsid.conf
/etc/rc.d/init.d/iscsi
/etc/rc.d/init.d/iscsid
/sbin/iscsi-iname
/sbin/iscsiadm
/ Sbin/iscsid
/sbin/iscsistart
/var/lib/iscsi
/var/lib/iscsi/ifaces
/var/lib/iscsi/isns
/var/lib/ Iscsi/nodes
/var/lib/iscsi/send_targets
/VAR/LIB/ISCSI/SLP
/var/lib/iscsi/static
/var/lock/iscsi
The next step is to start the initiator service, as follows:
[[email protected] Initiator iscsi]# service iSCSI start
 

2 Introduction to ISCSI Initiator directory features
? /sbin/iscsiadm command
After the iSCSI initiator installation is complete, the/SBIN/ISCSIADM command is generated, which is a command-line tool for managing (updating, deleting, inserting, querying) iSCSI configuration database files that users can use with iSCSI nodes, sessions, Connections and Discovery Records perform a series of operations.
? /var/lib/iscsi/send_targets Directory
In this directory, one or more folders named "iSCSI Target IP, Port number" (for example, "192.168.12.246,3260") are generated with the iSCSI storage server IP and ports.
? /var/lib/iscsi/nodes Directory
In this directory, one or more folders named after the target name on the iSCSI storage server are generated, under which there is a configuration parameter file named "ISCSI Portal IP, port number" (for example, "192.168.12.246,3260"). The file is the parameter to be used when iSCSI initiator is signed in to iSCSI Target, and the settings for these parameters are inherited from the parameters in the/etc/iscsi/iscsi.conf, and you can make changes to a parameter file by Iscsiadm command.

3 performing iSCSI target discovery on Linux
You can use the following instructions to query the ISCSI Target host for which LUNs are divided:
ISCSIADM-M Discovery--type sendtargets--portal IP
Or
Iscsiadm-m discovery-t sendtargets-p IP
For example:
[[Email protected] Initiator iSCSI]# iscsiadm-m discovery-t sendtargets-p 192.168.12.246:3260
192.168.12.246:3260,1 iqn.2001-04.com.example:storage.disk2.sys1.xyz
As you can see, "IQN.2001-04.COM.EXAMPLE:STORAGE.DISK2.SYS1.XYZ" is the name of the iSCSI target. Because there are no restrictions when configuring iSCSI target, all client hosts are allowed to connect to the iSCSI target shared disks.
It should be noted that when target discovery is successfully executed, the ISCSI initiator writes the query record to the/var/lib/iscsi/send_targets corresponding directory. Therefore, the target discovery can only be performed once.
It then establishes a connection to the iSCSI target host via the ISCSIADM directive, which is to log on to iSCSI target:
Iscsiadm-m node-t <target-name>-P <ip-address>:<port>--login
Or
Iscsiadm-m node-t [Target-name]-P [ip-address]-L
Here the "-T" followed by the target name, "Ip-address" is the target host IP address, "Port" is the target host port number, the default is 3260.
For example:
[[Email protected] Initiator iSCSI] #iscsiadm-M node-t iqn.2001-04.com.example:storage.disk2.sys1.xyz-p 192.168.12.246-l
Logging in to [Iface:default, TARGET:IQN.2001-04.COM.EXAMPLE:STORAGE.DISK2.SYS1.XYZ, portal:192.168.12.246,3260]
Login to [Iface:default, TARGET:IQN.2001-04.COM.EXAMPLE:STORAGE.DISK2.SYS1.XYZ, portal:192.168.12.246,3260]: Successful
If you have more than one target host, you can log in all targets at once with the following command:
[[Email protected] Initiator iSCSI] #iscsiadm-M node--loginall=all
It is important to note that, by performing the target discovery operation, a connection has already been made to the iSCSI target host, and if the ISCSIADM command is executed again to establish a connection to the target host, it will prompt "Iscsiadm:initiator Reported error (15-already exists), you need to disconnect the iSCSI target host by performing the following instructions to disconnect the initiator from the iSCSI target host:
Iscsiadm-m node-t [Target-name]-P [ip-address]-U
For example:
[[Email protected] Initiator iSCSI] #iscsiadm-M node-t iqn.2001-04.com.example:storage.disk2.sys1.xyz-p 192.168.12.246-u
Logging out of Session [Sid:2, TARGET:IQN.2001-04.COM.EXAMPLE:STORAGE.DISK2.SYS1.XYZ, portal:192.168.12.246,3260]
Logout of [Sid:2, TARGET:IQN.2001-04.COM.EXAMPLE:STORAGE.DISK2.SYS1.XYZ, portal:192.168.12.246,3260]: Successful
After the iSCSI initiator and iSCSI target connections are successful, you can also view the iSCSI session information by following these commands:
[[Email protected] Initiator iSCSI] #iscsiadm-M session–i
For example:
[[Email protected] Initiator iSCSI] #iscsiadm-M session–i
ISCSI Transport Class Version 2.0-871
Version 2.0-871
Target:iqn.2001-04.com.example:storage.disk2.sys1.xyz
Current portal:192.168.12.246:3260,1
Persistent portal:192.168.12.246:3260,1
**********
Interface:
**********
Iface Name:default
Iface transport:tcp
Iface INITIATORNAME:IQN.1994-05.COM.REDHAT:FD37F211E3A
Iface ipaddress:192.168.12.26
Iface hwaddress: <empty>
Iface Netdev: <empty>
Sid:1
ISCSI Connection state:logged in
ISCSI Session state:logged_in
Internal iscsid Session State:no Change
************************
Negotiated ISCSI params:
************************
Headerdigest:none
Datadigest:none
maxrecvdatasegmentlength:262144
maxxmitdatasegmentlength:8192
firstburstlength:65536
maxburstlength:262144
Immediatedata:yes
Initialr2t:yes
Maxoutstandingr2t:1
************************
Attached SCSI devices:
************************
Host number:32 state:running
SCSI32 Channel xx Id 0 lun:0
Attached SCSI disk SDB state:running

4 Managing Shared Disks
First, through the FDISK command to see the shared disk identity, you can also see through the DMESG command system is denied to the shared iSCSI disk, the operation is as follows:
[[Email protected] Initiator iSCSI] #fdisk-L
disk/dev/sda:320.0 GB, 320072933376 bytes
255 heads, Sectors/track, 38913 cylinders
Units = Cylinders of 16065 * 8225280 bytes

Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 104391 Linux
/dev/sda2 38913 312464250 8e Linux LVM

disk/dev/sdb:10.7 GB, 10737418240 bytes
255 heads, Sectors/track, 1305 cylinders
Units = Cylinders of 16065 * 8225280 bytes

Device Boot Start End Blocks Id System
/DEV/SDB1 1 609 4891761 Linux
/DEV/SDB2 610 1305 5590620-up Linux
From the Fdisk output, the iSCSI shared disk is identified as/DEV/SDB, size 10.7G, and the following can be used to repartition, format, and create file systems with the Fdisk command.


Building IP storage networks with iSCSI storage technology

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.