Jump to content

ZFS: Difference between revisions

228 bytes added ,  23 March 2023
no edit summary
imported>Vater
(little introduction)
imported>Vater
No edit summary
Line 7: Line 7:
== Limitations ==
== Limitations ==


* Newest kernels might not be supported by ZFS yet. If you are running an newer kernel which is not yet officially supported by zfs, the zfs module will refuse to evaluate and show up as ''broken''.  Use <code>boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;</code>
==== latestCompatibleLinuxPackages of ZFS for boot.kernelPackages ====


* ZFS does not support swapHibernation must be either disabled with <code><nowiki>boot.kernelParams = [ "nohibernate" ];</nowiki></code>, or enabled with a separate, non-ZFS swap partition.
Newest kernels might not be supported by ZFS yet. If you are running an newer kernel which is not yet officially supported by zfs, the zfs module will refuse to evaluate and show up as ''broken''Use <code>boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;</code>


* If you are running within a VM and NixOS fails to import the zpool on reboot, you may need to add <syntaxhighlight lang="nix" inline>boot.zfs.devNodes = "/dev/disk/by-path";</syntaxhighlight> to your configuration.nix file.
==== missing support for SWAP on ZFS ====
 
ZFS does not support swap. Hibernation must be either disabled with <code><nowiki>boot.kernelParams = [ "nohibernate" ];</nowiki></code>, or enabled with a separate, non-ZFS swap partition.
 
==== boot.zfs.devNodes in virtual machines ====
 
If you are running within a VM and NixOS fails to import the zpool on reboot, you may need to add <syntaxhighlight lang="nix" inline>boot.zfs.devNodes = "/dev/disk/by-path";</syntaxhighlight> to your configuration.nix file.
 
==== declarative mounting of ZFS datasets ====


* If possible, use legacy mountpoints <code>zfs create -o mountpoint=legacy</code> and declare mountpoints with <code>fileSystems."/mount/point" = {};</code>.  ZFS native mountpoints are not managed as part of the system state. This can lead to conflicts if ZFS mount service is also enabled for the same datasets.  Disable it with <code>systemd.services.zfs-mount.enable = false;</code>.
* If possible, use legacy mountpoints <code>zfs create -o mountpoint=legacy</code> and declare mountpoints with <code>fileSystems."/mount/point" = {};</code>.  ZFS native mountpoints are not managed as part of the system state. This can lead to conflicts if ZFS mount service is also enabled for the same datasets.  Disable it with <code>systemd.services.zfs-mount.enable = false;</code>.


== Enable ZFS support ==
== Guides ==


Common ZFS installation guides are now maintained at [https://openzfs.github.io/openzfs-docs/Getting%20Started/NixOS/index.html OpenZFS Documentation] website. Visit there for details and if an issue arises, submit an issue or pull request.
; OpenZFS Documentation for installing:


== Root on ZFS ==
A guide for common ZFS installation is maintained as [https://openzfs.github.io/openzfs-docs/Getting%20Started/NixOS/ OpenZFS Documentation].


Root on ZFS guide is now maintained at [https://openzfs.github.io/openzfs-docs/Getting%20Started/NixOS/Root%20on%20ZFS.html OpenZFS Documentation] website. Visit there for details and if an issue arises, submit an issue or pull request.
It is about
* [https://openzfs.github.io/openzfs-docs/Getting%20Started/NixOS/index.html#installation enabling ZFS on an existing NixOS installation] and
* [https://openzfs.github.io/openzfs-docs/Getting%20Started/NixOS/#root-on-zfs (installing NixOS with) Root on ZFS].


==Importing on boot==
If an issue arises for this guide, submit an issue or pull request there.
 
== Importing on boot ==


If you create a zpool, it will not be imported on the next boot unless you either add the zpool name to <syntaxhighlight lang="nix" inline>boot.zfs.extraPools</syntaxhighlight>:
If you create a zpool, it will not be imported on the next boot unless you either add the zpool name to <syntaxhighlight lang="nix" inline>boot.zfs.extraPools</syntaxhighlight>:
Line 95: Line 107:


== NFS share ==
== NFS share ==
With <code>sharenfs</code> property, ZFS has build-in support for generating <code>/etc/exports.d/zfs.exports</code> file, which in turn is processed by NFS service automatically.
With <code>sharenfs</code> property, ZFS has build-in support for generating <code>/etc/exports.d/zfs.exports</code> file, which in turn is processed by NFS service automatically.


Anonymous user