TrueNAS ZFSPool iSCSI

TrueNAS as an iSCSI Initiator

Yes. TrueNAS (or, more specifically, FreeBSD) can be used as an iSCSI initiator.

But why you ask? Well, what if you happen to have a spare SAN laying around and the only thing in your Home Lab that is useful for serving data is TrueNAS? While this is very much an edge case, it happened to me!

TrueNAS Background

Just like Synology and QNAP you can setup a pile of disks, protect the data on those disks with a form of RAID, and then serve up the data over NFS or SMB. This is a very basic use case of these three products. In addition to serving data through NFS and SMB you can use these devices to present storage over iSCSI.

TrueNAS SMB NFS Diagram
TrueNAS sharing data to Windows, Linux, and Plex

Of course TrueNAS, QNAP, and Synology can do much more than just serve data but those features are beyond the scope of this article.

iSCSI in Two Paragraphs

Before we talk more about iSCSI let’s briefly cover what a Target is and what an Initiator is. This is mostly for me because I always forget!

The Target is the SAN. Think EMC, NetApp, Nimble, 3Par, Pure, etc. The Initator is the server that is going to do something with that storage. Think servers running ESXi.

iSCSI Target vs Initiator
Basic iSCSI Diagram

Why iSCSI?

Why would you want to serve data over iSCSI in your home? This is a good question. If you are running a home network with the intention of serving media to Plex and setting up file shares for Windows you are going to be better off using NFS and SMB. However, having the ability to present volumes over iSCSI is helpful if want to set up shared volumes on ESXi or experiment with block storage on Windows Server or Linux.

TrueNAS has all the GUI options you need to setup volumes on TrueNAS to serve through iSCSI which could be consumed by ESXi or Windows.

TrueNAS iSCSI Wizard
TrueNAS iSCSI Target Wizard

Sharing Local Disk and a SAN Disk With TrueNAS

In the following diagram the ZFS Pool that is sharing Data, Movies, and etc. is 6 local SATA disks which is sharing data to Windows, Linux, and Plex over NFS and SMB. The ZFS “Pool” is a single large iSCSI volume that is sharing MoreData to Plex over NFS.

TrueNAS ZFSPool iSCSI
Overly complicated and probably not practical but you can do it!

Setting up TrueNAS as an iSCSI Initiator

I followed the process from this post to get TrueNAS running as an iSCSI initiator.

From the TrueNAS shell I created /conf/base/etc/iscsi.conf and entered the following information. TargetAddress and TargetName will be specific to your setup. CHMOD 600 the file when complete.

t0 {
  TargetAddress = 192.168.1.151
  TargetName = iqn.2010-06.com.etc.etc.etc
}
t1 {
  TargetAddress = 192.168.1.152
  TargetName = iqn.2010-06.com.etc.etc.etc
}

Next I added these lines to the end of /conf/base/etc/rc.conf:

iscsid_enable="YES"
iscsictl_enable="YES"
iscsictl_flags="-Aa"

Then I found the following line in /conf/base/etc/ix.rc.d/ix-zfs…

# REQUIRE: hostid mountcritlocal

… and changed it to:

# REQUIRE: hostid mountcritlocal iscsictl

Finally I rebooted and ran this command…

iscsictl -L

…which showed me my iSCSI targets and confirmed that I was connected.

iscsictl -L

More information can found here.

Remaining Issues

There are a couple of issues to sort out. The first is a timing issue between TrueNAS and the SAN when power is lost. The second issue is that my console is displaying the following warnings which I have yet to research.

TrueNAS Console Warnings
underflow mismatch

iSCSI on TrueNAS Summary

Issues aside, the configuration works well and the volume shared over iSCSI has been as performant as the local ZFS Pool. In hindsight it might be preferable to use TrueNAS tunables rather then modifying the files directly. This article shows how to do that but I have yet to try the steps.

Leave a Reply

Your email address will not be published. Required fields are marked *