iscsi notes

iscsi target

  • Install iscsi utils:
    yum install scsi-target-utils
  • Bring up tgtd:
    chkconfig tgtd on
    service tgtd start
  • Define an iscsi target name:
    # tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.2012-10.com.linuxweblog.srv01:lv1_iscsi0
  • Delete specific iscsi target:
    # tgtadm --lld iscsi --op delete --mode target --tid 1
  • Add a logical unit to the target:
    # tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/vg1/lv1_iscsi0
  • Delete logical unit:
    # tgtadm --lld iscsi --op delete --mode logicalunit --tid 1 --lun 1
  • Enable the target to accept any initiators:
    # tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
  • View configuration:
    # tgtadm --lld iscsi --op show --mode target
  • Save the tgt conf:
    # tgt-admin --dump >/etc/tgt/targets.conf

iscsi initiator

  • install the initiator client:
    # yum install iscsi-initiator-utils
  • startup the iscsi daemon so all kernel modules get loaded:
    # chkconfig iscsid on
    # chkconfig iscsi on
    # service iscsid start
  • Discover targets:
    # iscsiadm --mode discovery --type sendtargets --portal 192.168.1.11
  • Login to target:
    # service iscsi restart
  • To manually login:
    # iscsiadm --mode node --targetname iqn.2012-10.com.linuxweblog.srv01:lv1_iscsi0 --portal 192.168.1.11 --login
  • To manually logout:
    # iscsiadm --mode node --targetname iqn.2012-10.com.linuxweblog.srv01:lv1_iscsi0 --portal 192.168.1.11 --logout
  • To delete targets:
    # iscsiadm --mode node --targetname iqn.2012-10.com.linuxweblog.srv01:lv1_iscsi0 --portal 192.168.1.11 -o delete
  • List sessions:
    # iscsiadm -m session
  • List nodes:
    # iscsiadm -m node

References:

  • http://www.cyberciti.biz/tips/howto-setup-linux-iscsi-target-sanwith-tgt.html
  • http://www.cyberciti.biz/tips/rhel-centos-fedora-linux-iscsi-howto.html
  • http://knowledgelayer.softlayer.com/questions/265/Can+I+connect+multiple+servers+to+a+single+iSCSI+LUN%3F
  • http://prefetch.net/blog/index.php/2009/04/12/configuring-the-open-iscsi-initiator-on-centos-linux-hosts/
Comment