# ZFS on iSCSI shares



## badtux (Jun 15, 2012)

Due to accident of history I have several large iSCSI storage arrays. So of course the only thing to do is make a ZFS pool RAIDZ'ed across them. So I created several iSCSI shares on the arrays and gave permissions for my FreeBSD box to connect to them, created an /etc/iscsi.conf with the info on how to connect to them, issued the appropriate iscontrol commands to connect, added the resulting block devices to a ZFS RAIDZ pool, voila. 

Here's the problem: On a reboot, how do I get my iSCSI initiators connected before ZFS comes up and tries to mount its pools? Thus far, the only way I can figure to do this is to hack the /etc/rc.d/zfs script at the very top of zfs_start to start up the initiators in via iscontrol (and pausing for five seconds or so to let the connects happen) before falling into the start routine proper. Otherwise my initiators don't start up before ZFS, ZFS doesn't find its pool, and ZFS says "eh, I'm just quitting" and gives up. 

Am I just fundamentally misunderstanding something here, or is there really no way to get those iSCSI initiators auto-starting (other than via this hack) before ZFS tries to mount the pools on them?


----------



## Ikinoki (Sep 3, 2012)

man rcorder(8).

Inject your own iscontrol rc script into /etc/rc.d with

```
REQUIRE: mountcritlocal
PROVIDE: iscsi
BEFORE: zfs
```


----------



## badtux (Sep 4, 2012)

*Thanks*

I did get it working, but eventually had to abandon the FreeBSD platform because the FreeBSD iSCSI initiator doesn't support immediate data mode on writes and thus was too slow when writing data to support my ZFS application (a backup system with redundancy and snapshotting). Unfortunately while I know what the problem is and how to fix it, I can't fix it because I work for a vendor of proprietary iSCSI systems that has their own proprietary iSCSI initiator and thus that whole legal thing intervenes (even though I have nothing to do with my employer's iSCSI initiator).  I ended up using ZFS on another platform that had a fully functional iSCSI initiator. A bummer, really, because immediate data mode and ZFS are a great combination since ZFS is guaranteed consistent while a failure of an iSCSI subsystem with any other filesystem while using immediate data mode will result in potentially the entire filesystem becoming unusable. But it appears nobody else in the FreeBSD world ever thought of combining iSCSI and ZFS in this way...


----------



## Ikinoki (Oct 14, 2012)

Did you try the iet port?


----------



## badtux (Oct 15, 2012)

IET is a target, not an initiator. 

I browsed the ports collection looking for another initiator but all I found was targets. Targets don't connect to other iSCSI storage, they export local storage as iSCSI storage.


----------



## Ikinoki (Oct 15, 2012)

True, and there are no moves upon this direction in 3 releases.
Maybe there is a way to sponsor such a thing?


----------



## badtux (Oct 16, 2012)

I wish. The FreeBSD iSCSI initiator is really weak and lacks a lot of the functionality of the Linux OpeniSCSI initiator, and performs *much* worse for reasons I mentioned above. Unfortunately as I noted above I am not in a position to do anything about that situation due to legal reasons (grrrr!).


----------



## vanessa (Feb 26, 2015)

2 years later, has someone added this immediate data mode to our iSCSI initiator?


----------



## ondra_knezour (Feb 26, 2015)

It is mentioned in a one and half year old status report as ready for the 10.0 release, see http://www.freebsd.cz/news/status/report-2013-07-2013-09.html#Native-iSCSI-Stack


----------



## bsdnet (Feb 28, 2015)

badtux said:


> I did get it working, but eventually had to abandon the FreeBSD platform because the FreeBSD iSCSI initiator doesn't support immediate data mode on writes and thus was too slow when writing data to support my ZFS application (a backup system with redundancy and snapshotting).



Can you share what OS you are picking finally?
Wish FreeBSD has better support for iSCSI for both initiator and target like NFS.


----------



## Ikinoki (May 10, 2015)

So FreeBSD 10+ has support for immediate mode (both iscsid(8) and ctld(8) so initiator and target). It's in the code but not in the mans so tread carefully, but it's ON by default on both types.

Going to test it out  Can't wait for zfs mirror over zfs shares.


----------

