iSCSI : ターゲットを構成する (CUI)
2017/02/18 |
iSCSI ストレージサーバーを構築します。
ネットワーク上のストレージを iSCSI ターゲット、iSCSI ターゲットに接続するクライアントを iSCSI イニシエーターと呼びます。
CUI で iSCSIターゲットを構成する場合は以下のように設定します。
|
|
[1] | PowerShell を管理者権限で起動して設定します。 |
Windows PowerShell Copyright (C) 2016 Microsoft Corporation. All rights reserved. # iSCSIターゲット作成 # [-TargetName] ⇒ 任意のターゲット名称 # [InitiatorId] ⇒ ターゲットに接続する iSCSIイニシエーターを指定 # iSCSIイニシエーターの指定方法は IPAddress 以外も以下が指定可 # IPAddress, IPv6Address, DNSName, IQN, MACAddress PS C:\Users\Administrator> New-IscsiServerTarget -TargetName "iSCSITarget01" -InitiatorId @("IPAddress:10.0.0.110","IPAddress:10.0.0.111") ChapUserName : ClusterGroupName : ComputerName : RX-7.srv.world Description : EnableChap : False EnableReverseChap : False EnforceIdleTimeoutDetection : True FirstBurstLength : 65536 IdleDuration : 00:00:00 InitiatorIds : {IPAddress:10.0.0.110, IPAddress:10.0.0.111} LastLogin : LunMappings : {} MaxBurstLength : 262144 MaxReceiveDataSegmentLength : 65536 ReceiveBufferCount : 10 ReverseChapUserName : Sessions : {} Status : NotConnected TargetIqn : iqn.1991-05.com.microsoft:rx-7-iscsitarget01-target TargetName : iSCSITarget01 # iSCSI 仮想ディスク作成 # [-Path] ⇒ 任意の PATH # [-SizeBytes] ⇒ 仮想ディスクのサイズ PS C:\Users\Administrator> New-IscsiVirtualDisk -Path "C:\iSCSIDisk\Disk01.vhdx" -SizeBytes 10GB ClusterGroupName : ComputerName : RX-7.srv.world Description : DiskType : Dynamic HostVolumeId : {808CAB52-0000-0000-0000-602200000000} LocalMountDeviceId : OriginalPath : ParentPath : Path : C:\iSCSIDisk\Disk01.vhdx SerialNumber : D1F8597A-48E9-483F-93EB-84CEDBAD5011 Size : 10737418240 SnapshotIds : Status : NotConnected VirtualDiskIndex : 2102166038 # iSCSIターゲットに iSCSI仮想ディスクを割り当てる PS C:\Users\Administrator> Add-IscsiVirtualDiskTargetMapping -TargetName "iSCSITarget01" -Path "C:\iSCSIDisk\Disk01.vhdx" # iSCSIターゲットで CHAP を有効にして任意の認証用のユーザー名とパスワードを設定 # パスワードは12文字以上 PS C:\Users\Administrator> Set-IscsiServerTarget ` -TargetName "iSCSITarget01" ` -EnableChap $True ` -Chap (New-Object PSCredential("username", (ConvertTo-SecureString -AsPlainText "UserP@ssw0rd01" -Force)))` -PassThru ChapUserName : username ClusterGroupName : ComputerName : RX-7.srv.world Description : EnableChap : True EnableReverseChap : False EnforceIdleTimeoutDetection : True FirstBurstLength : 65536 IdleDuration : 00:36:56 InitiatorIds : {IPAddress:10.0.0.110, IPAddress:10.0.0.111} LastLogin : LunMappings : {TargetName:iSCSITarget01;VHD:"C:\iSCSIDisk\Disk01.vhdx";LUN:0} MaxBurstLength : 262144 MaxReceiveDataSegmentLength : 65536 ReceiveBufferCount : 10 ReverseChapUserName : Sessions : {} Status : NotConnected TargetIqn : iqn.1991-05.com.microsoft:rx-7-iscsitarget01-target TargetName : iSCSITarget01 # 設定確認 PS C:\Users\Administrator> Get-IscsiServerTarget -TargetName "iSCSITarget01" ChapUserName : username ClusterGroupName : ComputerName : RX-7.srv.world Description : EnableChap : True EnableReverseChap : False EnforceIdleTimeoutDetection : True FirstBurstLength : 65536 IdleDuration : 00:40:38 InitiatorIds : {IPAddress:10.0.0.110, IPAddress:10.0.0.111} LastLogin : LunMappings : {TargetName:iSCSITarget01;VHD:"C:\iSCSIDisk\Disk01.vhdx";LUN:0} MaxBurstLength : 262144 MaxReceiveDataSegmentLength : 65536 ReceiveBufferCount : 10 ReverseChapUserName : Sessions : {} Status : NotConnected TargetIqn : iqn.1991-05.com.microsoft:rx-7-iscsitarget01-target TargetName : iSCSITarget01 # サービス再起動 PS C:\Users\Administrator> Restart-Service -Name WinTarget |