# Trying to use ZFS with istgt



## tsuraan (Apr 29, 2012)

I'm trying to follow this guide: http://www.techjolts.com/2011/01/14/iscsi-target-with-zfs-freebsd/ , and it got me as far as making the pool and the actual "zfs" device, but then I got stuck.  When I set the mountpoint for a zfs "partition" to none, it entirely stops existing on the system.  "zfs list" gives me:


```
NAME            USED  AVAIL  REFER  MOUNTPOINT
store           405K  17.7T  72.0K  /store
store/builds   69.6K  17.7T  69.6K  /store/builds
store/itarget  69.6K  10.0T  69.6K  none
```

so I know that my "itarget" exists, but it doesn't appear under /store (which is expected, since I got rid of the mountpoint, I guess).  From what I've read, it should have a block device under /dev/zvol/store/itarget, but I don't have any /dev/zvol directory at all.  Is there some module I needed to load in order to get that?  I've been looking for something like that, but I haven't had any luck.  The closest thing I could find was another forum post indicating that a *zpool send* wouldn't always make new entries under /dev/zvol, and that rebooting made them appear, but a reboot did not help me.

I'm running a perfectly new 9.0-RELEASE build, on a brand new (amd64) computer.  If I can supply any more useful information, I'd be happy to.


----------



## Sebulon (Apr 30, 2012)

@tsuraan

The procedure for creating a ZVOL is wrong, they do show up under /dev/zvol/poolname/:
`# zfs create -o compress=on -o volblocksize=64k -s -V 10t poolname/volname`
I begun by showing how you may assign (-o) options directly in the creation command, you should set the same volume block size as you will use later in the filesystem (default is 8k). -s is for sparse; thin provisioning, and -V is for volume(s) that show up as devices.

/Sebulon


----------



## tsuraan (Apr 30, 2012)

That worked perfectly.  Thanks!

As a quick detail for anybody else doing this, the *zfs create -V* needs a size before the poolname/volname, so the actual command I ran was [cmd=]zfs create -o volblocksize=64k -s -V store/itarget[/cmd] and that worked.

*A*nd, that was the wrong command.  I sure do wish editing was enabled on this forum (or am I just missing it?).  Anyhow, the exact command that actually worked was this one:
[cmd=]zfs create -o volblocksize=64k -s -V 10T store/itarget[/cmd]

*S*orry for the noise.  Maybe a kind editor will come along and make my posts less crappy.


----------



## Sebulon (Apr 30, 2012)

@tsuraan

Crap, I forgot about that! Rather important detail for volumes; size

Editing will be available after 10 posts. Which I am going to use right now

/Sebulon


----------



## belon_cfy (May 16, 2012)

istgt + zvol will result in data loss if the sync status is standard or disabled when the server is not shutdown properly or sudden power loss. 

Changing to always will solve the problem, but you will suffer poor performance, much slower than NFS in my case. The only solution for me is adding SSD as a log device to get a sync write with nearly async speed.


----------

