Set up a base directory for the daemon to use. For each target and logical unit created the daemon needs to store some information. By default the backing store for this device will also be located within the base directory. So, if the host system has a large ZFS pool to use it may be easiest and desirable to allow the daemon to store everything in that location. It the backing store needs to be spread out it's possible during the creation of each logical unit to specify the backing store location.
iscsitadm modify admin -d <directory>
Create target. By default the CLI assumes the requested device type will be a LBA and that of logical unit 0. If a pass through mode is desired for character devices a —type raw must be used. After the creation of the first LU other LUs maybe created for the same iSCSI target by specifying —lun <number>. The daemon will start a background task which will initialize the LU to zeros. If during that initialization the underlying file system becomes 100% full the daemon will remove the target. During this initialization the LU is marked as being offline and can't be used by an initiator. It is possible during this time however to have an initiator discover this LU. The Solaris initiator will wait until it receives an "Inventory Change" notification and then automatically bring the device online.
iscsitadm create target —size 2g sandbox
To display information about the target use the list command.
# iscsitadm list target -v sandbox
Target: sandbox
iSCSI Name: iqn.1986-03.com.sun:02:baf448cc-8183-4d06-a609-b6751ac8ed2e.sandbox
Connections: 0
ACL list:
TPGT list:
LUN information:
LUN: 0
GUID: 010000e08155330700002a0044627ddc
VID: SUN
PID: SOLARIS
Type: disk
Size: 500M
Status: online
At this point you will be able to set up an initiator which can discover and use this target.