Tgt: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
 
(7 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
=Install=
+
=Installieren von TGT=
*apt-get install tgt
+
==Ubuntu/Debian==
=Create an empty target=
+
*sudo apt-get update
*tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.2021-10.xinux.org:disks
+
*sudo apt-get install tgt
 +
=Fedora/Redhat=
 +
*sudo yum install scsi-target-utils
 +
=Erstellen der Images=
 +
*dd if=/dev/zero of=/mnt/target1.img bs=1G count=5
 +
*dd if=/dev/zero of=/mnt/target2.img bs=1G count=5
 +
*dd if=/dev/zero of=/mnt/target3.img bs=1G count=5
  
=Create a LUN for the target=
+
=Erstellen des iSCSI-Target=
*tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /mnt/md0/luns/lun0
+
*tgtadm --lld iscsi --mode target --op new --tid 1 --targetname iqn.2023-06.com.tuxmen:target1
 +
*tgtadm --lld iscsi --mode target --op new --tid 2 --targetname iqn.2023-06.com.tuxmen:target2
 +
*tgtadm --lld iscsi --mode target --op new --tid 3 --targetname iqn.2023-06.com.tuxmen:target3
  
=Set/Add a new ACL rule=
+
=Binden iSCSI-Targets=
*tgtadm --lld iscsi --op bind --mode target --tid 1 -I 10.80.0.0/13
+
*tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 --backing-store /mnt/target1.img
=Show Targets=
+
*tgtadm --lld iscsi --mode logicalunit --op new --tid 2 --lun 2 --backing-store /mnt/target2.img
*tgtadm --lld iscsi --op show --mode target
+
*tgtadm --lld iscsi --mode logicalunit --op new --tid 3 --lun 3 --backing-store /mnt/target3.img
<pre>
 
Target 1: iqn.2021-10.xinux.lan:disks
 
    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: 21475 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: /mnt/md0/iscsi/disk-1.img
 
            Backing store flags:
 
    Account information:
 
    ACL information:
 
        10.80.0.0/13
 
</pre>
 
  
 +
=Aktivieren Sie das iSCSI-Target=
 +
*tgtadm --lld iscsi --mode target --op bind --tid 1 --initiator-address ALL
 +
*tgtadm --lld iscsi --mode target --op bind --tid 2 --initiator-address ALL
 +
*tgtadm --lld iscsi --mode target --op bind --tid 3 --initiator-address ALL
  
 
+
=Überprüfen des iSCSI-Target=
=Links=
+
*tgtadm --lld iscsi --mode target --op show
*http://inqbus-hosting.de/support/dokumentation/docs/target-daemon-tgtd-tgtadm
 
*https://www.cyberciti.biz/tips/howto-setup-linux-iscsi-target-sanwith-tgt.html
 

Aktuelle Version vom 24. Juni 2023, 20:46 Uhr

Installieren von TGT

Ubuntu/Debian

  • sudo apt-get update
  • sudo apt-get install tgt

Fedora/Redhat

  • sudo yum install scsi-target-utils

Erstellen der Images

  • dd if=/dev/zero of=/mnt/target1.img bs=1G count=5
  • dd if=/dev/zero of=/mnt/target2.img bs=1G count=5
  • dd if=/dev/zero of=/mnt/target3.img bs=1G count=5

Erstellen des iSCSI-Target

  • tgtadm --lld iscsi --mode target --op new --tid 1 --targetname iqn.2023-06.com.tuxmen:target1
  • tgtadm --lld iscsi --mode target --op new --tid 2 --targetname iqn.2023-06.com.tuxmen:target2
  • tgtadm --lld iscsi --mode target --op new --tid 3 --targetname iqn.2023-06.com.tuxmen:target3

Binden iSCSI-Targets

  • tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 --backing-store /mnt/target1.img
  • tgtadm --lld iscsi --mode logicalunit --op new --tid 2 --lun 2 --backing-store /mnt/target2.img
  • tgtadm --lld iscsi --mode logicalunit --op new --tid 3 --lun 3 --backing-store /mnt/target3.img

Aktivieren Sie das iSCSI-Target

  • tgtadm --lld iscsi --mode target --op bind --tid 1 --initiator-address ALL
  • tgtadm --lld iscsi --mode target --op bind --tid 2 --initiator-address ALL
  • tgtadm --lld iscsi --mode target --op bind --tid 3 --initiator-address ALL

Überprüfen des iSCSI-Target

  • tgtadm --lld iscsi --mode target --op show