

# Set optionsįor example, I have the dataset home which I’ll be mounting at /home in future, which has a reasonable amount of compression set, so things like dotfiles and other bits of cruft stored in my home directory can benefit from some nice compression. If you think you might want to snapshot a directory, it needs to be a dataset. Snapshots can only be done to datasets or pools, not specific directories. # Create datasetsĭatasets are one of ZFS’ great features, allowing you to snapshot specific directories from your pool and set properties more suited to the data stored inside them. Note that encryption cannot be toggled once the pool / dataset has been created. Encryption can also be set at the dataset level instead, should you want some things to be unencrypted, or encrypted using a different key.

If you, like me, need to encrypt your pool, now is the time to do it. This means that in future should I want to move other directories on the OS onto ZFS (such as databases), I can without feeling back about an inaccurately named pool. Notice that I’ve not named my pool “home”. $ sudo zpool create data -m /mnt/data /dev/nvme0n1p4 When creating the pool, be sure to set a custom mount point to ensure ZFS doesn’t mount at /home, which right now would cause some issues as there’s nothing there! Now create the pool, using whichever custom properties you wish.

ZFS runs totally fine given just a partition rather than the entire disk. If you intend to put the home pool on a separate disk entirely, then you can allocate ZFS the entire disk instead. In my case the laptop only has a single drive, so I’ve partitioned the drive. I’ve allocated 150GB for the OS, and 350GB for the ZFS pool. My laptop has a 500GB drive, and I’m expecting most of my files to be stored in my home directory, so I want it allocated the most space.
Ubuntu openzfs 2.0 how to#
The Arch wiki has great documentation on how to do this, whether you’re using Arch or not. The home directory isn’t needed for boot but will be needed once you want to log in, so it’ll need to be loaded on boot, and set up to automatically import pools. Exactly how this is done varies between different platforms, so best find a guide for your exact one.

Ubuntu openzfs 2.0 install#
Naturally, to have a ZFS-based filesystem, you need to install ZFS. I recently got a new work machine (and a new job) and wanted to set it up with a nice snapshotted OS, but with the benefits and familiar interface of ZFS for the directories I’m most likely to be using. Should the ZFS module fail to load correctly, you’re left with a machine you can log in to and debug the issue rather than a completely broken installation. Instead of using ZFS on root, using ZFS for your home directory and perhaps a few other directories, with BTRFS for the root is a much safer choice. Canonical are making this easier for Ubuntu users by tightly controlling and testing the kernel and ZFS to ensure the versions integrate correctly, reducing the risk of the system failing to boot - but the odds aren’t 0. ZFS is a great filesystem, especially for any kind of data storage, but the fact it’s not integrated into the Linux kernel makes it a risky choice for the root OS.
