• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Configure iSCSI targets on Solaris 10

by admin

iSCSI target feature has been available since s10u7. Here is some information for setting up a basic iSCSI target configuration. High level steps to follow are as shown below :

  1. create a base directory
  2. configure the backing store
  3. Creating a target
  4. Add ACL to target

1. create a base directory

The base directory is used to store the iSCSI target configuration data, and needs to be defined prior to using the iSCSI target for the first time. You can create a base directory with the iscistadm utility:

# iscsitadm modify admin -d /etc/iscsitargets
# iscsitadm show admin
iscsitadm:
Base Directory: /etc/iscsitargets
CHAP Name: Not set
RADIUS Access: Not set
RADIUS Server: Not set
iSNS Access: Not set
iSNS Server: Not set
Fast Write ACK: Not set

2. configure the backing store

The backing store contains the physical storage that is exported as a target.

# zpool create -f fredpool0 c1t1d0s0
# zpool create -f fredpool1 c1t1d0s1
# zpool list
NAME        SIZE   USED  AVAIL    CAP  HEALTH  ALTROOT
fredpool0    97M  95.5K  96.9M     0%  ONLINE  -
fredpool1    97M  95.5K  96.9M     0%  ONLINE  -
# zfs create -V 20m fredpool0/iscsivol000
# zfs create -V 20m fredpool0/iscsivol001
# zfs create -V 20m fredpool0/iscsivol002
# zfs create -V 20m fredpool1/iscsivol000
# zfs create -V 20m fredpool2/iscsivol001
# zfs create -V 20m fredpool3/iscsivol002

3. Creating a target

Once a backing store has been created, it can be exported as an iSCSI target with the iscsitadm “create” command:

# iscsitadm create target --lun 0 -b /dev/zvol/dsk/fredpool0/iscsivol000 host1-tgt0
# iscsitadm create target --lun 1 -b /dev/zvol/dsk/fredpool0/iscsivol001 host1-tgt0
# iscsitadm create target --lun 2 -b /dev/zvol/dsk/fredpool0/iscsivol002 host1-tgt0
# iscsitadm create target --lun 0 -b /dev/zvol/dsk/fredpool1/iscsivol000 host1-tgt1
# iscsitadm create target --lun 1 -b /dev/zvol/dsk/fredpool1/iscsivol001 host1-tgt1

or with zfs command,

# zfs set shareiscsi=on fredpool1/iscsivol002
# iscsitadm list target
Target: host1-tgt0
 iSCSI Name: iqn.1986-03.com.sun:02:e4933e5e-7500-c299-f9a7-aa1ab38a2a13.host1-tgt0
 Connections: 0
Target: host1-tgt1
 iSCSI Name: iqn.1986-03.com.sun:02:f2be2da9-baae-61bb-821d-c944daba5ac8.host1-tgt1
 Connections: 0

To see all LUNs attached to targets

# iscsitadm list target -v 
Target: host1-tgt0
 iSCSI Name: iqn.1986-03.com.sun:02:e4933e5e-7500-c299-f9a7-aa1ab38a2a13.host1-tgt0
 Connections: 0
 ACL list:
 TPGT list:
 LUN information:
     LUN: 0
         GUID: 0
         VID: SUN
         PID: SOLARIS
         Type: disk
         Size:   20M
         Backing store: /dev/zvol/dsk/fredpool0/iscsivol000
         Status: online
     LUN: 1
         GUID: 0
         VID: SUN
         PID: SOLARIS
         Type: disk
         Size:   20M
         Backing store: /dev/zvol/dsk/fredpool0/iscsivol001
         Status: online
     LUN: 2
         GUID: 0
         VID: SUN
         PID: SOLARIS
         Type: disk
         Size:   20M
         Backing store: /dev/zvol/dsk/fredpool0/iscsivol002
         Status: online
...

Note, to delete an iSCSI target just issue the following command :

# iscsitadm delete target --lun 0 host1-tgt4-lun0

4. Add ACL to target

Access control lists (ACLs) can be used to limit the node names that are allowed to access a target. To ease administration of ACLs, the target allows you to associate an alias with a node name (you can retrieve the node name of a Solaris[TM] initiator by running the iscsiadm utility with the “list” command, and “initiator-node” subcommand):

iqn from client

# iscsiadm list initiator-node
Initiator node name: iqn.1986-03.com.sun:01:0003ba16c09d.44a13be0
Initiator node alias: -
   Login Parameters (Default/Configured):
           Header Digest: NONE/-
           Data Digest: NONE/-
   Authentication Type: NONE
   RADIUS Server: NONE
   RADIUS access: unknown
   Configured Sessions: 1

alias creation for clients on iSCSI server (optional)

# iscsitadm create initiator -n iqn.1986-03.com.sun:01:0003ba16c09d.44a13be0 blade2000

Note, to delete an initiator from iSCSI target perspective, use this :

# iscsitadm delete initiator -A blade2000

Note, to list current initiators from iSCSI target perspective, use this :

# iscstadm list initiator
Initiator: blade2000
   iSCSI Name: iqn.1986-03.com.sun:01:0003ba16c09d.44a13be0
   CHAP Name: Not set

add hosts (alias) to iSCSI target so that clients can use it

# iscsitadm modify target -l blade2000 superg host1-tgt0

(blade2000 and superg are iqn aliases)

Filed Under: Solaris, ZFS

Some more articles you might also be interested in …

  1. GUDS – A Script for Gathering Solaris Performance Data
  2. Solaris 10 patching with SVM : Traditional method (non-live upgrade)
  3. How to find zpool version and filesystem version in Solaris
  4. How to determine link status (up/down) of network interfaces in Solaris
  5. How to create or change or view Boot Device Aliases in Solaris Online
  6. How to collect XSCF snapshot on M-series servers (M3000 / M4000 / M5000 / M8000 / M9000)
  7. Solaris 11 IPS pkg Command Examples
  8. Solaris : how to truncate the wtmpx file
  9. M4000 / M5000 : How to assign IP address to XSCFU
  10. Examples of adding static routes in Solaris

You May Also Like

Primary Sidebar

Recent Posts

  • pw-cat Command Examples in Linux
  • pvs: command not found
  • pulseaudio: command not found
  • pulseaudio Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright