Connecting ZFS to iSCSI

All your general support questions for OpenZFS on OS X.

Connecting ZFS to iSCSI

Postby Haravikk » Sun Dec 12, 2021 3:43 am

So I'm part way through a mammoth changeover from piles of external disks running HFS+/APFS to actually finally having nearly all of my storage on ZFS in proper multi-bay enclosures. One of the pieces of the puzzle however is my NAS, which sadly does not support ZFS (so no zfs send'ing directly to it); it does however support iSCSI, so my intention is to create a big iSCSI target on a classic RAID (it's a secondary backup so self-healing isn't super critical).

However, I'm very unclear on how to actually connect ZFS to an iSCSI target.

I know that ZFS supports the creation of iSCSI targets, so it clearly has some way to define and expose these, but what I'm less clear on is whether it has a built-in ability to connect to them, or do I still need to find a separate iSCSI initiator for macOS?

If I do need a separate iSCSI initiator, what are the current options? Are there any good free ones?

I don't really need a GUI; in fact I'd prefer a way to connect via command line as I'll probably aim to only connect when I need to run a zfs send to the iSCSI target, i.e- connect, import, send, then export and disconnect, except for a periodic scrub, so a command line tool will make it a lot easier to write a script to handle all of this.
Haravikk
 
Posts: 75
Joined: Tue Mar 17, 2015 4:52 am

Re: Connecting ZFS to iSCSI

Postby tangles » Fri Dec 24, 2021 2:50 pm

Ah…

If I’m reading your post correctly, I think you’ve got it around the wrong way.

Normally, you have your ZFS pool and the iSCSI service running on the same host such as a server, and then share out the configured iSCSI dataset to your desired client running iSCSI initiator.

This is something I’ll be playing with over the Chrissy break with TrueNAS Core to see if I can get around Apple’s “lock-in” of needing APFS for Photos libraries… ← grrr…
tangles
 
Posts: 195
Joined: Tue Jun 17, 2014 6:54 am

Re: Connecting ZFS to iSCSI

Postby Haravikk » Sun Dec 26, 2021 6:38 am

Actually I'm pretty sure the initiator is the part I want; I have locally attached zpools (one for data, one for primary backup), and I want to also have a secondary backup. Unfortunately my NAS does not support ZFS natively, but it does support iSCSI on top of an ordinary RAID, so my intention is to have it present a big iSCSI device that I can then format using ZFS on my local machine and send data as if it were a local drive.

Won't be as good as having a NAS with native ZFS support of course (no self-healing or such) but since it's a secondary backup it's not so critical as long as I can still detect any errors. Someday I'll replace it with a NAS that supports ZFS so I can just send to it directly, but for the moment the one I have is still going strong and is otherwise suitable for my needs. For now though as far as I can tell my options are rsync (which is what I was using before switching to ZFS and would prefer not to), iSCSI for "directly" exposing a block device, or if I can't find a good initiator I guess I'lI need to do AFP/NFS/SMB and have ZFS use a giant file as a "disk". iSCSI seems the better option if I can find a way to connect to it, as I want to be able to send the encrypted, checksummed etc. data directly (rather than file-level as rsync would require), and it would be better to avoid having an extra file-system layer in the middle.

Also, for the Photos libraries; is that really still an issue? If that still won't work with ZFS natively, I might try an APFS/HFS zvol mounting over that folder, should work I think as long as it's mounted before I login? Horrible thing to have to do but worth it to get full ZFS on the rest of my directories; I haven't switched over my home folders yet, that's still to be done.
Haravikk
 
Posts: 75
Joined: Tue Mar 17, 2015 4:52 am

Re: Connecting ZFS to iSCSI

Postby tangles » Sun Dec 26, 2021 2:42 pm

I understand now.

I’m not sure that macOS ZFS will even see the iSCSI volume to be able to format it using ZFSonOSX in the first place.

I guess as long as it’s presented to macOS the same way a raw disk is, you have a chance.

If you get this to actually work, I’d be very curious what I/O throughput you achieve, because iSCSI (especially with macOS either the initiator or target) has been rather slow in my experience over 1Gbit Ethernet and that’s with a dedicated port.

If your NAS has multiple Ethernet ports, see if you can configure one port purely for iSCSI and directly connect it to your Mac (another Ethernet port needed) using a completely different IP subnet… eg, if you’re main network is 192.168.x.y or 10.x.y.z, configure the 2nd Ethernet port network to be 172.16.x.y and direct connect to maximise I/O.

Have fun!
tangles
 
Posts: 195
Joined: Tue Jun 17, 2014 6:54 am


Return to General Help

Who is online

Users browsing this forum: No registered users and 24 guests