Unit 3 - iSCSI Configuration

The IQN string format:
iqn.<date_code>.<reversed_domain>.<string>[:<substring>]
The IQN sub-fields:
Required type designator (iqn)
Date code (yyyy-mm)
Reversed domain name (tld.domain)
Any string guaranteeing uniqueness (string[[.string]...])
Optional colon-delimited sub-group string ([:substring])
Example:
     iqn.2007-01.com.example.sales:sata.rack2.disk1

tgtadm --lld iscsi --mode target --op new --tid 1 --targetname iqn.2012-04.com.vmware.oracledb:nas.sda5
tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 --backing-store /dev/sda5
tgtadm --lld iscsi --mode target --op bind --tid 1 --initiator-address 192.168.0.0/16

history |tail -n 4 >> /etc/rc.d/rc.local

tgtadm --lld iscsi --mode target --op show
iscsiadm --mode discoverydb --type sendtargets --portal 192.168.142.4 --discover
iscsiadm --mode discovery --type sendtargets --portal 192.168.142.4:3260
    192.168.142.4:3260,1 iqn.2012-04.com.vmware.oracledb:nas.sda5
iscsiadm --mode node --targetname iqn.2012-04.com.vmware.oracledb:nas.sda5 --portal 192.168.142.4:3260 --login
iscsiadm --mode node
iscsiadm --mode node --targetname iqn.2012-04.com.vmware.oracledb:nas.sda5 --portal 192.168.142.4:3260
iscsiadm --mode node --targetname iqn.2006-01.com.openfiler:tsn.b286272ef535 --portal 192.168.142.2:3260
iscsiadm --mode node --targetname iqn.2012-04.com.vmware.oracledb:nas.sda5 --portal 192.168.142.4:3260 --logout

iscsiadm --mode node --op delete --targetname iqn.2012-04.com.vmware.oracledb:nas.sda5 --portal 192.168.142.4:3260

[root@rhel57 device]# iscsiadm --help
iscsiadm -m discovery2 [ -hV ] [ -d debug_level ] [-P printlevel] [ -t type -p ip:port -I ifaceN ... [ -Dl ] ] | [ [ -p ip:port -t type] [ -o operation ] [ -n name ] [ -v value ] [ -lD ] ]
iscsiadm -m discovery [ -hV ] [ -d debug_level ] [-P printlevel] [ -t type -p ip:port -I ifaceN ... [ -l ] ] | [ [ -p ip:port ] [ -l | -D ] ]
iiscsiadm -m node [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -L all,manual,automatic ] [ -U all,manual,automatic ] [ -S ] [ [ -T targetname -p ip:port -I ifaceN ] [ -l | -u | -R | -s] ] [ [ -o  operation  ] [ -n name ] [ -v value ] ]
iscsiadm -m session [ -hV ] [ -d debug_level ] [ -P  printlevel] [ -r sessionid | sysfsdir [ -R | -u | -s ] [ -o operation ] [ -n name ] [ -v value ] ]
iscsiadm -m iface [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -I ifacename ] [ [ -o  operation  ] [ -n name ] [ -v value ] ]
iscsiadm -m fw [ -l ]
iscsiadm -m host [ -P printlevel ] [ -H hostno ]
iscsiadm -k priority

EXAMPLES
       Discover targets at a given IP address:

            iscsiadm --mode discoverydb --type sendtargets --portal 192.168.1.10 --discover

       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

 

[root@oracledb ~]# tgtadm --help
Usage: tgtadm [OPTION]
Linux SCSI Target Framework Administration Utility, version 1.0.14
tgtadm --lld iscsi --mode target --op new --tid 1 --targetname iqn.<date_code>.<reversed_domain>.<string>[:<substring>] (iqn.2007-01.com.example.sales:sata.rack2.disk1)
tgtadm --lld iscsi --mo

  --lld <driver> --mode target --op new --tid <id> --targetname <name>
                        add a new target with <id> and <name>. <id> must not be zero.
  --lld <driver> --mode target --op delete --tid <id>
                        delete the specific target with <id>. The target must
                        have no activity.
  --lld <driver> --mode target --op show
                        show all the targets.
  --lld <driver> --mode target --op show --tid <id>
                        show the specific target's' parameters.
  --lld <driver> --mode target --op update --tid <id> --name <param> --value <value>
                        change the target parameters of the specific
                        target with <id>.
  --lld <driver> --mode target --op bind --tid <id> --initiator-address <src>
                        enable the target to accept the specific initiators.
  --lld <driver> --mode target --op unbind --tid <id> --initiator-address <src>
                        disable the specific permitted initiators.
  --lld <driver> --mode logicalunit --op new --tid <id> --lun <lun> \
                        --backing-store <path> --bstype <type> --bsoflags <options>
                        add a new logical unit with <lun> to the specific
                        target with <id>. The logical unit is offered
                        to the initiators. <path> must be block device files
                        (including LVM and RAID devices) or regular files.
                        bstype option is optional.
                        bsoflags supported options are sync and direct
                        (sync:direct for both).
  --lld <driver> --mode logicalunit --op delete --tid <id> --lun <lun>
                        delete the specific logical unit with <lun> that
                        the target with <id> has.
  --lld <driver> --mode account --op new --user <name> --password <pass>
                        add a new account with <name> and <pass>.
  --lld <driver> --mode account --op delete --user <name>
                        delete the specific account having <name>.
  --lld <driver> --mode account --op bind --tid <id> --user <name> [--outgoing]
                        add the specific account having <name> to
                        the specific target with <id>.
                        <user> could be <IncomingUser> or <OutgoingUser>.
                        If you use --outgoing option, the account will
                        be added as an outgoing account.
  --lld <driver> --mode account --op unbind --tid <id> --user <name>
                        delete the specific account having <name> from specific
                        target.
  --control-port <port> use control port <port>
  --help                display this help and exit

Report bugs to <[email protected]>.
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章