Setting up TrueNAS iSCSI with ZVOLs (VMWare)
Summary
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.
Recommended Block Size Settings: VMWare 7 with VMFS6
- 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: iqn.YYYY-MM.com.example.host Examples:
- iqn.2023-11.com.example.truenas-01
- iqn.2023-11.com.example.truenas-01:ABCD1234
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.
Recommended ZVOL Parameters
- 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.
- Choose whatever size you want, it may be up to 80% of your ZFS Pool.
This may be overriden clicking the
- 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.
- Go to
Sharing → Block Sharing (iSCSI) → Portals
. - Click the
ADD
button. - 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: 0.0.0.0 (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.
- Go to
Sharing → Block Sharing (iSCSI) → Initiator Groups
. - 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.
- Go to
Sharing → Block Sharing (iSCSI) → Targets
. - 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.
- Go to
Sharing → Block Sharing (iSCSI) → Extents
. - 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.
- Go to
Sharing → Block Sharing (iSCSI) → Associated Targets
. - 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.
See Also
- ESXi 6.7u3 2nd VMFS6 issues
- Can’t configure VMFS6 over iSCSI
- Unable to create Filesystem, please see VMkernel log for more details
- How to configure iSCSI (Block share) in TrueNAS/FreeNAS
For Testing reasons we also used Proxmox to try out the iSCSI Target Interface on TrueNAS:
Proxmox iSCSI target with Synology NAS shared storage and troubleshooting