Home
%3CLINGO-SUB%20id%3D%22lingo-sub-868341%22%20slang%3D%22en-US%22%3EControlling%20write-through%20behaviors%20in%20SMB%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-868341%22%20slang%3D%22en-US%22%3E%3CP%3EHeya%20folks%2C%20%3CA%20href%3D%22https%3A%2F%2Ftwitter.com%2Fnerdpyle%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3ENed%3C%2FA%3E%20here%20again.%20In%20my%20continuing%20series%20on%20offbeat%20SMB%20settings%2C%20today%20I%E2%80%99m%20going%20to%20explain%20how%20to%20control%20SMB%20write-through%20and%20data%20consistency%20in%20Windows%2010%20and%20Windows%20Server.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1822138520%22%20id%3D%22toc-hId-1822138520%22%3E%3CSTRONG%3EBackground%20%3C%2FSTRONG%3E%3C%2FH2%3E%0A%3CP%3ENetwork%20protocols%20like%20SMB%20or%20NFS%20are%20actually%20remote%20file%20systems.%20They%20allow%20a%20client%20to%20mount%20destination%20storage%20as%20if%20it%20were%20their%20own%20local%20disks%20and%20read%20and%20write%20files%20to%20them.%20These%20protocols%20rely%20on%20underlying%20transports%20like%20TCP%20and%20then%20provide%20a%20layer%20on%20top%20for%20your%20apps%20to%20think%20that%20the%20server%205%2C000%20miles%20away%20is%20truly%20just%20your%20F%3A%20volume.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBecause%20remote%20networks%2C%20latency%2C%20and%20storage%20added%20up%20to%20a%20much%20slower%20experience%20than%20local%20I%2FO%20for%20the%20first%20few%20decades%20of%20computing%2C%20file%20servers%20that%20implemented%20these%20protocols%20were%20stuffed%20with%20buffers%20and%20caches%20to%20squeeze%20better%20performance%20out%20of%20craptastic%20spinning%20disks%2C%20as%20well%20as%20help%20the%20servers%20deal%20with%20lots%20of%20clients%20fighting%20for%20resources%20simultaneously%20%E2%80%93%20a%20problem%20your%20laptop%20doesn%E2%80%99t%20have.%3C%2FP%3E%0A%3CDIV%20id%3D%22tinyMceEditorclipboard_image_0%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F132920i5778C241DEF7C539%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Anchorman_204Pyxurz.jpg%22%20title%3D%22Anchorman_204Pyxurz.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CDIV%20id%3D%22tinyMceEditorclipboard_image_1%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CH2%20id%3D%22toc-hId--730018441%22%20id%3D%22toc-hId--730018441%22%3E%3CSTRONG%3EWho%20cares%3F%3C%2FSTRONG%3E%3C%2FH2%3E%0A%3CP%3EWith%20the%20advent%20of%20incredibly%20high%20throughput%20storage%20like%20SSD%2C%20NVME%2C%20and%20NVDIMM%20and%20incredibly%20low%20latency%20networking%20fabrics%20like%20RDMA%2C%20these%20simple%20SMB%20servers%20with%20simple%20user%20workloads%20morphed%20into%20Scale-out%20File%20Servers%2C%20where%20applications%20like%20SQL%20and%20Hyper-V%20want%20to%20use%20them%20as%20Scale-as%20part%20of%20a%20Software-defined%20Storage%20fabric%20that%20required%20near-perfect%20work%20resiliency%20and%20durability.%20That%20also%20meant%20that%20we%20needed%20to%20stop%20using%20caches%20and%20start%20requiring%20data%20to%20commit%20to%20the%20disk%2C%20not%20memory%2C%20for%20safety.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20know%20what%20you%E2%80%99re%20thinking%20right%20now%3A%20%E2%80%9CDoggone%20software%20devs%2C%20playing%20games%20with%20my%20data.%E2%80%9D%20Well%2C%20disks%20have%20buffers%20too!%20SCSI%20and%20modern%20SATA%20drives%20implement%20%E2%80%9CForce%20Unit%20Access%E2%80%9D%20(FUA)%2C%20which%20guarantees%20when%20an%20IO%20is%20marked%20for%20write-through%20it%20will%20land%20on%20true%20stable%20storage%20and%20not%20the%20disk%E2%80%99s%20own%20caches%2C%20which%20are%20legion%20in%20the%20constant%20battle%20of%20IOPS%20brochures%20between%20hardware%20makers.%20Basically%2C%20if%20your%20drive%20gets%20told%20%E2%80%9Cyou%20better%20write%20this%20IO%20and%20don%E2%80%99t%20reply%20until%20it%E2%80%99s%20really%20written%20for%20realsies%2C%E2%80%9D%20it%20will.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20first%20added%20FUA%20support%20for%20SCSI%20in%20Windows%20Vista.%20We%20later%20added%20the%20SATA%20support%20and%20I%20am%20here%20to%20tell%2C%20you%20dear%20reader%2C%20that%20we%20still%20see%20SATA%20disks%20out%20there%20which%20answer%20write-through%20commands%20then%20%3CEM%3Edon%E2%80%99t%20actually%20write%20through%3C%2FEM%3E%20so%20I%20recommend%20sticking%20with%20commercial%2C%20name%20brand%20disks%20when%20not%20using%20SAS%2FSCSI%20storage!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20suffer%20from%20insomnia%2C%20I%20recommend%20reading%20more%20about%20%3CA%20href%3D%22http%3A%2F%2Fwww.t13.org%2Fdocuments%2FUploadedDocuments%2Fdocs2008%2FD1699r6a-ATA8-ACS.pdf%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EWRITE%20DMA%20FUA%20EXT%20(command%203Dh)%2C%20WRITE%20DMA%20QUEUED%20FUA%20EXT%20(command%203Eh)%2C%20and%20WRITE%20MULTIPLE%20FUA%20EXT%20(command%20CEh).%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1012791894%22%20id%3D%22toc-hId-1012791894%22%3E%3CSTRONG%3EEnsuring%20write%20through%20on%20Windows%20failover%20clusters%3C%2FSTRONG%3E%3C%2FH2%3E%0A%3CP%3EFor%20organizations%20using%20those%20Scale-out%20File%20Servers%20for%20software-defined%20datacenter%20workloads%20like%20SQL%2C%20you%20get%20write-through%20for%20free%20as%20soon%20as%20you%20create%20Windows%20Server%202012%2C%202012%20R2%2C%202016%2C%20and%202019%20failover%20clusters%20with%20the%20File%20Server%20resource%20configured.%20The%20Scale-out%20File%20Server%20(SoFS)%20cluster%20role%20enables%20the%20%E2%80%9C%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fprevious-versions%2Fwindows%2Fit-pro%2Fwindows-server-2012-R2-and-2012%2Fhh831349(v%3Dws.11)%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EContinuous%20Availability%E2%80%9D%3C%2FA%3E%20flag%20on%20every%20share%20you%20create%2C%20guaranteeing%20write-through%20as%20part%20of%20a%20larger%20set%20of%20durability%20and%20reliability%20guarantees%20for%20your%20application%20data%20workload.%20When%20combined%20with%20features%20like%20Transparent%20Failover%20and%20Persistent%20Handles%2C%20a%20dead%20cluster%20node%20will%20not%20lead%20to%20a%20crashed%20workload%20%E2%80%93%20IOs%20are%20persisted%20and%20handed%20over%20to%20another%20node%2C%20all%20while%20getting%20FUA.%3C%2FP%3E%0A%3CP%3EWe%20also%20enable%20the%20CA%20share%20flag%20on%20regular%20file%20server%20cluster%20nodes%20but%20admins%20often%20disable%20it%20for%20performance%20reasons%2C%20the%20same%20way%20they%20might%20avoid%20SoFS%20for%20compatibility%20reasons.%20Remember%20when%20I%20wrote%20the%20Shakespearean%20prose%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FStorage-at-Microsoft%2FTo-scale-out-or-not-to-scale-out-that-is-the-question%2Fba-p%2F425080%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3Eto%20scale%20out%20or%20not%20to%20scale%20out%3C%2FA%3E%3F%20CA%20is%20not%20designed%20for%20copying%20files%20but%20for%20handing%20IOs%20on%20a%20file%20opened%20then%20being%20modified%20forever%20because%20it%E2%80%99s%20a%20virtual%20machine%20or%20database.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1539365067%22%20id%3D%22toc-hId--1539365067%22%3E%3CSTRONG%3EForcing%20write-through%20from%20Windows%2010%20clients%20and%20Windows%20Server%202019%3C%2FSTRONG%3E%3C%2FH2%3E%0A%3CP%3EThat%E2%80%99s%20all%20fine%20for%20a%20specific%20workload%20type%2C%20but%20what%20if%20you%20want%20to%20force%20write-through%20from%20a%20client%20and%20not%20care%20what%20your%20Windows%20Server%20OS%20version%20and%20configuration%20are%3F%20Starting%20in%20Windows%2010%201809%20and%20Windows%20Server%202019%2C%20I%E2%80%99ve%20got%20an%20answer%20for%20you%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3ENET%20USE%20%2FWRITETHROUGH%3CBR%20%2F%3E%3CBR%20%2F%3ENew-SMBMapping%20-UseWriteThrough%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20you%20map%20a%20UNC%20path%20(with%20or%20without%20a%20letter)%20to%20a%20remote%20Windows%20Server%20using%20whatever%20flavor%20of%20SMB%20and%20provide%20the%20new%20flag%2C%20you%20will%20send%20along%20the%20write-through%20command%20for%20any%20files%20you%20create%20or%20modify%20over%20that%20session.%20Now%20an%20admin%20can%20specify%20for%20users%E2%80%99%20logon%20scripts%20or%20their%20own%20mapped%20drives%20that%20any%20IO%20happening%20on%20there%20will%20ignore%20those%20caches%20and%20guarantee%20writes%20for%20maximum%20durability%20when%20you%20don%E2%80%99t%20trust%20the%20reliability%20of%20your%20servers.%20And%20you%E2%80%99ll%20certainly%20find%20out%20how%20fast%20your%20drives%20really%20are!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet%E2%80%99s%20see%20it%20in%20action.%26nbsp%3BFirst%2C%20I%20map%20a%20drive%20normally%20and%20copy%20a%20single%2010GB%20file%20then%203%2C100%20little%20files%20that%20added%20up%20to%2010GB.%20I%20use%20robocopy%20for%20all%20my%20tests%20because%20it%20has%20exact%20copy%20times%20and%20lets%20me%20add%20efficiency%20like%20multi-threaded%20copies%3B%20stay%20away%20from%20File%20Explorer%20for%20any%20testing.%20Hell%2C%20stay%20away%20from%20it%20for%20copies%20the%20rest%20of%20the%20time%20too!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20979px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F132849iB7D4636D269299DD%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%221.PNG%22%20title%3D%221.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20981px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F132852iD18F04FCB8C51F9F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2210.PNG%22%20title%3D%2210.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20979px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F132854iA0A45FB49FEC678F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2211.PNG%22%20title%3D%2211.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20you%20can%20see%2C%20my%20single%20big%20file%20took%2048%20seconds%2C%20and%20my%20many%20small%20files%20took%20a%20bit%20longer.%20A%20large%20batch%2C%20multi-directory%20small%20file%20copy%20to%20a%20server%20has%20tons%20of%20overhead%20that%20a%20single%20sequential%20IO%20write%20large%20file%20does%20not%2C%20so%20just%20to%20get%20that%20time%20close%20I%20still%20needed%20to%20add%20multi-threading%20(another%20reason%20to%20use%20Robocopy%20instead%20of%20File%20Explorer%20every%20time!)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20let%E2%80%99s%20try%20that%20again%20with%20write-through%20enabled%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20439px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F132851i2EFABB4BE0499D8A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%226.PNG%22%20title%3D%226.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20979px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F132845i743741056CEA1D47%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%228.PNG%22%20title%3D%228.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20978px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F132843i0D2198B52F61FA3E%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%223.PNG%22%20title%3D%223.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20978px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F132844i13A48AB04077A55D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%224.PNG%22%20title%3D%224.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20took%20a%20hit%20in%20time.%20Still%2C%20perhaps%20worth%20guaranteeing%20that%20some%20125Gb%20file%20copy%20wasn%E2%80%99t%20corrupted%20by%20a%20server%20crash%20at%20the%20last%20couple%20seconds%20of%20IO%20the%20way%20Murphy%20always%20guarantees.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-203445268%22%20id%3D%22toc-hId-203445268%22%3E%3CSTRONG%3EHow%20it%20looks%20on%20the%20wire%3C%2FSTRONG%3E%3C%2FH2%3E%0A%3CP%3EThe%20difference%20in%20SMB%20quite%20simple%3A%20a%20single%20flag%20will%20now%20be%20enabled%20on%20every%20Create%20File%20request%20operation.%20This%20tells%20all%20subsequent%20writes%20to%20the%20file%20to%20require%20the%20storage%20to%20support%20and%20use%20FUA.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20928px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F132917iC10C89753B3E9BAA%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%227%5B2957%5D.PNG%22%20title%3D%227%5B2957%5D.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENothing%20else%20needs%20to%20be%20done%20and%20the%20rest%20of%20the%20SMB%20conversation%20will%20look%20normal.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1946255603%22%20id%3D%22toc-hId-1946255603%22%3E%3CSTRONG%3ECareful%3C%2FSTRONG%3E%3C%2FH2%3E%0A%3CP%3EAs%20you%20saw%2C%20there%20is%20a%20performance%20hit%20to%20requiring%20write%20through%2C%20and%20it%20can%20vary%20a%20little%20or%20a%20lot.%20Your%20mileage%20will%20vary%20here%20%E2%80%93%20I%20am%20using%20some%20pretty%20quick%20SSD%20storage%20and%20low%20latency%2010Gb%20networking%20without%20congestion%2C%20you%20might%20not%20be%20so%20fortunate.%20You%20can%20use%20the%20Robocopy%20%2FJ%20option%20on%20very%20large%20files%20%26nbsp%3B-%20tens%20of%20GB%20or%20larger%20-%20to%20offset%20this%20a%20hit%20a%20bit%2C%20if%20you%E2%80%99re%20feeling%20fancy.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETest%20test%20test!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--605901358%22%20id%3D%22toc-hId--605901358%22%3E%3CSTRONG%3ESummary%3C%2FSTRONG%3E%3C%2FH2%3E%0A%3CP%3EThe%20odds%20of%20you%20%3CEM%3Eneeding%3C%2FEM%3E%20write%20through%20for%20a%20normal%20user%20doing%20normal%20user%20things%20is%20pretty%20low%3B%20their%20files%20are%20small%2C%20apps%20like%20Office%20often%20keep%20local%20copies%2C%20and%20their%20window%20of%20some%20IO%20living%20in%20a%20server%20buffer%20just%20as%20it%20replied%20back%20to%20the%20client%20but%20then%20crashed%20before%20committing%20to%20disk%20is%20really%20quite%20small.%20The%20overhead%20for%20them%20is%20pretty%20light%20too%2C%20however%3B%20unless%20they%20are%20copying%20very%20large%20files%20all%20the%20time%2C%20they%20typically%20won%E2%80%99t%20see%20a%20huge%20downside%20to%20you%20mapping%20their%20drives%20with%20write%20through.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EUntil%20next%20time%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENed%20%22write%20on!%22%20Pyle%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-868341%22%20slang%3D%22en-US%22%3E%3CP%3EHow%20to%20control%20SMB%20write-through%20and%20data%20consistency%20in%20Windows%2010%20and%20Windows%20Server.%3C%2FP%3E%3C%2FLINGO-TEASER%3E
Microsoft

Heya folks, Ned here again. In my continuing series on offbeat SMB settings, today I’m going to explain how to control SMB write-through and data consistency in Windows 10 and Windows Server.

 

Background

Network protocols like SMB or NFS are actually remote file systems. They allow a client to mount destination storage as if it were their own local disks and read and write files to them. These protocols rely on underlying transports like TCP and then provide a layer on top for your apps to think that the server 5,000 miles away is truly just your F: volume.

 

Because remote networks, latency, and storage added up to a much slower experience than local I/O for the first few decades of computing, file servers that implemented these protocols were stuffed with buffers and caches to squeeze better performance out of craptastic spinning disks, as well as help the servers deal with lots of clients fighting for resources simultaneously – a problem your laptop doesn’t have.

 

Anchorman_204Pyxurz.jpg

 

Who cares?

With the advent of incredibly high throughput storage like SSD, NVME, and NVDIMM and incredibly low latency networking fabrics like RDMA, these simple SMB servers with simple user workloads morphed into Scale-out File Servers, where applications like SQL and Hyper-V want to use them as Scale-as part of a Software-defined Storage fabric that required near-perfect work resiliency and durability. That also meant that we needed to stop using caches and start requiring data to commit to the disk, not memory, for safety.

 

I know what you’re thinking right now: “Doggone software devs, playing games with my data.” Well, disks have buffers too! SCSI and modern SATA drives implement “Force Unit Access” (FUA), which guarantees when an IO is marked for write-through it will land on true stable storage and not the disk’s own caches, which are legion in the constant battle of IOPS brochures between hardware makers. Basically, if your drive gets told “you better write this IO and don’t reply until it’s really written for realsies,” it will.

 

We first added FUA support for SCSI in Windows Vista. We later added the SATA support and I am here to tell, you dear reader, that we still see SATA disks out there which answer write-through commands then don’t actually write through so I recommend sticking with commercial, name brand disks when not using SAS/SCSI storage!

 

If you suffer from insomnia, I recommend reading more about WRITE DMA FUA EXT (command 3Dh), WRITE DMA QUEUED FUA EXT (command 3Eh), and WRITE MULTIPLE FUA EXT ...

 

Ensuring write through on Windows failover clusters

For organizations using those Scale-out File Servers for software-defined datacenter workloads like SQL, you get write-through for free as soon as you create Windows Server 2012, 2012 R2, 2016, and 2019 failover clusters with the File Server resource configured. The Scale-out File Server (SoFS) cluster role enables the “Continuous Availability” flag on every share you create, guaranteeing write-through as part of a larger set of durability and reliability guarantees for your application data workload. When combined with features like Transparent Failover and Persistent Handles, a dead cluster node will not lead to a crashed workload – IOs are persisted and handed over to another node, all while getting FUA.

We also enable the CA share flag on regular file server cluster nodes but admins often disable it for performance reasons, the same way they might avoid SoFS for compatibility reasons. Remember when I wrote the Shakespearean prose to scale out or not to scale out? CA is not designed for copying files but for handing IOs on a file opened then being modified forever because it’s a virtual machine or database.

 

Forcing write-through from Windows 10 clients and Windows Server 2019

That’s all fine for a specific workload type, but what if you want to force write-through from a client and not care what your Windows Server OS version and configuration are? Starting in Windows 10 1809 and Windows Server 2019, I’ve got an answer for you:

 

NET USE /WRITETHROUGH

New-SMBMapping -UseWriteThrough

 

When you map a UNC path (with or without a letter) to a remote Windows Server using whatever flavor of SMB and provide the new flag, you will send along the write-through command for any files you create or modify over that session. Now an admin can specify for users’ logon scripts or their own mapped drives that any IO happening on there will ignore those caches and guarantee writes for maximum durability when you don’t trust the reliability of your servers. And you’ll certainly find out how fast your drives really are!

 

Let’s see it in action. First, I map a drive normally and copy a single 10GB file then 3,100 little files that added up to 10GB. I use robocopy for all my tests because it has exact copy times and lets me add efficiency like multi-threaded copies; stay away from File Explorer for any testing. Hell, stay away from it for copies the rest of the time too!

 

1.PNG

 

10.PNG

11.PNG

 

As you can see, my single big file took 48 seconds, and my many small files took a bit longer. A large batch, multi-directory small file copy to a server has tons of overhead that a single sequential IO write large file does not, so just to get that time close I still needed to add multi-threading (another reason to use Robocopy instead of File Explorer every time!)

 

Now let’s try that again with write-through enabled:

 

6.PNG

8.PNG

 

3.PNG

4.PNG

 

We took a hit in time. Still, perhaps worth guaranteeing that some 125Gb file copy wasn’t corrupted by a server crash at the last couple seconds of IO the way Murphy always guarantees.

 

How it looks on the wire

The difference in SMB quite simple: a single flag will now be enabled on every Create File request operation. This tells all subsequent writes to the file to require the storage to support and use FUA. 

 

7[2957].PNG

 

Nothing else needs to be done and the rest of the SMB conversation will look normal.

 

Careful

As you saw, there is a performance hit to requiring write through, and it can vary a little or a lot. Your mileage will vary here – I am using some pretty quick SSD storage and low latency 10Gb networking without congestion, you might not be so fortunate. You can use the Robocopy /J option on very large files  - tens of GB or larger - to offset this a hit a bit, if you’re feeling fancy.

 

Test test test!

 

Summary

The odds of you needing write through for a normal user doing normal user things is pretty low; their files are small, apps like Office often keep local copies, and their window of some IO living in a server buffer just as it replied back to the client but then crashed before committing to disk is really quite small. The overhead for them is pretty light too, however; unless they are copying very large files all the time, they typically won’t see a huge downside to you mapping their drives with write through.

 

Until next time,

 

Ned "write on!" Pyle