The Common Multiprotocol SCSI Target (COMSTAR) software framework enables you to convert any Oracle Solaris host into a SCSI target device that can be accessed over a storage network by initiator hosts. You can create and configure a ZFS volume to be shared as an iSCSI logical unit (LUN).
First, install the COMSTAR package.
# pkg install group/feature/storage-server
Next, create a ZFS volume to be used as an iSCSI target and then create the SCSI-block-device-based LUN. For example:
# zfs create -V 2g tank/volumes/v2 # sbdadm create-lu /dev/zvol/rdsk/tank/volumes/v2 Created the following LU: GUID DATA SIZE SOURCE -------------------------------- ------------------- ---------------- 600144f000144f1dafaa4c0faff20001 2147483648 /dev/zvol/rdsk/tank/volumes/v2 # sbdadm list-lu Found 1 LU(s) GUID DATA SIZE SOURCE -------------------------------- ------------------- ---------------- 600144f000144f1dafaa4c0faff20001 2147483648 /dev/zvol/rdsk/tank/volumes/v2
You can expose the LUN views to all clients or selected clients. Identify the LUN GUID and then share the LUN view. In the following example, the LUN view is shared to all clients.
# stmfadm list-lu LU Name: 600144F000144F1DAFAA4C0FAFF20001 # stmfadm add-view 600144F000144F1DAFAA4C0FAFF20001 # stmfadm list-view -l 600144F000144F1DAFAA4C0FAFF20001 View Entry: 0 Host group : All Target group : All LUN : 0
The next step is to create the iSCSI targets. For information about creating the iSCSI targets, see Chapter 8, Configuring Storage Devices With COMSTAR, in Managing Devices in Oracle Solaris 11.2 .
A ZFS volume as an iSCSI target is managed just like any other ZFS dataset, except that you cannot rename the dataset, roll back a volume snapshot, or export the pool while the ZFS volumes are shared as iSCSI LUNs. You will see messages similar to the following:
# zfs rename tank/volumes/v2 tank/volumes/v1 cannot rename 'tank/volumes/v2': dataset is busy # zpool export tank cannot export 'tank': pool is busy
All iSCSI target configuration information is stored within the dataset. Like an NFS shared file system, an iSCSI target that is imported on a different system is shared appropriately.