How to setup ISCSI target using Tgtadm

Source: Internet
Author: User
Tags pow

<
1.Start the TGTD service
#service TGTD Start
The TGTD service is provided by the package:scsi-target-utils.x86_64

2.Define an ISCSI target name: (for example)
# Tgtadm--lld iSCSI--op new--mode target--tid=1--targetname iqn.2001-04.com.example:storage.disk1.amiens.sys1.xyz

3.To View the Currect configuration:
# Tgtadm--lld iSCSI--op show--mode Target

For example, we are here to create a 10G file as the block device:
# dd If=/dev/zero of=/disk1 bs=1m count=10240

4.Add it as a logical unit to the target:
# Tgtadm--lld iSCSI--op New--mode logicalunit--tid 1--lun 1-b/disk1

5.Enable the target to accept any initiators:
# Tgtadm--lld iSCSI--op bind--mode target--tid 1-i all

6.View the current configuration again:
# Tgtadm--lld iSCSI--op show--mode Target
Target 1:iqn.2001-04.com.example:storage.disk1.amiens.sys1.xyz
System Information:
Driver:iscsi
Status:running
i_t Nexus Information:
LUN Information:
lun:0
Type:controller
SCSI id:deadbeaf1:0
SCSI SN:BEAF10
size:0
backing Store:no backing Store
Lun:1
Type:disk
SCSI id:deadbeaf1:1
SCSI sn:beaf11
size:55g
Backing Store:/disk1
Account information:
ACL Information:
All

7.Ensure TCP Port 3260 can accessed from remote host.

8.Start from Red Hat Enterprise Linux 5.3, Tgt-admin and/etc/tgt/targets.conf can is used for make the Setup persistent O Ver reboot:
# tgt-admin--dump >/etc/tgt/targets.conf
# Chkconfig TGTD on

9.In releases prior to Red Hat Enterprise Linux 5.3, your have to put the "Tgtadm" commands into/etc/rc.local and enable T He TGTD service:

echo >>/etc/rc.local <<eof
Tgtadm--lld iSCSI--op new--mode target--tid=1--targetname iqn.2001-04.com.example:storage.disk1.amiens.sys1.xyz
Tgtadm--lld iSCSI--op New--mode logicalunit--tid 1--lun 1-b/disk1
Tgtadm--lld iSCSI--op bind--mode target--tid 1-i all
Eof

# Chkconfig TGTD on


<
1.First Install the Iscsi-initiator-utils package

#yum Install Iscsi-initiator-utils

2.Second start the Iscsid service and enable it to start the system boots:

#service Iscsid Start
#chkconfig Iscsid on

3.Then obtain a listing of available targets from a given host (please note this IPAddress listed below must be replaced W ith the resolvable hostname or IP address of the system providing the port if different than default):

#iscsiadm-M Discovery-t sendtargets-p IPAddress

4.Finally, use the following command to login to the available target (again, replace targetname with one from the output of the previous command and replace IPAddress below with which of the target system):

#iscsiadm-M node-t targetname-p ipaddress-l



This'll enable the target to is accessed upon reboots and it stores it in a node database found IN/VAR/LIB/ISCSI s more thoroughly described in The/usr/share/doc/iscsi-initiator-utils-version/readme file.

For a, verbose listing of possible options for the Iscsiadm command in Red Hat Enterprise Linux 5 refer to the manual Page using:

#man Iscsiadm













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.