If you’re used to the streamlined, straightforward method of creating iSCSI targets with Solaris you may have been a little perplexed to see an error something like this:
# cannot set property for ‘tank/iscsi/vol001′: invalid property ‘shareiscsi’
This is because the mechanism for creating and manipulating iSCSI has changed significantly in recent versions of Solaris. I’m not sure why the original syntax wasn’t retained, but nevertheless, you can still achieve the same result with the following sequence:
- Install the new COMSTAR package:
# pkg install pkg:/storage-server
- Create your zfs volume as usual
# zfs create -V 200G tank/iscsi/vol001
This will create a 200Gb volume in the “tank” pool of type ‘volume’ (not ‘filesystem’)
- Using the new sbdadm(1M) command, create a new logical unit based on the volume you just created:
# sbdadm create-lu /dev/zvol/rdsk/tank/iscsi/v001
Created the following LU:
GUID DATA SIZE SOURCE
-------------------------------- ------------------- ----------------
600144f01cfe070000004e3df8200001 214748364800 /dev/zvol/rdsk/tank/iscsi/v001
- Using the new stmfadm(1M) command, verify that you now have a logical unit available:
# stmfadm list-lu -v 600144F01CFE070000004E3DF8200001 LU Name: 600144F01CFE070000004E3DF8200001 Operational Status: Online Provider Name : sbd Alias : /dev/zvol/rdsk/tank/iscsi/v001 View Entry Count : 1 Data File : /dev/zvol/rdsk/tank/iscsi/v001 Meta File : not set Size : 214748364800 Block Size : 512 Management URL : not set Vendor ID : OI Product ID : COMSTAR Serial Num : not set Write Protect : Disabled Writeback Cache : Enabled Access State : Active
- Add a view to the newly created object, otherwise we won’t be able to do anything with it
# stmfadm add-view 600144F01CFE070000004E3DF8200001
- Turn on the required service, if you haven’t already.
svcadm enable -r svc:/network/iscsi/target:default
- FINALLY you can now create the iSCSI target:
# itadm create-target Target iqn.1986-03.com.sun:02:1cfef154-fa27-4f03-de2d-946adda9eea4 successfully created
So there you go. Nowhere near as simple as setting a property on a ZFS filesystem, but you can eventually achieve the same result.
Summary:
- Create volume
- Create a scsi block device, using the newly-created volume as a backing store.
- Create a logical unit using the previously created block device
- Add a ‘view’ to the logical unit (think of this as making it visible to outsiders – giving them a ‘view’)
- Create an iSCSI target
Simple, eh? :/