Iscsi: Difference between revisions

From DWIKI
mNo edit summary
mNo edit summary
(28 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Links=
*http://nil.uniza.sk/linux-howto/linux-mint-mouting-freenas-iscsi-disk
*[http://fibrevillage.com/storage/205-iscsiadm-command-examples-on-linux iscsiadm command examples]
*[https://fedoraproject.org/wiki/Scsi-target-utils_Quickstart_Guide Scsi-target-utils Quickstart Guide]
*https://wiki.archlinux.org/index.php/TGT_iSCSI_Target
*[https://pubs.vmware.com/vsphere-50/topic/com.vmware.vcli.examples.doc_50/cli_manage_iscsi_storage.7.5.html iSCSI on ESXCLI]


= Links =
*[http://nil.uniza.sk/linux-howto/linux-mint-mouting-freenas-iscsi-disk http://nil.uniza.sk/linux-howto/linux-mint-mouting-freenas-iscsi-disk]
*[http://fibrevillage.com/storage/205-iscsiadm-command-examples-on-linux iscsiadm command examples]
*[https://fedoraproject.org/wiki/Scsi-target-utils_Quickstart_Guide Scsi-target-utils Quickstart Guide]
*[https://blog.delouw.ch/2013/07/07/creating-and-managing-iscsi-targets/ Creating and managing iSCSI targets]
*[https://wiki.archlinux.org/index.php/TGT_iSCSI_Target https://wiki.archlinux.org/index.php/TGT_iSCSI_Target]
*[https://pubs.vmware.com/vsphere-50/topic/com.vmware.vcli.examples.doc_50/cli_manage_iscsi_storage.7.5.html iSCSI on ESXCLI]
*[https://wiki.archlinux.org/index.php/ISCSI/tgt https://wiki.archlinux.org/index.php/ISCSI/tgt]
*[https://ask.openstack.org/en/question/30299/how-to-resize-an-instance-residing-on-a-block-storage-volume/ https://ask.openstack.org/en/question/30299/how-to-resize-an-instance-residing-on-a-block-storage-volume/]
*[http://linux-iscsi.org/wiki/Targetcli targetcli]
*https://www.truenas.com/community/resources/why-iscsi-often-requires-more-resources-for-the-same-result.41/


=FAQ=
=FAQ=


==ISCSI client==
 
== On ISCSI client ==
 
=== Find targets ===


  iscsi_discovery 192.168.100.32
  iscsi_discovery 192.168.100.32
   
Please logout from all targets on 192.168.178.3:3260 before trying to run discovery on that portal
??
=== List connected targets ===
iscsiadm -m session -P 3


===List connected targets===
iscsiadm -m session
which seems to list only one, for multiple:
which seems to list only one, for multiple:


  tgtadm --lld iscsi --op show --mode conn --tid 1
  tgtadm --lld iscsi --op show --mode conn --tid 1
but that needs more work
but that needs more work


===List targets===
=== List targets ===
 
  iscsiadm -m discovery -t sendtargets -p 192.168.100.32
  iscsiadm -m discovery -t sendtargets -p 192.168.100.32


===Connect to target===
=== Connect to target ===
 
  iscsiadm -m node --targetname="iqn.2018-5.mynet:drbd0" --portal "192.168.100.32" --login
  iscsiadm -m node --targetname="iqn.2018-5.mynet:drbd0" --portal "192.168.100.32" --login


if you get things like "iscsiadm: No records found" try a thing like
if you get things like "iscsiadm: No records found" try a thing like
  iscsiadm --mode node -l all
  iscsiadm --mode node -l all


===Disconnect from target===
iscsiadm: Could not log into all portals:
 
 
=== Disconnect from target ===
 
  iscsiadm -m node -T iqn.2018-5.mynet:drbd0 -p 192.168.100.32 -u
  iscsiadm -m node -T iqn.2018-5.mynet:drbd0 -p 192.168.100.32 -u


 
=== Show session id ===
iscsiadm -m session -P 1
 
=== Rescan ?? ===


===Show new size of target===
  iscsiadm -m node --targetname="foo.bar" -R
  iscsiadm -m node --targetname="foo.bar" -R


===Disconnect all targets===
=== Disconnect all targets ===
 
  iscsiadm --mode node -u all
  iscsiadm --mode node -u all


=== Rescan session ===
iscsiadm -m session -r SID --rescan⁠
===iscsiadm: Could not log into all portals===
??


== On server ==


==On server==
=== list targets ===


===list targets===
  tgtadm --lld iscsi --mode target --op show
  tgtadm --lld iscsi --mode target --op show


=== list connected targets ===
To list all connections to target with id 1:
tgtadm --lld iscsi --mode conn --op show --tid 1


And disconnect target:
And disconnect target:
  tgtadm --lld iscsi --op delete --mode conn --tid 1 --sid 2 --cid 0
  tgtadm --lld iscsi --op delete --mode conn --tid 1 --sid 2 --cid 0


===Reload tgtd===
=== Create iscsi target and Lun ===
 
tgtadm --lld iscsi --mode target --op new --tid=1 --targetname iqn.2009-02.com.example:for.all
tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /var/tmp/iscsi-disk1
 
=== Delete iscsi target and Lun ===
 
tgtadm --lld iscsi --mode logicalunit --op delete --tid 1 --lun 1
tgtadm --lld iscsi --mode target --op delete --tid=1
 
=== Reload tgtd configuration ===
 
  tgt-admin --update ALL
  tgt-admin --update ALL
   
 
===Show tgdt config===
or
 
  tgt-admin --update your.irqn.string
 
=== Show tgdt config ===
 
  tgt-admin --dump
  tgt-admin --dump


=== Grow/resize target ===
After resizing the target (lvresize or whatever)
tgt-admin --update tid=xx -v -f
==Show targets==
tgt-admin -s




==The disk contains an unclean file system (0, 0).==
===Show target config===
This includes target parameters
tgtadm --lld iscsi -o show -m target --tid=1
 
===The disk contains an unclean file system (0, 0).===
<pre>
<pre>
Metadata kept in Windows cache, refused to mount.
Metadata kept in Windows cache, refused to mount.
Line 72: Line 147:
  storage core adapter rescan --adapter=vmhba
  storage core adapter rescan --adapter=vmhba
  esxcli iscsi adapter discovery rediscover --adapter vmhba64
  esxcli iscsi adapter discovery rediscover --adapter vmhba64
esxcli iscsi adapter param get -A vmhba64
== Error messages ==
=== connection1:0: detected conn error (1020) ===
These messages are seen when an iSCSI connection times out (1011 means timeout on initiator side and 1020 means the target dropped the connection)
=== tgtadm: failed to send request hdr to tgt daemon, Transport endpoint is not connected ===
tgtd not running&nbsp;:)
&nbsp;
=== tgtd: iser_ib_init(3436) Failed to initialize RDMA; load kernel modules? ===
comment out default-driver
&nbsp;
=== iscsiadm: No portals found ===
ACL issue, try something like
tgtadm --lld iscsi --op bind --mode target --tid 6 -I ALL
&nbsp;
=== iscsiadm: No records found ===
Try
iscsiadm -m discovery -t sendtargets -p <ip-address>

Revision as of 16:16, 7 November 2021


Links

FAQ

On ISCSI client

Find targets

iscsi_discovery 192.168.100.32
    

Please logout from all targets on 192.168.178.3:3260 before trying to run discovery on that portal

??

List connected targets

iscsiadm -m session -P 3

which seems to list only one, for multiple:

tgtadm --lld iscsi --op show --mode conn --tid 1

but that needs more work

List targets

iscsiadm -m discovery -t sendtargets -p 192.168.100.32

Connect to target

iscsiadm -m node --targetname="iqn.2018-5.mynet:drbd0" --portal "192.168.100.32" --login

if you get things like "iscsiadm: No records found" try a thing like

iscsiadm --mode node -l all

iscsiadm: Could not log into all portals:


Disconnect from target

iscsiadm -m node -T iqn.2018-5.mynet:drbd0 -p 192.168.100.32 -u

 

Show session id

iscsiadm -m session -P 1

 

Rescan ??

iscsiadm -m node --targetname="foo.bar" -R

Disconnect all targets

iscsiadm --mode node -u all

Rescan session

iscsiadm -m session -r SID --rescan⁠


iscsiadm: Could not log into all portals

??

On server

list targets

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


list connected targets

To list all connections to target with id 1:

tgtadm --lld iscsi --mode conn --op show --tid 1

And disconnect target:

tgtadm --lld iscsi --op delete --mode conn --tid 1 --sid 2 --cid 0

Create iscsi target and Lun

tgtadm --lld iscsi --mode target --op new --tid=1 --targetname iqn.2009-02.com.example:for.all
tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /var/tmp/iscsi-disk1

Delete iscsi target and Lun

tgtadm --lld iscsi --mode logicalunit --op delete --tid 1 --lun 1
tgtadm --lld iscsi --mode target --op delete --tid=1

Reload tgtd configuration

tgt-admin --update ALL

or

tgt-admin --update your.irqn.string

Show tgdt config

tgt-admin --dump


Grow/resize target

After resizing the target (lvresize or whatever)

tgt-admin --update tid=xx -v -f

Show targets

tgt-admin -s


Show target config

This includes target parameters

tgtadm --lld iscsi -o show -m target --tid=1

The disk contains an unclean file system (0, 0).

Metadata kept in Windows cache, refused to mount.
Falling back to read-only mount because the NTFS partition is in an
unsafe state. Please resume and shutdown Windows fully (no hibernation
or fast restarting.)
ntfsfix /dev/sdc1

On ESXi

esxcli storage core path list
storage core adapter rescan --adapter=vmhba
esxcli iscsi adapter discovery rediscover --adapter vmhba64
esxcli iscsi adapter param get -A vmhba64


Error messages

connection1:0: detected conn error (1020)

These messages are seen when an iSCSI connection times out (1011 means timeout on initiator side and 1020 means the target dropped the connection)


tgtadm: failed to send request hdr to tgt daemon, Transport endpoint is not connected

tgtd not running :)

 

tgtd: iser_ib_init(3436) Failed to initialize RDMA; load kernel modules?

comment out default-driver

 

iscsiadm: No portals found

ACL issue, try something like

tgtadm --lld iscsi --op bind --mode target --tid 6 -I ALL

 

iscsiadm: No records found

Try

iscsiadm -m discovery -t sendtargets -p <ip-address>