# ZFS - prefer one disk for reading?



## dR3b (Aug 20, 2014)

Hi,

I have a simple ZFS mirror with 2 disks. Is it possible to prefer one of the disks for reading? I think about a setup like this:

```
-------   -------
        - SSD -   - HDD -
        -------   -------
          |         |
          -----------
               |
            mirror
```
I know the SSD is for (read)speed only. Is it possible?

Thanks


----------



## SirDice (Aug 20, 2014)

RAID-Z is not a mirror, RAID-Z is more or less an extended RAID 5. And the setup you proposed won't work. But, you may create a pool with just the one HDD drive and use the SSD as L2ARC. That would closely approximate what you wanted but you lose the fault-tolerance.


----------



## kpa (Aug 20, 2014)

Depending on how valuable the data is you could use a lesser form of redundancy on a single disk pool by setting copies=2 on the filesystems and also setting compression=on. That would make two copies of each file in unrelated blocks on the disk. The compression would even out the extra space taken by the extra copies, maybe not all of it but close enough. With that in place you could use the SSD as L2ARC fast cache as @SirDice suggests.


----------



## dR3b (Aug 20, 2014)

SirDice said:
			
		

> RAID-Z is not a mirror, RAID-Z is more or less an extended RAID 5.


You are right! Sorry my mistake. On my workstation i use a L2ARC setup and it works very well. 

Thanks


----------



## usdmatt (Aug 20, 2014)

Apparently there is already some functionality in ZFS for preferring reads from 'non-rotating' disks. It was originally developed by the ZFS-on-linux guys, then ported across. I don't know which shipping versions of FreeBSD it's in but if you have it you should also have vfs.zfs.vdev.mirror sysctls available to tune it. (A quick look suggests it may only be in HEAD so you're probably out of luck)

See the notes in the commit for this file (from 9 months ago)
https://svnweb.freebsd.org/base/head/sy ... rev=256956

The sysctl variables should allow for giving more weight to 'non-rotating' disks, although I don't know how ZFS determines which disks are 'rotating' media and which aren't.

Other that that I don't know of any way to tell ZFS to always prefer to read from a certain device. Traditionally it has always been just round-robin.


----------



## dR3b (Aug 21, 2014)

Hi


			
				usdmatt said:
			
		

> Apparently there is already some functionality in ZFS for preferring reads from 'non-rotating' disks. It was originally developed by the ZFS-on-linux guys, then ported across.


This sounds great! Thanks  


			
				usdmatt said:
			
		

> I don't know which shipping versions of FreeBSD it's in...


You_'re_ right, it's not in FreeBSD 10-RELEASE but it's great to have this option in a later version.


----------



## Sylhouette (Sep 8, 2014)

It just got merged to 10 stable and is going to be part of FreeBSD 10.1

http://freshbsd.org/commit/freebsd/r271238

I see a lot of changes to the whole cam, geom and zfs layers in 10.1. If these all work out like they should 10.1 could well be a really good file server release. Samba used to be not that fast on FreeBSD, at least not without a lot of tweaking and for some it never got fast but on 10 stable and with samba 4.1.xx I do not have to tweak that much like before to get 90 to 100 MB/s transfers.

Regards


----------

