> Networked Storage with iSCSI
Tribblix supports iSCSI as a way to present block storage over a network. (As opposed to file system access using SMB or NFS, for example.)
What this allows you to do is to take a chunk of disk space from one server, and present it to another system which can use it like any other disk device.
Here I give a worked example of a trivial setup on both the server and client. The Simple setups here lack security measures and permissions so shouldn't be used for production.
Simple server setup
First install the required packages.
zap install TRIBdrv-net-ib TRIBnet-iscsi-iser \ TRIBsys-lib-storage-ima TRIBsys-lib-storage-ima-header \ TRIBnet-iscsi-target TRIBnet-iscsi-initiator TRIBstorage-stmf
Then you'll need to reboot for some of the drivers to become fully active.
You'll need to have the appropriate SMF services running.
svcadm enable -s system/stmf svcadm enable -s iscsi/target
Then create a ZFS volume of the desired size - the -V
argument used in this example sets the size to 2GB.
zfs create -V 2g rpool/vol1
Then use stmfadm to create a Logical Unit (LU) based on that ZFS volume.
stmfadm create-lu /dev/zvol/rdsk/rpool/vol1
it will report the name of the LU, which you'll need later, for example
Logical unit created: 600144F02C7382150000691DE15C0001
Now you need to create a view. In real-world use you would restrict
access using the -h (host group) and -t (target
group) flags, omitting them simply means everything can see it. Without
the -n flag the code will choose the LUN for you too. Use
the LU identifier you got in the previous command.
stmfadm add-view 600144F02C7382150000691DE15C0001
You can look at the view and its properties:
stmfadm list-view -l 600144F02C7382150000691DE15C0001
And then you need to create a target group.
stmfadm create-tg mytarget
And then you need to create the target. We now switch to using the itadm command.
itadm create-target
It will give you the name of the target it created, which you will need when setting up the client. Or you can list the target with:
itadm list-target -v
Which will look something like:
TARGET NAME STATE SESSIONS
iqn.2010-08.org.illumos:02:0b5963ab-8a33-4e3e-aee5-599b37388726 online 0
alias: -
auth: none (defaults)
targetchapuser: -
targetchapsecret: unset
tpg-tags: default
Simple client setup
First install the required packages.
zap install TRIBdrv-net-ib TRIBnet-iscsi-iser \ TRIBsys-lib-storage-ima TRIBsys-lib-storage-ima-header \ TRIBnet-iscsi-target TRIBnet-iscsi-initiator TRIBstorage-stmf
Then you'll need to reboot for some of the drivers to become fully active.
The initiator service should be enabled automatically.
Client configuration uses the iscsiadm command.
The simplest method is to use static configuration, for which you need the long name of the target and the IP address of the server.
iscsiadm add static-config iqn.2010-08.org.illumos:02:0b5963ab-8a33-4e3e-aee5-599b37388726,10.10.10.21
You can check that with:
iscsiadm list static-config
And then you need to tell the system that it needs to use the static discovery method to find devices:
iscsiadm modify discovery --static enable
That should be enough, so if you go into format you should be able to see the new disk:
# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c0t600144F02C7382150000691DE15C0001d0 <SUN-COMSTAR-1.0 cyl 1022 alt 2 hd 128 sec 32>
/scsi_vhci/disk@g600144f02c7382150000691de15c0001
Then you can take that disk and create a ZFS pool using it:
zpool create tank /dev/rdsk/c0t600144F02C7382150000691DE15C0001d0