Fedora 18
Sponsored Link

iSCSIイニシエータの設定
2013/01/18
 
iSCSIイニシエータの設定です。ここの例で前提としている環境は以下の通りです。
 
dlp.srv.world
[10.0.0.30] - iSCSIターゲット

 
www.srv.world
[10.0.0.31] - iSCSIイニシエータ
[1] iSCSIイニシエータの設定
[root@www ~]#
yum -y install iscsi-initiator-utils
[root@www ~]#
vi /etc/iscsi/iscsid.conf
# 53行目:コメント解除

node.session.auth.authmethod = CHAP
# 57,58行目:コメント解除してiSCSIターゲットで設定したユーザー名とパスワードを設定

node.session.auth.username =
username

node.session.auth.password =
password
# ターゲットを discovery する

[root@www ~]#
iscsiadm -m discovery -t sendtargets -p 10.0.0.30

Starting iscsid: [ 7781.324086] Loading iSCSI transport class v2.0-870.
[ 7781.345511] iscsi: registered transport (tcp)
[ 7781.422573] iscsi: registered transport (iser)
[ 7781.453629] libcxgbi:libcxgbi_init_module: tag itt 0x1fff, 13 bits, age 0xf, 4 bits.
[ 7781.454429] libcxgbi:ddp_setup_host_page_size: system PAGE 4096, ddp idx 0.
[ 7781.484234] Chelsio T3 iSCSI Driver cxgb3i v2.0.0 (Jun. 2010)
[ 7781.484850] iscsi: registered transport (cxgb3i)
[ 7781.496297] Chelsio T4 iSCSI Driver cxgb4i v0.9.1 (Aug. 2010)
[ 7781.496911] iscsi: registered transport (cxgb4i)
[ 7781.535191] cnic: Broadcom NetXtreme II CNIC Driver cnic v2.5.14 (Sep 30, 2012)
[ 7781.560939] Broadcom NetXtreme II iSCSI Driver bnx2i v2.7.2.2 (Apr 25, 2012)
[ 7781.561728] iscsi: registered transport (bnx2i)
[ 7781.571312] iscsi: registered transport (be2iscsi)
[ 7781.571783] In beiscsi_module_init, tt=ffffffffa0179000
[  OK  ]
10.0.0.30:3260,1 iqn.2013-01.world.srv:target00

[root@www ~]#
chkconfig iscsi on

[root@www ~]#
chkconfig iscsid on
# discovery した後の状態確認

[root@www ~]#
iscsiadm -m node -o show

# BEGIN RECORD 2.0-872.18.f17
node.name = iqn.2013-01.world.srv:target00
node.tpgt = 1
node.startup = automatic
node.leading_login = No
iface.hwaddress = <empty>
iface.ipaddress = <empty>
iface.iscsi_ifacename = default
iface.net_ifacename = <empty>
iface.transport_name = tcp
iface.initiatorname = <empty>
node.discovery_address = 10.0.0.30
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.nr_sessions = 1
node.session.auth.authmethod = CHAP
node.session.auth.username = username
node.session.auth.password = ********
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 = 30
node.session.err_timeo.tgt_reset_timeout = 30
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 = 10.0.0.30
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.MaxXmitDataSegmentLength = 0
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

# discovery したターゲットにログインする

[root@www ~]#
iscsiadm -m node --login

Logging in to [iface: default, target: iqn.2013-01.world.srv:target00, portal: 10.0.0.30,3260] (multiple)
[ 7894.211401] scsi2 : iSCSI Initiator over TCP/IP
[ 7895.219438] scsi 2:0:0:0: RAID              IET      Controller       0001 PQ: 0 ANSI: 5
[ 7895.220711] scsi 2:0:0:0: Attached scsi generic sg0 type 12
[ 7895.223333] scsi 2:0:0:1: Direct-Access     IET      VIRTUAL-DISK     0001 PQ: 0 ANSI: 5
[ 7895.224459] sd 2:0:0:1: Attached scsi generic sg1 type 0
Login to [iface: default, target: iqn.2013-01.world.srv:target00, portal: 10.0.0.30,3260] successful.
[root@www ~]# [ 7895.228063] sd 2:0:0:1: [sda] 16777216 512-byte logical blocks: (8.58 GB/8.00 GiB)
[ 7895.231148] sd 2:0:0:1: [sda] Write Protect is off
[ 7895.232882] sd 2:0:0:1: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 7895.239997]  sda: sda1
[ 7895.245754] sd 2:0:0:1: [sda] Attached SCSI disk

# 確立しているセッションを確認

[root@www ~]#
iscsiadm -m session -o show

tcp: [1] 10.0.0.30:3260,1 iqn.2013-01.world.srv:target00
# パーティションを確認してみる

[root@www ~]#
cat /proc/partitions

major minor  #blocks  name

 252        0   20971520 vda
 252        1     512000 vda1
 252        2   20458496 vda2
 253        0    4128768 dm-0
 253        1   16326656 dm-1
   8        0    8388608 sda
   8        1    8387584 sda1
# ターゲット提供のデバイスが「sda*」として新たに認識されている
[2]
以上でiSCSIイニシエータの設定は終了です。 後はマウントしたデバイスをネットワークストレージをローカルストレージのように扱うことができます。

 
Tweet