Providing a Nexenta iSCSI target to an ESXi initiator

       624 words, 3 minutes

Here’s the deal: create a ZFS volume on the Nexenta server, share it as iSCSI and attach it using the software iSCSI initiator from ESXi 5.

Enable the ESXi’s iSCSI initiator

Connect to the ESXi using the vSphere client. From the “Configuration” tab, in the “Hardware” section, select the “Storage Adapters” option. If you don’t already have an iSCSI initiator, click the “Add…” button and select “Add Software iSCSI Adapter”.

Once the initiator is created, right-click on it and select the “Properties…” option. From the “Configure” button, you can enable/disable it and set a easy-to-call alias.

That’s done. Now, let’s share space.

Create the Nexenta’s iSCSI target

Connect to the Nexenta NMV using your Web browser. Log-in and select the “Data Management” tab. From the “Zvols” section, click the “Create” link to “Create a new zvol (virtual block device)”. Select the “Volume” and fill-in the “Name”, “Description” and “Size”. To use thin provisioning, AKA sparse volume, select “No” for the “Initial Reservation” option. Enable whatever option you want ; I went for gzip compression and sha256,verify deduplication. When done, click the “Create” button.

Select the Zvol and click the “Share” button.

Now, the ESXi has to be granted permissions to access the volume.

The ESXi initiator meets the Nexenta target

From the “Data Management” tab, click the “Remote Initiators” of the “iSCSI” section. Use the link to create a new remote initiator.

Fill-in the remote initiator name and the CHAP credentials. The name is the complex “iqn(…)” string you got from the ESXi in step #1. You can copy/paste from the vSphere client to the Web interface.

CHAP credentials are optional ; depending on your security policy.

Use the “Create” button to finalize the configuration.

If you have several ESXi, you can create a group out of them to ease iSCSI sharing. I won’t detail that here, but just create a “Initiator groups”, from “SCSI Target”, and add the ESXi initiators.

From the “SCSI Target” section, click the “Mappings” option. A default mapping should have been created. If you want specific mapping, like limiting target and/or initiator to specific LUN, use the “create” link.

From the vSphere client, open the iSCSI Initiator properties. Select the “Dynamic Discovery” tab and click the “Add…” button. Fill-in the iSCSI Server reference ; using IP or FQDN ; and enter the CHAP credentials if needed. The close the properties box and rescan the adapter. Click the “Refresh” and/or the “Rescan All” button to see the iSCSI LUN.

From the “Storage” section, click the “Add Storage…” button. Select the “Disk/LUN” storage type. Select the LUN that was shared and click “Next”. Select the filesystem version according to your environment ; I used VMFS-5. Enter the datastore name and capacity. Click “Finish” to complete.

The datastore is now ready to use.

Final thoughts

One not so nice thing is that, from the Nexenta shell, you don’t have access to the zVol’s content ; although you have access to information about it.

  # zfs list -r tank
  tank               36.4G   193G  40.5K  /volumes/tank
  tank/vmware        32.3G   193G  32.3G  /volumes/tank/vmware
  tank/vmware_iscsi  3.60G   193G  3.60G  -
  # ls tank/vmware_iscsi
  ls: tank/vmware_iscsi: No such file or directory
  # zfs get used,available,referenced,compressratio,reservation,volsize,usedbydataset tank/vmware_iscsi
  NAME               PROPERTY       VALUE    SOURCE
  tank/vmware_iscsi  used           3.60G    -
  tank/vmware_iscsi  available      193G     -
  tank/vmware_iscsi  referenced     3.60G    -
  tank/vmware_iscsi  compressratio  2.15x    -
  tank/vmware_iscsi  reservation    none     default
  tank/vmware_iscsi  volsize        128G     local
  tank/vmware_iscsi  usedbydataset  3.60G    -

The nice thing though is that iSCSI over ZFS provides compression, deduplication, thin provisionning and replication features!

I’ll have to check whether an iSCSI share has better performance than an NFS one, using the same ZFS pool. At first sight, write latency looks far better, when migrating a live VM from NFS to iSCSI.

That’s All Folks!