3. Centos 6 - iSCSI

最後更新: 2017-11-21

 


Centos6 - initiator

 

安裝

yum install iscsi-initiator-utils

設定檔:

/etc/iscsi/iscsid.conf

Scripts:

/etc/rc.d/init.d/iscsi
/etc/rc.d/init.d/iscsid

BIN:

/sbin/iscsiadm - open-iscsi administration utility

/sbin/iscsid - Open-iSCSI daemon

/sbin/iscsi-iname - iSCSI initiator name generation tool

/sbin/iscsistart - iSCSI boot tool

/sbin/iscsiuio - iSCSI UserSpace I/O driver (driver for the Broadcom NetXtreme II )

/var/lib/iscsi

  • /var/lib/iscsi/ifaces
  • /var/lib/iscsi/isns
  • /var/lib/iscsi/nodes - This directory contains the nodes with their targets.
  • /var/lib/iscsi/send_targets - This directory contains the portals.
  • /var/lib/iscsi/slp
  • /var/lib/iscsi/static

 



Centos6 - iscsiadm (Client)

 

# Check version

iscsiadm -V

iscsiadm version 6.2.0-873.10.el6

# Usage:

mode: (-m)

  • discovery
  • node
  • session

# Discover targets at a given IP address:

iscsiadm --mode discovery --type sendtargets --portal 192.168.0.2

iscsiadm -m discovery -t st -p 192.168.0.2

# Login, must use a node record id found by the discovery:

            iscsiadm --mode node --targetname iqn.2001-05.com.doe:test --portal 192.168.1.1:3260 --login

# Logout:

            iscsiadm --mode node --targetname iqn.2001-05.com.doe:test --portal 192.168.1.1:3260 --logout

# List node records:

            iscsiadm --mode node

# Display all data for a given node record:

            iscsiadm --mode node --targetname iqn.2001-05.com.doe:test --portal 192.168.1.1:3260

# auto mount

/dev/sdb1 /mnt/logs ext3 defaults,auto,_netdev 0 0

opts:

ping:

-a, --ip=ipaddr
-c, --count=count

-H, --host=[hostno|MAC]
-I, --interface=[iface]   <-- /var/lib/iscsi/ifaces

-l, --login
-u, --logout
-m, --mode op
-p, --portal=ip[:port]
-T, --targetname=targetname
-s, --stats
-S, --show

# only valid for discovery mode.
-t, --type=type (st, isns or fw)

st (SendTargets)

A native iSCSI protocol which allows each iSCSI target to send a list of available  targets  to the initiator.

isns (Internet Storage Name Service)

records information about storage volumes within a larger network.

fw

Several  NICs and systems contain a mini iSCSI initiator which can be used for boot.
To get the values used for boot the fw option can be used.

EXIT STATUS

0      ISCSI_SUCCESS - command executed successfully.
5      ISCSI_ERR_LOGIN - generic iSCSI login failure.