Setting up TrueNAS iSCSI with ZVOLs (VMWare)


Due to some issues with VMFS and how it wants the Logical and Physical Block Sizes to be configured, it requires very specific settings.

Here you will find a basic overview of how to setup a VMWare Compatible iSCSI Target on TrueNAS.

  • BS (Block Size): 64KiB
  • LBS (Logical Block Size): 512

Global Configuration

First and foremost, you must configure your IQN Name.

To do this go to the Sharing → Block Sharing (iSCSI) → Target Global Configuration menu and in your Base Name field enter an IQN Name according to this format (See Also: RFC3720).

The domain must be reversed and it may optionally contain a serial number

Format: Examples:


Creating the ZVOL for the iSCSI Target

To create the corresponding ZVOL in our Dataset go to Storage → Pools Click on the three vertical dots button and use the Add ZVOL Option.

  • ZVOL Name: LUN0
  • Size: 100GB
    • Choose whatever size you want, it may be up to 80% of your ZFS Pool. This may be overriden clicking the Force Size checkbox.
  • Synchronization: Standard
  • Compression Level: LZ4
  • Block Size (In Advanced Options): 64KiB

Everything else can be left on defaults.

Setting up the iSCSI Service

Important: Ensure the iSCSI Service is enabled and auto-start is activated.

Creating the iSCSI Portal

After creating our ZVOL we must create the iSCSI Portal.

  1. Go to Sharing → Block Sharing (iSCSI) → Portals.
  2. Click the ADD button.
  3. Setup a Portal with the following settings:
  • Description: Portal0
  • Authentication Method and Group: To your liking (default: NONE)
  • Discovery Authentication Group: N/A
  • IP Addresses: (or whatever IPs you’ve assigned to your SAN, 2 IPs recommended for multipathing).

Creating the iSCSI Initiator Groups

In the Initiator Groups tab you must create an entry to authorize Initiators.

  1. Go to Sharing → Block Sharing (iSCSI) → Initiator Groups.
  2. For testing purposes you may create one that allows any host, or restrict it to a subnet.

Creating the iSCSI Target

To create an iSCSI Target you may do the following.

  1. Go to Sharing → Block Sharing (iSCSI) → Targets.
  2. Add an entry with the following recommended parameters:
  • Basic Info
    • Target Name: p0-target0
  • iSCSI Group
    • Portal Group ID: {$YOUR_PORTAL_GROUP_ID}
    • Initiator Group ID: {$YOUR_IGRP_ID}
    • Authentication Method: NONE
    • Authentication Group Number: N/A

Creating the iSCSI Extent

After creating the target we must associate it to an Extent.

  1. Go to Sharing → Block Sharing (iSCSI) → Extents.
  2. Create an Entry with the following recommended parameters:
  • Basic Info
    • Name: p0-t0-extent0
  • Type
    • Extent Type: Device
    • Device: zfspool/dataset/LUN0
    • LBS (Logical Block Size): 512
  • Compatibility
    • LUN RPM: SSD/7200k/5400k/etc. (Depends on your hardware)

Creating the iSCSI Associated Targets

Finally we can create an Associated Target to match to our ZVOL to a LUN ID.

  1. Go to Sharing → Block Sharing (iSCSI) → Associated Targets.
  2. Create an Entry with the following recommended parameters:
  • Target: p0-target0
  • LUN ID: 0
  • Extent: p0-t0-extent0

You may now add and test the iSCSI Target to your VMWare/ESXi Configuration.