NVMe over RDMA や iSER を検討しているのですが、その前に iSCSI で ramdisk を使うとどうなるか調べておくことにしました。
以下、長いのですが、環境は Debian 12 で、ターゲット(サーバ 10.1.56.50 i50)およびイニシエータ(クライアント 10.1.56.106 sv106)の設定です。
以下、長いのですが、環境は Debian 12 で、ターゲット(サーバ 10.1.56.50 i50)およびイニシエータ(クライアント 10.1.56.106 sv106)の設定です。
# 必要パッケージのインストール apt-get install targetcli-fb # コマンドの起動 targetcli targetcli shell version 2.1.53 Copyright 2011-2013 by Datera, Inc and others. For help on commands, type 'help' /> cd /backstores/ /backstores> ls o- backstores .................................................................................... [...] o- block ........................................................................ [Storage Objects: 0] o- fileio ....................................................................... [Storage Objects: 0] o- pscsi ........................................................................ [Storage Objects: 0] o- ramdisk ...................................................................... [Storage Objects: 0] # ラムディスクの作成 /backstores> cd ramdisk /backstores/ramdisk> create name=rd4gb01 size=4g Created ramdisk rd4gb01 with size 4g. # ターゲットiqnの作成 /backstores/ramdisk> cd /iscsi /iscsi> create iqn.1868-01.com.example:i50.rd4gb01 Created target iqn.1868-01.com.example:i50.rd4gb01. Created TPG 1. Global pref auto_add_default_portal=true Created default portal listening on all IPs (0.0.0.0), port 3260. /iscsi> ls o- iscsi .................................................................................. [Targets: 1] o- iqn.1868-01.com.example:i50.rd4gb01 ................................................. [TPGs: 1] o- tpg1 ..................................................................... [no-gen-acls, no-auth] o- acls ................................................................................ [ACLs: 0] o- luns ................................................................................ [LUNs: 0] o- portals .......................................................................... [Portals: 1] o- 0.0.0.0:3260 ........................................................................... [OK] # 認証を有効にする /iscsi> cd iqn.1868-01.com.example:i50.rd4gb01/tpg1 /iscsi/iqn.18....rd4gb01/tpg1> /iscsi/iqn.18....rd4gb01/tpg1> set attribute authentication= Parameter authentication is now '1'. # LUN(論理ユニット番号)の登録 /iscsi/iqn.18....rd4gb01/tpg1> cd luns /iscsi/iqn.18...b01/tpg1/luns> create /backstores/ramdisk/rd4gb01 Created LUN 0. # イニシエータの登録 /iscsi/iqn.18...b01/tpg1/luns> cd ../acls /iscsi/iqn.18...b01/tpg1/acls> create iqn.1868-01.com.example:sv106 Created Node ACL for iqn.1868-01.com.example:sv106 Created mapped LUN 0. /iscsi/iqn.18...b01/tpg1/acls> ls o- acls ...................................................................................... [ACLs: 1] o- iqn.1868-01.com.example:sv106 .................................... [1-way auth, Mapped LUNs: 1] o- mapped_lun0 ......................................................... [lun0 ramdisk/rd4gb01 (rw)] /iscsi/iqn.18...b01/tpg1/acls> cd iqn.1868-01.com.example:sv106 # 認証用ユーザ名とパスワードの設定 /iscsi/iqn.18...example:sv106> set auth userid=user01 Parameter userid is now 'user01'. /iscsi/iqn.18...example:sv106> set auth password=P@ssW0rd Parameter password is now 'P@ssW0rd'. # 設定完了 cd / saveconfig exit Global pref auto_save_on_exit=true Configuration saved to /etc/rtslib-fb-target/saveconfig.json # シェルで確認 ss -napt | grep 3260 LISTEN 0 256 0.0.0.0:3260 0.0.0.0:* # 起動時に iSCSIターゲットが起動できるようにする場合。 systemctl enable rtslib-fb-targetctl # ターゲット(サーバ)側は以上 ================================================================= # 以下イニシエータ(クライアント)側 # パッケージのインストール apt-get install open-iscsi # バックアップ cp -a /etc/iscsi/initiatorname.iscsi /etc/iscsi/initiatorname.iscsi.orig # 編集 /etc/iscsi/initiatorname.iscsi --snip-- #InitiatorName=iqn.1993-08.org.debian:01:507914736b41 InitiatorName=iqn.1868-01.com.example:sv106 # バックアップ cp -a /etc/iscsi/iscsid.conf /etc/iscsi/iscsid.conf.orig # edit /etc/iscsi/iscsid.conf like below: --snip ( 以下コメント解除 ) node.session.auth.authmethod = CHAP --snip( 以下コメント解除および設定 ) node.session.auth.username = user01 node.session.auth.password = P@ssW0rd --snip # iscsid と open-iscsi の再起動 systemctl restart iscsid open-iscsi # ターゲット を discovery(発見) iscsiadm -m discovery -t sendtargets -p 10.1.56.50 10.1.56.50:3260,1 iqn.1868-01.com.example:i50.rd4gb01 # 確認 iscsiadm -m node -o show # BEGIN RECORD 2.1.8 node.name = iqn.1868-01.com.example:i50.rd4gb01 --以下省略 # ターゲットにログイン(接続) iscsiadm -m node --login -p 10.1.56.50 Logging in to [iface: default, target: iqn.1868-01.com.example:i50.rd4gb01, portal: 10.1.56.50,3260] Login to [iface: default, target: iqn.1868-01.com.example:i50.rd4gb01, portal: 10.1.56.50,3260] successful. # 起動時にターゲットに自動的にログイン(接続)する場合 iscsiadm -m node -p 10.1.56.50 -o update -n node.startup -v automatic # 接続を確認 dmesg | tail [21633.603792] scsi host9: iSCSI Initiator over TCP/IP [21633.623593] scsi 9:0:0:0: Direct-Access LIO-ORG rd4gb01 4.0 PQ: 0 ANSI: 6 [21633.628980] sd 9:0:0:0: Attached scsi generic sg3 type 0 [21633.629367] sd 9:0:0:0: [sdd] 8388608 512-byte logical blocks: (4.29 GB/4.00 GiB) [21633.629561] sd 9:0:0:0: [sdd] Write Protect is off [21633.629567] sd 9:0:0:0: [sdd] Mode Sense: 43 00 00 08 [21633.629914] sd 9:0:0:0: [sdd] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA [21633.630044] sd 9:0:0:0: [sdd] Preferred minimum I/O size 512 bytes [21633.630050] sd 9:0:0:0: [sdd] Optimal transfer size 4294967288 logical blocks > dev_max (65535 logical blocks) [21633.631838] sd 9:0:0:0: [sdd] Attached SCSI disk # パーティションの作成 ( fdisk でディスク全体を一つのバーティションで使う場合 ) fdisk /dev/sdd # 確認 p # 作成 n p (enter) (enter) (enter) # 書き込み w # 確認 ls /dev/sdd* # フォーマット mkfs.xfs /dev/sdd1 # マウント mount /dev/sdd1 /mnt #イニシエータ(クライアント)側以上今回は以上です。それでは。
コメント
コメントを投稿