Its not so much the defrag process, its the trim/zero out free space.
Windows 2008r2 is not releasing the free space on the freenas iscsi target. So while windows is reporting more than 50% free space, freenas was reporting less than 20% free space.
As mentioned before, we attempted to use sdelete to zero out free space, which did work but was very slow and disk io intensive. We then found some scripts that do the same thing on the nimble support site, this was working better but still very slow. We tried a product call Perfect storage that seemed to work better and was more disk IO aware and could run in background
http://www.raxco.com/products/perfectstorage
We noticed that Windows2012R2 supports the iscsi trim / release of free space on the freenas device so we upgraded from 2008 to 2012. After this upgrade everything was still running ok. It was not till we ran windows disk optimizer, then freenas crashed.
we had turned optimizer on as schedule around 3am. the system crashed 2 more times just after 3am. then once everything was running again we started running optimizer again because we still have about 10TB to reclaim, freenas crashed again. Last night after we got freenas running again we turned off optimizer and freenas has not crashed.
So what does Storage Optimizer do in Windows 2012 R2?
The Storage Optimizer in Windows 8/Server 2012 , also takes care of maintenance activities like compacting data and compaction of file system allocation for enabling capacity reclamation on thinly provisioned disks. This is again platform specific, so if your storage platform supports it, Storage Optimizer will consolidate lightly used ‘slabs’ of storage and release those freed storage ‘slabs’ back to your storage pool for use by other Spaces or LUNs. This activity is done on a periodic basis i.e., without any user intervention and completes the scheduled task provided it is not interrupted by the user. I am not getting into storage spaces and storage pools as this will further lengthen this topic, you can refer TechNet regarding
Storage Spaces overviewfor details.
on a side note, we have nearly exact set up at a second location but not as sever issue with unclaimed space and there are no issues on that box. So this leads me to think there might be a bug with freenas and windows2012 optimizer when it reclaims x amount of space. the second unit did not have very much free space that needed to be reclaimed.