FREENAS to sync or not to sync -- CIFS/SMB

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

azev

Well-Known Member
Jan 18, 2013
769
251
63
I am building a new freenas box to specifically serve file via CIFS/SMB to windows clients.
The plan is to have 12x 12TB drives setup in 2x vdev of raid-z2 with 6 drive each.
I figure I can grow the dataset by adding 6x 12TB drives and add another vdev to the zpool. (case is 24slot)
My experience with Freenas have mostly been for ISCSI storage for Virtualization platform and for that SYNC=ALWAYS is the preferred method which usually require a fast ZIL to get great performance.
However for the SMB/CIFS use case is there any benefit gained from setting SYNC=ALWAYS ?
If there are currently data in flight and the server lost power, I imagine the file in flight will get corrupted with or without sync on is this true ?
In what failure scenario will this provide additional protection ?
 

gea

Well-Known Member
Dec 31, 2010
3,156
1,195
113
DE
On a crash during a large write, the file is lost does not matter of sync. The ZFS filesystem remains valid in both cases due CopyOnWrite that protects atomic writes (write data and write metadata is both valid or both discarded on ZFS). Only the writing application ex MS Word can care about such a crash with local temp files.

This may be different with smaller files. In such a case it can happen that a file or write is already completely in the rambased writecache when the system crashes. Without sync the file or committed write is lost, with sync it is on disk on next reboot.

In the past, it was quite simple. Without sync you can get 500 MB/s from an average disk pool. With sync enabled you are at 50 MB/s. For an SMB filer the solution was to disable sync. For databases or VM storage set sync always to enable as a crash then can mean a corrupt VM or database. Intel Optane was a game changer as the performance degration of sync is acceptable and worth the security advantage.

For a SMB filer with high security demands I would consider sync now at least with good plp SSD pools or an Optane Slog (ex 4801) with disks
 

azev

Well-Known Member
Jan 18, 2013
769
251
63
@gea Thank you for the info, very informative. I was curious whether it is wise to safe a few hundred bux for a dedicated zil device (optane or nvram) and operation cost (additional power needed to run the ZIL). I guess like you mention without zil anything written in the memory before the 5sec interval could potentially be lost if something happened. This is for my home network and primarily will store media files (large files), so maybe a no zil solution would be fine, but I will seriously consider adding an optane or NVRAM for zil. Thx again.
 

gea

Well-Known Member
Dec 31, 2010
3,156
1,195
113
DE
Only for correct naming..

If you just enable sync, the logging of sync writes to protect the rambased cache go to the pool. I would explain it like this. As pool performance is heavily affected by fragmentation and data spread over all disks, a small part of the pool is reserved for the logging that is not affected by fragmentation and optimized for small random writes. This part of the pool is called ZIL.

You can now add a dedicated disk for logging that is more optimized for this type of load (ultra low latency, high steady write iops with qd1, plp). This disk is called slog.
 
Last edited:
  • Like
Reactions: itronin