iSCSI SAN - Part 2: The Clients
By Brian Leonard on Dec 18, 2009
In part 1 of this blog I created an iSCSI storage target exposing 3 LUNs: one each intended for OpenSolaris, Linux and Windows clients. In this entry I'll set up the clients (initiators) to connect to those LUNs.
For this exercise, we'll be using static discovery, which means you already know the IP address of the storage server.
Step 1: Install the iSCSI Management Utilities
bleonard@os200906:~$ pfexec pkg install SUNWiscsi DOWNLOAD PKGS FILES XFER (MB) Completed 1/1 8/8 0.26/0.26 PHASE ACTIONS Install Phase 35/35
A reboot is necessary because of this defect (which has also been fixed in the development builds):
bleonard@os200906:~$ pfexec reboot
Step 2: Configure Static Initiation
For this you will need the target name and IP address of the storage server. The target name was created in the last step of Part 1, which I'm repeating here for your convenience (note, this command is run on the server, not the client):
bleonard@os200906:~$ pfexec itadm list-target TARGET NAME STATE SESSIONS iqn.1986-03.com.sun:02:7de26418-fe5e-c386-a457-e0e06a16d723 online 0
Using the target name and IP address, we can now configure static initiation on the client using the iSCSI Initiator Administration utility, iscsiadm.
bleonard@os200906:~$ pfexec iscsiadm add static-config iqn.1986-03.com.sun:02:7de26418-fe5e-c386-a457-e0e06a16d723,10.0.1.13
You can then list the static configuration as follows:
bleonard@os200906:~$ pfexec iscsiadm list static-config Static Configuration Target: iqn.1986-03.com.sun:02:7de26418-fe5e-c386-a457-e0e06a16d723,10.0.1.13:3260
Step 3: Configure Discovery
The next step is to indicate how the iSCSI target will be discovered. There are 2 dynamic options (Send Targets and iSNS) and a static option:
bleonard@os200906:~$ pfexec iscsiadm list discovery Discovery: Static: disabled Send Targets: disabled iSNS: disabled
We will be using the static option:
bleonard@os200906:~$ pfexec iscsiadm modify discovery --static enable bleonard@os200906:~$ pfexec iscsiadm list discovery Discovery: Static: enabled Send Targets: disabled iSNS: disable
And now you can successfully list the target:
bleonard@os200906:~$ pfexec iscsiadm list target Target: iqn.1986-03.com.sun:02:7de26418-fe5e-c386-a457-e0e06a16d723 Alias: - TPGT: 1 ISID: 4000002a0000 Connections: 1
Step 4: View the Disks
As mentioned in part 1, once set up, the targets will appear to the system as locally attached devices. For example, running the format command will show the following:
bleonard@os200906:~$ pfexec format Searching for disks...done AVAILABLE DISK SELECTIONS: 0. c0t600144F01EA8050000004B17FC0A0001d0 <DEFAULT cyl 297 alt 2 hd 64 sec 32> /scsi_vhci/disk@g600144f01ea8050000004b17fc0a0001 1. c0t600144F01EA8050000004B17FC0F0002d0 <DEFAULT cyl 297 alt 2 hd 64 sec 32> /scsi_vhci/disk@g600144f01ea8050000004b17fc0f0002 2. c0t600144F01EA8050000004B17FC120003d0 <DEFAULT cyl 297 alt 2 hd 64 sec 32> /scsi_vhci/disk@g600144f01ea8050000004b17fc120003 3. c7d0 <DEFAULT cyl 4174 alt 2 hd 255 sec 63> /pci@0,0/pci-ide@1,1/ide@0/cmdk@0,0 Specify disk (enter its number):
Note the 3 volumes are identifiable by their GUID / LU Name. Again, ideally here the view in part 1 would have been configured to only show the volume that was created for use by OpenSolaris (disk 0 in the output above).
Step 5: Use the Disk
The next step is to simply create a ZFS pool and file system as we would do with any locally attached disk:
bleonard@os200906:~$ pfexec zpool create mypool c0t600144F01EA8050000004B17FC0A0001d0 bleonard@os200906:~$ zpool list mypool NAME SIZE USED AVAIL CAP HEALTH ALTROOT mypool 286M 112K 286M 0% ONLINE - bleonard@os200906:~$ zfs list NAME USED AVAIL REFER MOUNTPOINT mypool 71.5K 254M 19K /mypool rpool 5.03G 26.2G 81K /rpool rpool/ROOT 3.68G 26.2G 19K legacy rpool/ROOT/opensolaris 10.6M 26.2G 2.97G / rpool/ROOT/opensolaris-1 3.67G 26.2G 3.20G / rpool/dump 511M 26.2G 511M - rpool/export 362M 26.2G 21K /export rpool/export/home 362M 26.2G 21K /export/home rpool/export/home/bleonard 362M 26.2G 362M /export/home/bleonard rpool/swap 512M 26.6G 137M - bleonard@os200906:~$ pfexec mkfile 100M /mypool/big_file bleonard@os200906:~$ zpool list mypool NAME SIZE USED AVAIL CAP HEALTH ALTROOT mypool 286M 91.9M 194M 32% ONLINE -
Back on the storage server:
bleonard@os200906:~$ zpool list san_pool NAME SIZE USED AVAIL CAP HEALTH ALTROOT san_pool 1008M 103M 905M 10% ONLINE -
You should find the iSCSI Initiator in the Control Panel. Switch to the Discovery tab and add the Target Portal:
Then switch to the Targets tab and Log On to the target:
After which the status should show Connected:
Click the Details button to see the Target Properties and available devices. This is equivalent to running the format command in OpenSolaris:
However, you have to click on the Advanced tab to see the details for each device. Here we're looking for the LUN that we created for Windows, which is LUN 2:
You can right-click the disks to view their properties and find the disk associated with LUN 2, which in my case is Disk 3:
Then right-click the disk again and select Initialize Disk (click on the words "Not Initialized". Right-clicking on the white space where it says "Unallocated" will not bring up the same context menu). Select the proper disk to initialize:
Once the disk is initialized (it's state will change to "Online"), right-click the white-space where is says "Unallocated" and select "New Partition...", which will start the New Partition Wizard:
Once you complete the New Partition Wizard, the drive will be available for use:
Back on the OpenSolaris storage server, you can get additional information about the clients connected to the target:
bleonard@os200906:~$ pfexec stmfadm list-target -v Target: iqn.1986-03.com.sun:02:7de26418-fe5e-c386-a457-e0e06a16d723 Operational Status: Online Provider Name : iscsit Alias : - Sessions : 1 Initiator: iqn.1991-05.com.microsoft:windowsxp Alias: - Logged in since: Thu Dec 17 19:09:46 2009
Linux and Mac OS Clients
For Max OS X, globanSAN provides a free initiator, although I haven't tried it yet myself.
Finally, if you get stuck or have further questions, I recommend you visit the storage discuss forum at OpenSolaris.org.