Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Nov 2012 23:12:52 -0800
From:      je <je@8192.net>
To:        freebsd-fs@freebsd.org
Subject:   Re: ZFS behavior with odd-number of non-parity drives?
Message-ID:  <50A9DBF4.4000303@8192.net>
In-Reply-To: <50A82F08.8010908@8192.net>
References:  <50A82F08.8010908@8192.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 11/17/2012 4:42 PM, je wrote:
> Given an odd number of data (non-parity) drives, how does ZFS write data
> to the individual disks?
>
> For example, a 4-drive RAIDZ or 5-drive RAIDZ2 would use three drives
> for data and two for parity when writing. Since the recordsize is a
> power of two (and no power of two is evenly divisible by three), it is
> impossible to write a full sector (be it a 512b or 4k sector) of data to
> each data drive.
>
> In this case, what does ZFS do? Will it write recordsize/3 bytes of data
> to each drive, leaving the drive to do a read/modify/write operation? Or
> will ZFS round the write up to the nearest drive sector size and "waste"
> the extra bytes?
>
> I see the best practice for RAIDZ is to use an odd number of drives, and
> for RAIDZ2 an even number, but I am curious as to the behavior of ZFS in
> these sub-optimal conditions.
>
> John
> _______________________________________________
> freebsd-fs@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-fs
> To unsubscribe, send any mail to "freebsd-fs-unsubscribe@freebsd.org"
>

If anyone else is interested, I created FreeBSD 9.1-RC3 VM and ran some 
tests on a RAIDZ2 array of virtual disks. It appears that ZFS will 
always write a full sector (be it 512b or 4k) of data, rounding up to 
the nearest whole sector size. If the amount of data does not divide 
evenly into the number drives, some drives will write more sectors than 
others. In my testing the division is not always as even as possible, 
though this may be due to how parity data is written.

In summary, whole sectors are written and drives don't need to do a 
read/modify/write (as long as ZFS knows the real sector size of the drives).

I did not test an array of drives with mixed sector sizes.

John



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?50A9DBF4.4000303>