티스토리 뷰

System Story/CentOS 5,6

iSCSI Target 서버 구성

불량펭귄 helperchoi 2013. 11. 10. 20:20

1. 별도의 Storage 장비가 없을 경우 Linux 에서 간단히 iSCSI 형태의 Shared Volume을 제공 가능

 

[root@TEST01 ~]#
[root@TEST01 ~]# yum list | grep scsi
iscsi-initiator-utils.x86_64 6.2.0.872-13.el5 installed
iscsi-initiator-utils.x86_64 6.2.0.872-16.el5 base
lsscsi.x86_64 0.17-3.el5 base
scsi-target-utils.x86_64 1.0.14-2.el5 base
[root@TEST01 ~]#
[root@TEST01 ~]# yum info scsi-target-utils.x86_64
Loaded plugins: fastestmirror, priorities, security
Loading mirror speeds from cached hostfile
* base: data.nicehosting.co.kr
* extras: data.nicehosting.co.kr
* rpmforge: ftp.riken.jp
* updates: data.nicehosting.co.kr
Available Packages
Name : scsi-target-utils
Arch : x86_64
Version : 1.0.14
Release : 2.el5
Size : 172 k
Repo : base
Summary : The SCSI target daemon and utility programs
URL : http://stgt.sourceforge.net/
License : GPLv2
Description: The SCSI target package contains the daemon and tools to setup a SCSI targets.
: Currently, software iSCSI targets are supported.

[root@TEST01 ~]#
[root@TEST01 ~]#
[root@TEST01 ~]# yum -y install scsi-target-utils.x86_64
Loaded plugins: fastestmirror, priorities, security
Loading mirror speeds from cached hostfile
* base: centos.tt.co.kr
* extras: centos.tt.co.kr
* rpmforge: ftp.riken.jp

. . . 생략

Running Transaction
Installing : perl-Config-General 1/5
Installing : openib 2/5
Installing : libibverbs 3/5
Installing : librdmacm 4/5
Installing : scsi-target-utils 5/5

Installed:
scsi-target-utils.x86_64 0:1.0.14-2.el5

Dependency Installed:
libibverbs.x86_64 0:1.1.6-3.el5 librdmacm.x86_64 0:1.0.15-2.el5 openib.noarch 0:1.5.4.1-4.el5 perl-Config-General.noarch 0:2.44-1.el5.rf

Complete!
[root@TEST01 ~]#
[root@TEST01 ~]#

[root@TEST01 /]#
[root@TEST01 /]# service tgtd start
Starting SCSI target daemon: Starting target framework daemon
[root@TEST01 /]#
[root@TEST01 /]# tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.2013-09.192.168.137.10:storage.iscsi1
[root@TEST01 /]#
[root@TEST01 /]# tgtadm --lld iscsi --op show --mode target
Target 1: iqn.2013-09.192.168.137.10:storage.iscsi1
System information:
Driver: iscsi
State: ready
I_T nexus information:
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags:
Account information:
ACL information:
[root@TEST01 /]#
[root@TEST01 /]#
[root@TEST01 /]# tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/sdb (Target LUN 할당 작업)
[root@TEST01 /]#
[root@TEST01 /]# tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL (할당된 TID 및 LUN에 대항 Binding)
[root@TEST01 /]#
[root@TEST01 /]# tgtadm --lld iscsi --op show --mode target
Target 1: iqn.2013-09.192.168.137.10:storage.iscsi1
System information:
Driver: iscsi
State: ready
I_T nexus information:
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: 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: 1074 MB, Block size: 512
Online: Yes
Removable media: No
Readonly: No
Backing store type: rdwr
Backing store path: /dev/sdb
Backing store flags:
Account information:
ACL information:
ALL
[root@TEST01 /]#
[root@TEST01 /]#
[root@TEST01 /]#
[root@TEST01 /]#
[root@TEST01 /]# tgtadm --lld iscsi --op show --mode target --tid 1
MaxRecvDataSegmentLength=8192
MaxXmitDataSegmentLength=8192
HeaderDigest=None
DataDigest=None
InitialR2T=Yes
MaxOutstandingR2T=1
ImmediateData=Yes
FirstBurstLength=65536
MaxBurstLength=262144
DataPDUInOrder=Yes
DataSequenceInOrder=Yes
ErrorRecoveryLevel=0
IFMarker=No
OFMarker=No
DefaultTime2Wait=2
DefaultTime2Retain=20
OFMarkInt=Reject
IFMarkInt=Reject
MaxConnections=1
RDMAExtensions=Yes
TargetRecvDataSegmentLength=262144
InitiatorRecvDataSegmentLength=262144
MaxOutstandingUnexpectedPDUs=0
[root@TEST01 /]#
[root@TEST01 /]#
[root@TEST01 /]# ps -ef | grep tgtd
root 3183 1 0 11:22 ? 00:00:00 tgtd
root 3184 3183 0 11:22 ? 00:00:00 tgtd
root 3285 2371 0 12:02 pts/0 00:00:00 grep tgtd
[root@TEST01 /]#
[root@TEST01 /]#
[root@TEST01 /]# lsof -i | grep 3183
tgtd 3183 root 5u IPv4 12132 0t0 TCP *:iscsi-target (LISTEN)
[root@TEST01 /]#
[root@TEST01 /]# netstat -lnp | grep 3183
tcp 0 0 0.0.0.0:3260 0.0.0.0:* LISTEN 3183/tgtd
unix 2 [ ACC ] STREAM LISTENING 12133 3183/tgtd /var/run/tgtd.ipc_abstract_namespace.0
[root@TEST01 /]#
[root@TEST01 /]#

[root@TEST01 ~]#

 

 

2. Reboot 후에도 iSCSI 서비스를 제공 할 수 있도록 Config 추가

 

 [root@TEST01 ~]#
[root@TEST01 ~]# tgt-admin --dump > /etc/tgt/targets.conf
[root@TEST01 ~]#
[root@TEST01 ~]#
[root@TEST01 ~]# cat /etc/tgt/targets.conf | grep -v "#"

default-driver iscsi

<target iqn.2013-09.192.168.137.10:storage.iscsi1>
backing-store /dev/sdb
</target>

[root@TEST01 ~]#
[root@TEST01 ~]#
[root@TEST01 ~]#

 

 

 

3. 할당된 Disk LUN 삭제시는 아래와 같이 수행

 

[root@TEST01 /]#
[root@TEST01 /]#
[root@TEST01 /]#
[root@TEST01 /]# tgtadm --lld iscsi --mode target --op delete --tid 1 (Target 볼륨 LUN 삭제)
[root@TEST01 /]#
[root@TEST01 /]#  

 

반응형

'System Story > CentOS 5,6' 카테고리의 다른 글

JAVA thread Count  (0) 2013.11.10
iSCSI target Logout 및 삭제  (0) 2013.11.10
iSCSI Target 서버 구성  (0) 2013.11.10
iSCSI Initiator 설정 및 Target 마운트  (0) 2013.11.10
간단한 iptables sample 형식  (0) 2013.11.10
IP Alias  (0) 2013.11.10
댓글
댓글쓰기 폼