====== istgtでiSCSI Target ======
iSCSI Target(言い方変えるとiSCSIサーバ)を作る。
すごく単純にLUN0を作成してプライベートな範囲からアクセス可能にする。(ESXiでもこのまま使える。)
===== ファイルを指定してLUNを作るパターン =====
/usr/local/etc/istgt/istgt.conf
[Global]
Comment "Global section"
NodeBase "iqn.2010-01.net.ainoniwa.istgt"
PidFile /var/run/istgt.pid
AuthFile /usr/local/etc/istgt/auth.conf
MediaDirectory /var/istgt
LogFacility "local7"
Timeout 30
NopInInterval 20
DiscoveryAuthMethod Auto
MaxSessions 64
MaxConnections 16
FirstBurstLength 65536
MaxBurstLength 262144
MaxRecvDataSegmentLength 262144
[UnitControl]
Comment "Internal Logical Unit Controller"
AuthMethod CHAP Mutual
AuthGroup AuthGroup10000
Portal UC1 [::1]:3261
Portal UC1 127.0.0.1:3261
Netmask [::1]
Netmask 127.0.0.1
[PortalGroup1]
Comment "SINGLE PORT TEST"
Portal DA1 [2001:380:e08:e7::31]:3260
Portal DA1 192.168.1.103:3260
[InitiatorGroup1]
Comment "Initiator Group1"
InitiatorName "ALL"
Netmask 192.168.1.0/24
Netmask [2001:380:e08:e7::]/64
[LogicalUnit1]
Comment "Hard Disk Sample"
TargetName disk1
TargetAlias "Data Disk1"
Mapping PortalGroup1 InitiatorGroup1
AuthMethod Auto
AuthGroup AuthGroup1
UseDigest Auto
UnitType Disk
QueueDepth 32
LUN0 Storage /mnt/lib_01/OS/iSCSI/esxi-01 20GB
# 複数台のディスクが必要な場合は、LUNXを増やしていけばいい。
# LUN1 Storage /mnt/lib_01/OS/iSCSI/esxi-02 20GB
/usr/local/etc/istgt/auth.conf
[AuthGroup1]
Comment "Auth Group1"
/usr/local/etc/istgt/istgtcontrol.conf
(特に何か書き換えた記憶が無い。)
[Global]
Comment "sample configuration"
# socket I/O timeout sec.
Timeout 60
# authentication information
#AuthMethod Auto
AuthMethod CHAP Mutual
Auth "testuser" "secret" "mutual user" "mutual secret"
#AuthMethod CHAP
#Auth "testuser" "secret"
# default controller's host name or IP and port
Host localhost
#Host 192.168.2.36
Port 3261
# default target name and LUN
#TargetName "iqn.xxxx"
TargetName "iqn.2007-09.jp.ne.peach:dvd1"
Lun 0
# removable file's flag, initial size if creating
# ro: read only, rw: read and write
# auto: use existing size or minimum size
Flags "ro"
Size "auto"