FreeNAS is the world’s most popular open source storage operating system not only because of its features and ease of use but also what lies beneath the surface: The ZFS file system. With over seven million downloads, FreeNAS has put ZFS onto more systems than any other product or project to date and is used everywhere from homes to enterprises.
I like what ZFS offers for data integrity (among other things). Is anybody using ZFS (something like TrueNAS) for file server duties in a Windows environment? With a few AD-joined Macs thrown in for good measure? We use ZFS paired with FreeBSD and Linux (ZOL) inside our virtual storage appliances and also some internal housekeeping. ZFS Storage Appliance uses OISP to prioritize Oracle Database IOs, accelerating customer workloads by up to 19% as tested by Oracle storage development. Cache management accelerates database backups Automatic management of storage caches using OISP-provided information enables ZFS Storage Appliance to reduce backup windows for customer. An absolutely killer feature of ZFS is the ability to add compression with little hassle. As we turn into 2018, there is an obvious new year’s resolution: use ZFS compression. Combined with sparse volumes (ZFS thin provisioning) this is a must-do option to get more performance and better disk space utilization.
Windows Formatting Screen. In ZFS the term for this is called the Record Size. This value represents the maximum size of a block. A block assembles the pieces of your data into logical groupings. In TrueNAS Core, you can define the record size on the pool level.
But why ZFS?
FreeNAS uses ZFS because it is an enterprise-ready open source file system and volume manager with unprecedented flexibility and an uncompromising commitment to data integrity. ZFS is a truly next-generation file system that eliminates most, if not all of the shortcomings found in legacy file systems and hardware RAID devices. Once you go ZFS, you will never want to go back.
Unprecedented Flexibility
ZFS helps you avoid most storage planning mistakes by pooling together the blocks provided by all of your disks and allowing you to divide the available space into highly-configurable file systems. ZFS includes the permissions and quotas of traditional file systems but also includes transparent compression levels, capacity reservations, and clonable snapshots. Of these features, snapshots will probably be the one that forever changes the way you think about storage. Imagine if you could bring “what if?” style experimentation to your storage.
Uncompromising Data Integrity
Unprecedented flexibility is pointless without dependability. ZFS is uncompromising about data integrity and data redundancy. ZFS creates a chain of trust for your data by checksumming data when it is written and verifying the checksums when it is read. It even checksums the metadata that describes the file system and allows you to periodically verify all checksums to determine if your infrequently-used data or backups are suffering silent data corruption a.k.a. “bit rot”. By taking these precautions, ZFS will never return you corrupt data from disk.
Knowing your data is intact is one thing but combating disk unreliability is quite another. ZFS can maintain data redundancy through a sophisticated system of multiple disk strategies. These strategies include mirroring and the striping of mirrors equvalent to traditional RAID 1 and 10 arrays but also includes “RaidZ” configurations that tolerate the failure of one, two or three member disks of a given set of member disks.
Find out more about ZFS in the Michael W. Lucas and Allan Jude webinar: “Why We Love ZFS and Why You Should Too” and check out their book at zfsbook.com.
WSL and ZFS in the same sentence? Clickbait! … well, if it was just few months ago I would have said: totally.
Windows Zfs Alternative
But we are “in the now”, and not only you will see it applied, but we will move to the Linux Kernel 5.x version (stream?).
Should I go on or it’s enough that you want me to shut-up and just show the how-to? That’s what I thought.
Follow the Corsair into this brand new Ocean.
As usual, here is the full list of the prerequisites:
- Windows 10 Insiders Fast v19587+
- WSL2 enabled and a distro installed - I will use Pengwin during this howto
config-wsl
kernel config file from the WSL2 Kernel repo- The latest stable Kernel - 5.5.10 at the time of the writing
- The latest ZFS source - v0.8.3 at the time of the writing
In order to be able to use ZFS, we first need to build a Kernel containing the module. So before continuing, ensure you have downloaded the prerequisites.
Let’s login into our WSL2 shell:
As shown in the screenshot, Pengwin actually displays which Kernel we are currently running on.
If you do not see it or you are using another distro, then type uname -a
to see it.
Before we build the Kernel, we need first to add the ZFS module.
ZFS: building the zeta module
Before we can build the module, we need, well, build tools and the potential dependencies.
Thankfully, the OpenZFS community is incredible, and an howto has already been done for an older version, so we will need to adapt it a bit. Let’s go into our WSL2 shell:
Once the packages installed, we need first to copy the config-wsl
inside the Kernel source and run make prepare scripts
:
Once the prepare
finished, we can build the ZFS module:
The module has been added to the Kernel sources and we can now enable it.
But before we do that, with all the work done, let’s install the ZFS binaries:
And an error appeared, but that’s OK. This is “good” error and we will fix it in the next section.
Kernel: build the future
We are finally back on the “kernel building track”, and before we can run the so much wanted make
(and have a more or less long pause), let’s first change the config
file and add the reference to the ZFS build:
Finally, the time is here to take a pause to build the kernel:
We have now our brand new kernel v5 with the ZFS module embedded.
Before we move on, let’s install the modules:
Now the last piece, we need to use it for our WSL2 distros.
WSL2: The future is now
Ok, let’s setup our custom Kernel:
Exit your WSL2 shell and start Powershell as an administrator:
We can finally start again our WSL2 shell and enjoy the new Kernel with ZFS:
For the ones still doubting: WSL2 is growing at a (crazy) fast pace. And all the build work was made inside WSL2, without any need of a VM or bare metal Linux.
Having the possibility to use the latest kernel, to had modules is something that some persons might have been looking for, and now it became a reality.
I hope you enjoyed this new gem from the Corsair’s chest and see you soon in the vast Linux Ocean … I simply have different ship.
>>> Nunix out <<<
oh sorry, you thought I was done? well almost, but I wanted to share one last trick.
As you may know (or not), all the distros installed under your user are running in the same microVM. Therefore the kernel and the ZFS module are also available to all the distros.
So, for all my Arch (based) distro loving friends:
Zfs Windows 10
Enjoy :)