Iscsi: Difference between revisions
m →FAQ Tag: wikieditor |
Tag: wikieditor |
||
| (13 intermediate revisions by the same user not shown) | |||
| Line 12: | Line 12: | ||
*https://www.truenas.com/community/resources/why-iscsi-often-requires-more-resources-for-the-same-result.41/ | *https://www.truenas.com/community/resources/why-iscsi-often-requires-more-resources-for-the-same-result.41/ | ||
*[https://linuxhint.com/share-zfs-volumes-via-iscsi/ Share ZFS volumes via iscsi] | *[https://linuxhint.com/share-zfs-volumes-via-iscsi/ Share ZFS volumes via iscsi] | ||
*[https://gist.github.com/albertomolina/6c621aee3f80c5e7baf3c111df670cf0 iSCSI server with tgt (cheatsheet)] | |||
=Terminology= | =Terminology= | ||
| Line 77: | Line 78: | ||
And there's [https://wiki.alpinelinux.org/wiki/Linux_iSCSI_Target_(tgt) tgt] | And there's [https://wiki.alpinelinux.org/wiki/Linux_iSCSI_Target_(tgt) tgt] | ||
=Tools= | |||
==lsscsi== | |||
=FAQ= | =FAQ= | ||
| Line 82: | Line 87: | ||
== On ISCSI client == | == On ISCSI client == | ||
===Get WWID=== | |||
/lib/udev/scsi_id -g -u -d /dev/sda | |||
===List sessions=== | ===List sessions=== | ||
iscsiadm -m session | iscsiadm -m session | ||
===List targets and SIDs=== | |||
iscsiadm -m session -P 3|egrep "Target|SID" | |||
=== what /dev/ disk is on the target? === | === what /dev/ disk is on the target? === | ||
Where 7 is SID | Where 7 is SID | ||
iscsiadm -m session -P 3 -r 7 | iscsiadm -m session -P 3 -r 7 | grep "Attached scsi disk" | ||
Attached scsi disk sde State: running | Attached scsi disk sde State: running | ||
Or look at | |||
ls /dev/disk/by-path/ | |||
=== Find targets === | === Find targets === | ||
| Line 124: | Line 139: | ||
=== Disconnect from target === | === 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 | ||
===Delete target=== | |||
iscsiadm -m node -T iqn.2018-5.mynet:drbd0 [-p 192.168.100.32] -o delete | |||
===Get a lot of info about target=== | ===Get a lot of info about target=== | ||
not working? | |||
iscsiadm -m node -T iqn.2018-5.mynet:drbd0 -p 192.168.100.32 | iscsiadm -m node -T iqn.2018-5.mynet:drbd0 -p 192.168.100.32 | ||
| Line 156: | Line 174: | ||
tgtadm --lld iscsi --mode target --op show | tgtadm --lld iscsi --mode target --op show | ||
NOTE check for '''LUN: 1''' or higher! | |||
=== list connected targets === | === list connected targets === | ||
| Line 169: | Line 188: | ||
tgtadm --lld iscsi --mode target --op new --tid=1 --targetname iqn.2009-02.com.example:for.all | tgtadm --lld iscsi --mode target --op new --tid=1 --targetname iqn.2009-02.com.example:for.all | ||
and then add device | |||
tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /var/tmp/iscsi-disk1 | tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /var/tmp/iscsi-disk1 | ||
| Line 271: | Line 291: | ||
iscsiadm -m discovery -t sendtargets -p <ip-address> | iscsiadm -m discovery -t sendtargets -p <ip-address> | ||
==Problems== | |||
===Lun:1 is lost=== | |||
Normally you expect to find on client | |||
scsi9 Channel 00 Id 0 Lun: 0 | |||
scsi9 Channel 00 Id 0 Lun: 1 | |||
Attached scsi disk sdc State: running | |||
if last two lines are missing: | |||
Check on server | |||
tgtadm --lld iscsi --mode target --op show | |||
you might find | |||
LUN: 1 | |||
... | |||
Backing store path: ... | |||
missing, so add that again: | |||
tgtadm --lld iscsi --op new --mode logicalunit --tid 4 --lun 1 -b /dev/zvol/tank/iscsi4 | |||
[[Category:Storage]] | [[Category:Storage]] | ||
Latest revision as of 12:00, 11 March 2026
Links
- http://nil.uniza.sk/linux-howto/linux-mint-mouting-freenas-iscsi-disk
- iscsiadm command examples
- Scsi-target-utils Quickstart Guide
- Creating and managing iSCSI targets
- https://wiki.archlinux.org/index.php/TGT_iSCSI_Target
- iSCSI on ESXCLI
- 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/
- targetcli
- https://www.truenas.com/community/resources/why-iscsi-often-requires-more-resources-for-the-same-result.41/
- Share ZFS volumes via iscsi
- iSCSI server with tgt (cheatsheet)
Terminology
multipath
Implementations
Features comparison between Linux SCSI targets
IET
iSCSI Enterprise Target
- ietd
- ietadm
- iscsitarget
- iscsid
LIO
- targetcli
SCST
iSCSI Target Driver
- scst
STGT
Predecessor of LIO
ISTGT
iSCSI Target
FreeBSD/Linux
- istgtcontrol and friends
Comstar
Commands:
- itadm
- stmfadm
TGT
Linux iSCSI Target
- tgtd
- tgdadm
open-iscsi
- iscsiadm?
FreeBSD
- iscsid
- iscsictl
And there's tgt
Tools
lsscsi
FAQ
On ISCSI client
Get WWID
/lib/udev/scsi_id -g -u -d /dev/sda
List sessions
iscsiadm -m session
List targets and SIDs
iscsiadm -m session -P 3|egrep "Target|SID"
what /dev/ disk is on the target?
Where 7 is SID
iscsiadm -m session -P 3 -r 7 | grep "Attached scsi disk"
Attached scsi disk sde State: running
Or look at
ls /dev/disk/by-path/
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
iscsiadm -m session -P 3 | grep -E "^Target|SID:|Attached"
or ??
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
Disconnect from target
iscsiadm -m node -T iqn.2018-5.mynet:drbd0 [-p 192.168.100.32] -u
Delete target
iscsiadm -m node -T iqn.2018-5.mynet:drbd0 [-p 192.168.100.32] -o delete
Get a lot of info about target
not working?
iscsiadm -m node -T iqn.2018-5.mynet:drbd0 -p 192.168.100.32
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
not right?
iscsiadm -m session -r SID --rescan
iscsiadm: Could not log into all portals
??
On server
list targets
tgtadm --lld iscsi --mode target --op show
NOTE check for LUN: 1 or higher!
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
and then add device
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
Mounting iscsi datastore
esxcfg-volume -l
esxcfg-volume -m
List connected targets
esxcli iscsi session list
Do the iSCSI Discovery for the iSCSI Host Bus Adapter.
esxcli iscsi adapter discovery rediscover --adapter vmhba64
List targets
esxcli iscsi adapter target list
Some commands
esxcli storage core path list esxcli storage core adapter rescan --adapter=vmhba64
esxcli iscsi adapter param get -A vmhba64 esxcli iscsi adapter list
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>
Problems
Lun:1 is lost
Normally you expect to find on client
scsi9 Channel 00 Id 0 Lun: 0
scsi9 Channel 00 Id 0 Lun: 1
Attached scsi disk sdc State: running
if last two lines are missing: Check on server
tgtadm --lld iscsi --mode target --op show
you might find
LUN: 1 ... Backing store path: ...
missing, so add that again:
tgtadm --lld iscsi --op new --mode logicalunit --tid 4 --lun 1 -b /dev/zvol/tank/iscsi4
