iSCSI : iSCSI ターゲットの設定 (tgt)2022/04/27 |
|
iSCSI によるストレージサーバーの構築です。
tgt を利用する場合の iSCSI ターゲットの設定例です。
ネットワーク上のストレージを iSCSI ターゲット、iSCSI ターゲットに接続するクライアントを iSCSI イニシエーターと呼びます。
当例では以下のような環境を前提に iSCSI ストレージサーバーを構築します。 +----------------------+ | +----------------------+ | [ iSCSI Target ] |10.0.0.30 | 10.0.0.51| [ iSCSI Initiator ] | | dlp.srv.world +----------+----------+ node01.srv.world | | | | | +----------------------+ +----------------------+ |
| [1] | 管理ツールをインストールします。 |
|
root@dlp:~# apt -y install tgt
|
| [2] | iSCSI ターゲットの設定です。 例として [/var/lib/iscsi_disks] ディレクトリ内にディスクイメージを作成し、SCSI デバイスとして設定します。 |
|
# ディスクイメージ作成 root@dlp:~# mkdir /var/lib/iscsi_disks root@dlp:~# dd if=/dev/zero of=/var/lib/iscsi_disks/disk01.img count=0 bs=1 seek=10G
[root@dlp ~]#
vi /etc/tgt/conf.d/target01.conf # 新規作成 # 複数デバイスを提供する場合は以下の <target>~</target> を増やして同じ要領で設定する # 命名規則:[ iqn.年-月.ドメイン名の逆:任意の名前 ]
<target iqn.2022-04.world.srv:dlp.target01>
# iSCSI ターゲットとして提供するデバイス (複数設定する場合は [backing-store ***] の行を追加)
backing-store /var/lib/iscsi_disks/disk01.img
# 接続を許可する iSCSI イニシエーターの IQN (複数設定する場合は [initiator-name *.*.*.*] の行を追加)
initiator-name iqn.2022-04.world.srv:node01.initiator01
# 接続を許可する際の認証情報 ( username, password は任意のものを設定)
incominguser username password
</target>
root@dlp:~#
systemctl restart tgt
# 状態確認 root@dlp:~# tgtadm --mode target --op show
Target 1: iqn.2022-04.world.srv:dlp.target01
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
Prevent removal: No
Readonly: No
SWP: No
Thin-provisioning: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00010001
SCSI SN: beaf11
Size: 10737 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
SWP: No
Thin-provisioning: No
Backing store type: rdwr
Backing store path: /var/lib/iscsi_disks/disk01.img
Backing store flags:
Account information:
username
ACL information:
ALL
iqn.2022-04.world.srv:node01.initiator01
|
| Sponsored Link |
|
|