How to Setup Iscsi

Published on January 2017 | Categories: Documents | Downloads: 42 | Comments: 0 | Views: 354
of 6
Download PDF   Embed   Report

Comments

Content

How to setup iscsi target (iscsi server).
(REDHAT)
Backgroup (setup), there are 3 vmware servers,
host1 192.168.111.129 (act as ISCSI target aka server)
host2 192.168.111.130 (act as ISCSI initiator aka client)
host3 192.168.111.131 (act as ISCSI initiator aka client)
/dev/sdb, 1GB (added after installation of server, as additional harddrive) on h
ost1 (only and not on host2, host3) vmware server i.e. host1 on above setup. Bel
ow commands should only executed in target server (master server not client serv
er).
1.
yum install -y scsi-target-utils
2.
pvcreate isciPV /dev/sdb
vgcreate iscsiVg /dev/sdb
lvcreate -n iscsiLv -l 255 iscsiVg
3.
vi /etc/tgt/targets.conf
default-driver iscsi
<target iqn.2010-11.host1.ibmx.com:server.iscitarget1>
backing-store /dev/iscsiVg/iscsiLv
initiator-address 192.168.111.130
initiator-address 192.168.111.131
</target>
4.
service tgtd start
chkconfig tgtd on
5.
tgt-admin -s
sample output
[root@host1 ~]# tgt-admin -s
Target 1: iqn.2010-11.host1.ibmx.com:server.iscitarget1
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 5
Initiator: iqn.1994-05.com.redhat:432afe799e44
Connection: 0
IP Address: 192.168.111.130
LUN information:
LUN: 0
Type: controller
SCSI ID: IET
00010000
SCSI SN: beaf10
Size: 0 MB
Online: Yes
Removable media: No
Backing store type: rdwr
Backing store path: None
LUN: 1
Type: disk

SCSI ID: IET
00010001
SCSI SN: beaf11
Size: 1070 MB
Online: Yes
Removable media: No
Backing store type: rdwr
Backing store path: /dev/iscsiVg/iscsiLv
Account information:
ACL information:
192.168.111.130
192.168.111.131
[root@host1 ~]#
********************************************************************************
*******************************

********************************************************************************
*******************************
How to setup iscsi initiator (iscsi client).
1.
yum install -y iscsi-initiator-utils
2.
vi /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.1994-05.com.redhat:432afe799e44 (by default)
InitiatorAlias=host1
[root@host2 ~]#
3.
service iscsi start
chkconfig iscsi on
4.
iscsiadm -m discovery -t sendtargets -p host1
sample:
[root@host2 ~]# iscsiadm -m discovery -t sendtargets -p host1
192.168.111.129:3260,1 iqn.2010-11.host1.ibmx.com:server.iscitarget1
[root@host2 ~]#
5.
iscsiadm -m node -T iqn.2010-11.host1.ibmx.com:server.iscitarget1 -p 192.168.111
.129
sample:
[root@host2 ~]# iscsiadm -m node -T iqn.2010-11.host1.ibmx.com:server.iscitarget
1 -p 192.168.111.129
# BEGIN RECORD 2.0-871
node.name = iqn.2010-11.host1.ibmx.com:server.iscitarget1
node.tpgt = 1
node.startup = automatic
iface.hwaddress = <empty>
iface.ipaddress = <empty>
iface.iscsi_ifacename = default
iface.net_ifacename = <empty>
iface.transport_name = tcp

iface.initiatorname = <empty>
node.discovery_address = host1
node.discovery_port = 3260
node.discovery_type = send_targets
node.session.initial_cmdsn = 0
node.session.initial_login_retry_max = 8
node.session.xmit_thread_priority = -20
node.session.cmds_max = 128
node.session.queue_depth = 32
node.session.auth.authmethod = None
node.session.auth.username = <empty>
node.session.auth.password = <empty>
node.session.auth.username_in = <empty>
node.session.auth.password_in = <empty>
node.session.timeo.replacement_timeout = 120
node.session.err_timeo.abort_timeout = 15
node.session.err_timeo.lu_reset_timeout = 20
node.session.err_timeo.host_reset_timeout = 60
node.session.iscsi.FastAbort = Yes
node.session.iscsi.InitialR2T = No
node.session.iscsi.ImmediateData = Yes
node.session.iscsi.FirstBurstLength = 262144
node.session.iscsi.MaxBurstLength = 16776192
node.session.iscsi.DefaultTime2Retain = 0
node.session.iscsi.DefaultTime2Wait = 2
node.session.iscsi.MaxConnections = 1
node.session.iscsi.MaxOutstandingR2T = 1
node.session.iscsi.ERL = 0
node.conn[0].address = 192.168.111.129
node.conn[0].port = 3260
node.conn[0].startup = manual
node.conn[0].tcp.window_size = 524288
node.conn[0].tcp.type_of_service = 0
node.conn[0].timeo.logout_timeout = 15
node.conn[0].timeo.login_timeout = 15
node.conn[0].timeo.auth_timeout = 45
node.conn[0].timeo.noop_out_interval = 5
node.conn[0].timeo.noop_out_timeout = 5
node.conn[0].iscsi.MaxRecvDataSegmentLength = 262144
node.conn[0].iscsi.HeaderDigest = None
node.conn[0].iscsi.IFMarker = No
node.conn[0].iscsi.OFMarker = No
# END RECORD
[root@host2 ~]#
6.
iscsiadm -m node -T iqn.2010-11.host1.ibmx.com:server.iscitarget1 -p 192.168.111
.129 -l
sample:
[root@host2 ~]# iscsiadm -m node -T iqn.2010-11.host1.ibmx.com:server.iscitarget
1 -p 192.168.111.129 -l
Logging in to [iface: default, target: iqn.2010-11.host1.ibmx.com:server.iscitar
get1, portal: 192.168.111.129,3260]
Login to [iface: default, target: iqn.2010-11.host1.ibmx.com:server.iscitarget1,
portal: 192.168.111.129,3260]: successful
[root@host2 ~]#
7.
fdisk -l

sample:
Disk /dev/sdb: 1069 MB, 1069547520 bytes
33 heads, 62 sectors/track, 1020 cylinders
Units = cylinders of 2046 * 512 = 1047552 bytes
Disk /dev/sdb doesn't contain a valid partition table
8.
iscsiadm -m node -T iqn.2010-11.host1.ibmx.com:server.iscitarget1 -p 192.168.111
.129 -u
sample:
[root@host2 ~]# iscsiadm -m node -T iqn.2010-11.host1.ibmx.com:server.iscitarget
1 -p 192.168.111.129 -u
Logging out of session [sid: 2, target: iqn.2010-11.host1.ibmx.com:server.iscita
rget1, portal: 192.168.111.129,3260]
Logout of [sid: 2, target: iqn.2010-11.host1.ibmx.com:server.iscitarget1, portal
: 192.168.111.129,3260]: successful
[root@host2 ~]#
9.
service iscsi restart
sample
[root@host2 ~]# service iscsi restart
Stopping iSCSI daemon:
iscsid dead but pid file exists
Starting iSCSI daemon:

[ OK ]
[ OK ]
[ OK ]
Setting up iSCSI targets: Logging in to [iface: default, target: iqn.2010-11.hos
t1.ibmx.com:server.iscitarget1, portal: 192.168.111.129,3260]
Login to [iface: default, target: iqn.2010-11.host1.ibmx.com:server.iscitarget1,
portal: 192.168.111.129,3260]: successful
[ OK ]
[root@host2 ~]#
10.
iscsiadm -m node -T iqn.2010-11.host1.ibmx.com:server.iscitarget1 -p 192.168.111
.129 -u
iscsiadm -m node -T iqn.2010-11.host1.ibmx.com:server.iscitarget1 -p 192.168.111
.129 -o delete
sample
[root@host2 ~]# iscsiadm -m node -T iqn.2010-11.host1.ibmx.com:server.iscitarget
1 -p 192.168.111.129 -u
Logging out of session [sid: 1, target: iqn.2010-11.host1.ibmx.com:server.iscita
rget1, portal: 192.168.111.129,3260]
Logout of [sid: 1, target: iqn.2010-11.host1.ibmx.com:server.iscitarget1, portal
: 192.168.111.129,3260]: successful
[root@host2 ~]#
sample
[root@host2 ~]# iscsiadm -m node -T iqn.2010-11.host1.ibmx.com:server.iscitarget
1 -p 192.168.111.129 -o delete
[root@host2 ~]#

11.
service iscsi restart
sample
[root@host2 ~]# service iscsi restart
Stopping iSCSI daemon:
iscsid dead but pid file exists
Starting iSCSI daemon:

[ OK ]
[ OK ]
[ OK ]

Setting up iSCSI targets: iscsiadm: No records found!
[ OK ]
[root@host2 ~]#
12.
iscsiadm -m discovery -t sendtargets -p host1
sample
[root@host2 ~]# iscsiadm -m discovery -t sendtargets -p host1
192.168.111.129:3260,1 iqn.2010-11.host1.ibmx.com:server.iscitarget1
[root@host2 ~]#
13.
iscsiadm -m node -T iqn.2010-11.host1.ibmx.com:server.iscitarget1 -p 192.168.111
.129 -l
sample
[root@host2 ~]# iscsiadm -m node -T iqn.2010-11.host1.ibmx.com:server.iscitarget
1 -p 192.168.111.129 -l
Logging in to [iface: default, target: iqn.2010-11.host1.ibmx.com:server.iscitar
get1, portal: 192.168.111.129,3260]
Login to [iface: default, target: iqn.2010-11.host1.ibmx.com:server.iscitarget1,
portal: 192.168.111.129,3260]: successful
[root@host2 ~]#
[root@host2 ~]# fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot
/dev/sda1 *
/dev/sda2
/dev/sda3
/dev/sda4
/dev/sda5

Start
1
7
516
777
777

End
6
515
776
1305
1305

Blocks
48163+
4088542+
2096482+
4249192+
4249161

Id
83
83
82
5
83

System
Linux
Linux
Linux swap / Solaris
Extended
Linux

Disk /dev/sdb: 1069 MB, 1069547520 bytes
33 heads, 62 sectors/track, 1020 cylinders
Units = cylinders of 2046 * 512 = 1047552 bytes
Disk /dev/sdb doesn't contain a valid partition table
[root@host2 ~]#
14.
iscsiadm -m node -T iqn.2010-11.host1.ibmx.com:server.iscitarget1 -p 192.168.111
.129 -u
iscsiadm -m node -T iqn.2010-11.host1.ibmx.com:server.iscitarget1 -p 192.168.111
.129 -o delete
fdisk -l

sample:z
[root@host2 ~]# iscsiadm -m node -T iqn.2010-11.host1.ibmx.com:server.iscitarget
1 -p 192.168.111.129 -u
Logging out of session [sid: 1, target: iqn.2010-11.host1.ibmx.com:server.iscita
rget1, portal: 192.168.111.129,3260]
Logout of [sid: 1, target: iqn.2010-11.host1.ibmx.com:server.iscitarget1, portal
: 192.168.111.129,3260]: successful
[root@host2 ~]# iscsiadm -m node -T iqn.2010-11.host1.ibmx.com:server.iscitarget
1 -p 192.168.111.129 -o delete
[root@host2 ~]# fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot
/dev/sda1 *
/dev/sda2
/dev/sda3
/dev/sda4
/dev/sda5
[root@host2 ~]#

Start
1
7
516
777
777

End
6
515
776
1305
1305

Blocks
48163+
4088542+
2096482+
4249192+
4249161

Id
83
83
82
5
83

System
Linux
Linux
Linux swap / Solaris
Extended
Linux

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close