Rhel6.3 practice of building an iscsi-target server

Source: Internet
Author: User

ISCSI technology is a SCSI instruction set that is developed by IBM and used by hardware devices to 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. The biggest benefit of iSCSI is that it can provide a fast network environment. Although there are still some gaps between its performance and bandwidth and the optical network, it can save the cost of enterprises by about 30-40%.

Next, let's take a look at how to mount the iscsi-target server and client on RHEL6.3.

I. server operations

Server version:

[Root @ racscsi home] # uname-r

2.6.32-279. el6.x86 _ 64

[Root @ racscsi home] # cat/etc/redhat-release

Red Hat Enterprise Linux Server release 6.3 (Santiago)

Install the iscsi server software package.

Use RPM for installation.

[Root @ racscsi home] # rpm-ivh scsi-target-utils-1.0.24-2.el6.x86_64.rpm

Warning: scsi-target-utils-1.0.24-2.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing... ######################################## ### [100%]

Package scsi-target-utils-1.0.24-2.el6.x86_64 is already installed

You need to configure the yum source yourself to install the SDK using the YUM command)

[Root @ racscsi home] # yum-y install scsi-target-utils

Start the service and add it to auto-start.

[Root @ racscsi home] #/etc/init. d/tgtd start

Starting SCSI target daemon: [OK]

[Root @ racscsi home] # chkconfig tgtd on


Use the fdisk command to create several partitions, or use external storage to map shared partitions.

Now this server has been divided into/dev/sdb,/dev/sdc,/dev/sdd,/dev/sde,/dev/sdf,/dev/sdg,/dev/sdh ,/dev/sdi partition, used for client mounting

Edit the configuration file/etc/tgt/targets. conf and set iSCSI Qualified Name (IQN ).

[Root @ racscsi home] # vim/etc/tgt/targets. conf

Add the following content to the end of the file:

<Target iqn.2008-09.com. example: asm> # iqn can be any name

Backing-store/dev/sdb

Backing-store/dev/sdc

Backing-store/dev/sdd

Backing-store/dev/sde

Backing-store/dev/sdf

Backing-store/dev/sdg

Backing-store/dev/sdh

Backing-store/dev/sdi

Initiator-address 192.168.10.0/24 # specify the client address segment or specific IP address that can be accessed

Write-cache off # Whether to enable or disable caching

</Target>

Restart the service to make the modified configuration take effect.

[Root @ racscsi home] #/etc/init. d/tgtd restart

Determine whether the iscsi server is successful. If the following information is displayed, the iscsi server is successfully configured.

[Root @ racscsi home] # tgt-admin -- show

Target 1: iqn.2008-09.com. example: asm

System information:

Driver: iscsi

State: ready

I _T nexus information:

I _T nexus: 1

Initiator: iqn.1994-05.com. redhat: b363811441a

Connection: 0

IP Address: 192.168.10.212

LUN information:

LUN: 0

Type: controller

Scsi id: IET 00010000

Scsi sn: beaf10

Size: 0 MB, Block size: 1

Online: Yes

Removable media: No

Prevent removal: No

Readonly: No

Backing store type: null

Backing store path: None

Backing store flags:

LUN: 1

Type: disk

Scsi id: IET 00010001

Scsi sn: beaf11

Size: 2147 MB, Block size: 512

Online: Yes

Removable media: No

Prevent removal: No

Readonly: No

Backing store type: rdwr

Backing store path:/dev/sdb

Backing store flags:

............ # Omitted intermediate content

LUN: 8

Type: disk

Scsi id: IET 00010008

Scsi sn: beaf18

Size: 5369 MB, Block size: 512

Online: Yes

Removable media: No

Prevent removal: No

Readonly: No

Backing store type: rdwr

Backing store path:/dev/sdi

Backing store flags:

Account information:

ACL information:

192.168.10.0/24

Note: Disable IPTABLES on the server to prevent normal client access.


Ii. Client mounting

The iscsi-initiator-utils package to be installed on the client

[Root @ rac2 home] # rpm-ivh iscsi-initiator-utils-6.2.0.872-41.el6.x86_64.rpm

Warning: iscsi-initiator-utils-6.2.0.872-41.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing... ######################################## ### [100%]

1: iscsi-initiator-utils ################################### ####### [1, 100%]

You need to configure the yum source yourself to install the SDK using the YUM command)

[Root @ rac2 home] # yum-y install iscsi-initiator-utils


Start the service and add it to startup.

[Root @ rac2 Desktop] #/etc/init. d/iscsid start

[Root @ rac2 Desktop] # chkconfig iscsid on


Shared partitions of the server-side iscsi server are found.

[Root @ rac2 Desktop] # iscsiadm -- mode discovery -- type sendtargets -- portal 192.168.10.220

192.168.10.220: 3260,1 iqn.2008-09.com. example: asm

Detected


Log on to the partition shared by the iscsi server.

[Root @ rac2 Desktop] # iscsiadm-m node-T iqn.2008-09.com. example: asm-p 192.168.10.220-l

Logging in to [iface: default, target: iqn.2008-09.com. example: asm, portal: 192.168.10.220, 3260] (multiple)

Login to [iface: default, target: iqn.2008-09.com. example: asm, portal: 192.168.10.220, 3260] successful.


Then run the fdisk-l command to view the partitions. All the shared partitions are suspended.

[Root @ rac2 Desktop] # fdisk-l

Disk/dev/sda: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065*512 = 8225280 bytes

Sector size (logical/physical): 512 bytes/512 bytes

I/O size (minimum/optimal): 512 bytes/512 bytes

Disk identifier: 0x000586f0


Device Boot Start End Blocks Id System

/Dev/sda1*1 39 307200 83 Linux

Partition 1 does not end on cylinder boundary.

/Dev/sda2 39 549 4096000 82 Linux swap/Solaris

Partition 2 does not end on cylinder boundary.

/Dev/sda3 549 2611 16567296 83 Linux


Disk/dev/sdb: 2147 MB, 2147483648 bytes

67 heads, 62 sectors/track, 1009 cylinders

Units = cylinders of 4154*512 = 2126848 bytes

Sector size (logical/physical): 512 bytes/512 bytes

I/O size (minimum/optimal): 512 bytes/512 bytes

Disk identifier: 0x00000000



Disk/dev/sdc: 2147 MB, 2147483648 bytes

67 heads, 62 sectors/track, 1009 cylinders

Units = cylinders of 4154*512 = 2126848 bytes

Sector size (logical/physical): 512 bytes/512 bytes

I/O size (minimum/optimal): 512 bytes/512 bytes

Disk identifier: 0x00000000



Disk/dev/sdd: 2147 MB, 2147483648 bytes

67 heads, 62 sectors/track, 1009 cylinders

Units = cylinders of 4154*512 = 2126848 bytes

Sector size (logical/physical): 512 bytes/512 bytes

I/O size (minimum/optimal): 512 bytes/512 bytes

Disk identifier: 0x00000000



Disk/dev/sde: 10.7 GB, 10737418240 bytes

64 heads, 32 sectors/track, 10240 cylinders

Units = cylinders of 2048*512 = 1048576 bytes

Sector size (logical/physical): 512 bytes/512 bytes

I/O size (minimum/optimal): 512 bytes/512 bytes

Disk identifier: 0x00000000



Disk/dev/sdf: 10.7 GB, 10737418240 bytes

64 heads, 32 sectors/track, 10240 cylinders

Units = cylinders of 2048*512 = 1048576 bytes

Sector size (logical/physical): 512 bytes/512 bytes

I/O size (minimum/optimal): 512 bytes/512 bytes

Disk identifier: 0x00000000



Disk/dev/sdg: 10.7 GB, 10737418240 bytes

64 heads, 32 sectors/track, 10240 cylinders

Units = cylinders of 2048*512 = 1048576 bytes

Sector size (logical/physical): 512 bytes/512 bytes

I/O size (minimum/optimal): 512 bytes/512 bytes

Disk identifier: 0x00000000



Disk/dev/sdh: 5368 MB, 5368709120 bytes

166 heads, 62 sectors/track, 1018 cylinders

Units = cylinders of 10292*512 = 5269504 bytes

Sector size (logical/physical): 512 bytes/512 bytes

I/O size (minimum/optimal): 512 bytes/512 bytes

Disk identifier: 0x00000000



Disk/dev/sdi: 5368 MB, 5368709120 bytes

166 heads, 62 sectors/track, 1018 cylinders

Units = cylinders of 10292*512 = 5269504 bytes

Sector size (logical/physical): 512 bytes/512 bytes

I/O size (minimum/optimal): 512 bytes/512 bytes

Disk identifier: 0x00000000


Finally, you can format the partition and mount it to a local directory. To enable automatic mounting upon startup, add a record to the fstab file.

Note that the _ netdev parameter should be added. Otherwise, an error will be reported when you restart the iscsi server.

Example:/dev/sdb/crs ext4 default, _ netdev 0 0


Supplement:

If the user name and password are configured in the/etc/tgt/targets. conf file on the server, for example

<Target iqn.2008-09.com. example: server.tar get3>

Backing-store/dev/sdb

Initiator-address 192.168.10.0/24

Incoming grid 123 @ passwd

Write-cacheoff

</Target>


The configuration file is in the/etc/iscsi/iscsid. conf file of the client.

You need to add the corresponding account and password

Node. session. auth. username = grid

Node. session. auth. password = 123 @ passwd

Discovery. sendtargets. auth. username = grid

Discovery. sendtargets. auth. password = 123 @ passwd


This article from the "Drop water stone" blog, please be sure to keep this source http://xjsunjie.blog.51cto.com/999372/1280283

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.