ISCSI. AlmaLinux 8. ISCSI-target: различия между версиями

Материал из Wiki
Перейти к навигации Перейти к поиску
Строка 47: Строка 47:


<code>systemctl enable --now target</code>
<code>systemctl enable --now target</code>
-OR-
<code>systemctl restart target</code>


Check if the service is running and listening on the port 3260
Check if the service is running and listening on the port 3260
Строка 62: Строка 66:
<code>nano /etc/iscsi/initiatorname.iscsi</code>
<code>nano /etc/iscsi/initiatorname.iscsi</code>
  InitiatorName=iqn.2023-01.alef:al8-test01
  InitiatorName=iqn.2023-01.alef:al8-test01
Discovery target<code>iscsiadm -m discovery -t st -p 192.168.199.173</code>
Discovery target
 
<code>iscsiadm -m discovery -t st -p 192.168.199.173</code>
      ...
      ...
      192.168.199.173:3260,1 iqn.2023-04.al8-test.iscsi:disk01
      192.168.199.173:3260,1 iqn.2023-04.al8-test.iscsi:disk01

Версия 19:47, 6 апреля 2023

Server iSCSI-target

Install targetcli for iSCSI target management

dnf -y install targetcli

Enter shell

targetcli

Create target for disk01 img

/> cd /iscsi

/> create iqn.2023-04.al8-test.iscsi:disk01

/> ls

Create disk image (extent)

/> cd backstores/fileio

/backstores/fileio> create disk01 /home/disk01.img 3G

   Optionally, delete

   /backstores/fileio> delete disk01

Bind disk image to LUN0

/> cd /iscsi/iqn.2023-04.al8-test.iscsi:disk01/tpg1/luns

/iscsi/iqn.20...k01/tpg1/luns> create /backstores/fileio/disk01

/iscsi/iqn.20...k01/tpg1/luns> ls

   Optionally, delete

   /iscsi/iqn.20...k01/tpg1/luns> delete 0

Bind initiator to tpg1 (Target group)

cd /iscsi/iqn.2023-04.al8-test.iscsi:disk01/tpg1/acls

/iscsi/iqn.20...k01/tpg1/acls> create iqn.2023-04.al8-test.iscsi:pve01-test.initiator01

Start and enable iscsi-target service

systemctl enable --now target

-OR-

systemctl restart target

Check if the service is running and listening on the port 3260

netstat -luptn

    ...
    LISTEN   0         256                 0.0.0.0:3260             0.0.0.0:*
    ...

Client iSCSI-initiator

Dedicated article: ISCSI. AlmaLinux 8. ISCSI-Initiator

Initiator name

nano /etc/iscsi/initiatorname.iscsi

InitiatorName=iqn.2023-01.alef:al8-test01

Discovery target

iscsiadm -m discovery -t st -p 192.168.199.173

    ...
    192.168.199.173:3260,1 iqn.2023-04.al8-test.iscsi:disk01
    ...

Connect to target

iscsiadm -m node --targetname "iqn.2023-04.al8-test.iscsi:disk01" --portal "192.168.199.173:3260" --login   

Block device is connectedlsblk

    ...
    sdb 8:16 0 3G 0 disk
    ...