Fedora 36にiSCSI ターゲットストレージサーバーをインストールする

環境
OSバージョンを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# cat /etc/redhat-release
Fedora release 36 (Thirty Six)
# cat /etc/redhat-release Fedora release 36 (Thirty Six)
# cat /etc/redhat-release
Fedora release 36 (Thirty Six)

iSCSIストレージサーバーの構築方法
1.管理ツールtargetcliをインストールします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# dnf -y install targetcli
# dnf -y install targetcli
# dnf -y install targetcli

2.ディスクイメージ格納ディレクトリを作成します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# mkdir /var/lib/iscsi_disks
# mkdir /var/lib/iscsi_disks
# mkdir /var/lib/iscsi_disks

3.管理ツールを起動します
[/var/lib/iscsi_disks] ディレクトリ内にディスクイメージを作成し、SCSI デバイスとして設定します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# targetcli
targetcli shell version 2.1.54
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.
/>
/> cd backstores/fileio
/backstores/fileio>
# targetcli targetcli shell version 2.1.54 Copyright 2011-2013 by Datera, Inc and others. For help on commands, type 'help'. /> /> cd backstores/fileio /backstores/fileio>
# targetcli
targetcli shell version 2.1.54
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.
/>
/> cd backstores/fileio
/backstores/fileio>

4.「diskcft」という名前で [/var/lib/iscsi_disks/disk01.img] を 1G で作成します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
/backstores/fileio> create diskcft /var/lib/iscsi_disks/disk01.img 1G
Created fileio diskcft with size 1073741824
/backstores/fileio> cd /iscsi
/backstores/fileio> create diskcft /var/lib/iscsi_disks/disk01.img 1G Created fileio diskcft with size 1073741824 /backstores/fileio> cd /iscsi
/backstores/fileio> create diskcft /var/lib/iscsi_disks/disk01.img 1G
Created fileio diskcft with size 1073741824
/backstores/fileio> cd /iscsi

5.ターゲットを作成します
書式
iqn.年-月.ドメイン名の逆:任意の名前

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
/iscsi> create iqn.2022-05.arkgame.com:dlp.target01
Created target iqn.2022-05.arkgame.com:dlp.target01.
Created TPG 1.
Global pref auto_add_default_portal=true
Created default portal listening on all IPs (0.0.0.0), port 3260.
/iscsi> create iqn.2022-05.arkgame.com:dlp.target01 Created target iqn.2022-05.arkgame.com:dlp.target01. Created TPG 1. Global pref auto_add_default_portal=true Created default portal listening on all IPs (0.0.0.0), port 3260.
/iscsi> create iqn.2022-05.arkgame.com:dlp.target01
Created target iqn.2022-05.arkgame.com:dlp.target01.
Created TPG 1.
Global pref auto_add_default_portal=true
Created default portal listening on all IPs (0.0.0.0), port 3260.

6.LUNを設定します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
/iscsi> cd iqn.2022-05.arkgame.com:dlp.target01/tpg1/luns
/iscsi/iqn.20...t01/tpg1/luns> create /backstores/fileio/diskcft
Created LUN 0.
/iscsi> cd iqn.2022-05.arkgame.com:dlp.target01/tpg1/luns /iscsi/iqn.20...t01/tpg1/luns> create /backstores/fileio/diskcft Created LUN 0.
/iscsi> cd iqn.2022-05.arkgame.com:dlp.target01/tpg1/luns
/iscsi/iqn.20...t01/tpg1/luns> create /backstores/fileio/diskcft
Created LUN 0.

7.ACLを設定します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
/iscsi/iqn.20...t01/tpg1/luns> cd ../acls
/iscsi/iqn.20...t01/tpg1/acls> create iqn.2022-05.arkgame.com:node01.initiator01
Created Node ACL for iqn.2022-05.arkgame.com:node01.initiator01
Created mapped LUN 0.
/iscsi/iqn.20...t01/tpg1/luns> cd ../acls /iscsi/iqn.20...t01/tpg1/acls> create iqn.2022-05.arkgame.com:node01.initiator01 Created Node ACL for iqn.2022-05.arkgame.com:node01.initiator01 Created mapped LUN 0.
/iscsi/iqn.20...t01/tpg1/luns> cd ../acls
/iscsi/iqn.20...t01/tpg1/acls> create iqn.2022-05.arkgame.com:node01.initiator01
Created Node ACL for iqn.2022-05.arkgame.com:node01.initiator01
Created mapped LUN 0.

8.認証用ユーザーID を設定します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
/iscsi/iqn.20...t01/tpg1/acls> cd iqn.2022-05.arkgame.com:node01.initiator01
/iscsi/iqn.20...1.initiator01> set auth userid=arte #ユーザーIDの設定
Parameter userid is now 'arte'.
/iscsi/iqn.20...1.initiator01> set auth password=arte #パスワードの設定
Parameter password is now 'arte'.
/iscsi/iqn.20...1.initiator01> exit
Global pref auto_save_on_exit=true
Configuration saved to /etc/target/saveconfig.json
/iscsi/iqn.20...t01/tpg1/acls> cd iqn.2022-05.arkgame.com:node01.initiator01 /iscsi/iqn.20...1.initiator01> set auth userid=arte #ユーザーIDの設定 Parameter userid is now 'arte'. /iscsi/iqn.20...1.initiator01> set auth password=arte #パスワードの設定 Parameter password is now 'arte'. /iscsi/iqn.20...1.initiator01> exit Global pref auto_save_on_exit=true Configuration saved to /etc/target/saveconfig.json
/iscsi/iqn.20...t01/tpg1/acls> cd iqn.2022-05.arkgame.com:node01.initiator01
/iscsi/iqn.20...1.initiator01> set auth userid=arte #ユーザーIDの設定
Parameter userid is now 'arte'.
/iscsi/iqn.20...1.initiator01> set auth password=arte #パスワードの設定
Parameter password is now 'arte'.
/iscsi/iqn.20...1.initiator01> exit
Global pref auto_save_on_exit=true
Configuration saved to /etc/target/saveconfig.json

10.ターゲットの状態を確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# ss -napt | grep 3260
LISTEN 0 256 0.0.0.0:3260 0.0.0.0:*
# ss -napt | grep 3260 LISTEN 0 256 0.0.0.0:3260 0.0.0.0:*
# ss -napt | grep 3260
LISTEN 0 256 0.0.0.0:3260 0.0.0.0:*

target自動起動を設定します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# systemctl enable target
Created symlink /etc/systemd/system/multi-user.target.wants/target.service → /usr/lib/systemd/system/target.service.
# systemctl enable target Created symlink /etc/systemd/system/multi-user.target.wants/target.service → /usr/lib/systemd/system/target.service.
# systemctl enable target
Created symlink /etc/systemd/system/multi-user.target.wants/target.service → /usr/lib/systemd/system/target.service.

11.iSCSI ターゲットサービスのファイアウォールを設定します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# firewall-cmd --add-service=iscsi-target
success
# firewall-cmd --runtime-to-permanent
success
# firewall-cmd --add-service=iscsi-target success # firewall-cmd --runtime-to-permanent success
# firewall-cmd --add-service=iscsi-target
success
# firewall-cmd --runtime-to-permanent
success

 

Fedora 36

Posted by arkgame