Sector size of a zvol

Pete French petefrench at
Fri Feb 3 15:59:49 UTC 2012

> Try the following from the zfs(1M) man page:
>     zfs create [-ps] [-b blocksize] [-o property=value] ... -V size volume
>     [...]
> 	 -b blocksize
> 	   Equivalent to -o  volblocksize=blocksize.  If  this  option  is
> 	   specified  in  conjunction  with -o volblocksize, the resulting
> 	   behavior is undefined.

Yes, thats the parameter I have been playing around with - whether you set it
with -b or -o volblocksize, the zvol still presents itself as being 512 bytes. 
This is what is puzzling me.

Quick example:

	# zfs create -V 1G -b 512 tank/test1
	# zfs create -V 1G -b 4k tank/test2
	# zfs create -V 1G tank/test3
	# zfs get volblocksize tank/test1 tank/test2 tank/test3
	tank/test1  volblocksize  512       -
	tank/test2  volblocksize  4K        -
	tank/test3  volblocksize  8K        -
	# diskinfo /dev/zvol/tank/test*
	/dev/zvol/tank/test1    512     1073741824      2097152 0       0
	/dev/zvol/tank/test2    512     1073741824      2097152 0       0
	/dev/zvol/tank/test3    512     1073741824      2097152 0       0

As you can see, the blocksize is being set properly in the volume, but
in the actial device it's always 512.

Now the reason behind this was to share out a 4k block sizes iscsi target,
and I have subsequently discovered that I can set that parameter on istgt
which should mitigate the effect, but I still think it is odd.



More information about the freebsd-stable mailing list