User:2r/NixOS on ZFS: Difference between revisions

imported>2r
Created page with "This is a userspace draft and is not supported by NixOS Wiki. == Enable ZFS on Existing Installation == Add the following lines to configuration: <pre>boot.supportedFilesyste..."
 
imported>2r
No edit summary
Line 14: Line 14:
As swap on ZFS will cause deadlock and does not support hibernation, a separate swap partition should be created.
As swap on ZFS will cause deadlock and does not support hibernation, a separate swap partition should be created.


GRUB supports decrypting LUKS1 container and limited ZFS features, a separate, feature limited boot pool is created for compatibility.
{| class="wikitable"
{| class="wikitable"
  |+ GPT partition table
  |+ GPT partition table
Line 49: Line 48:
As NixOS lacks a service to handle native ZFS mounting at boot, such as <code>zfs-mount-generator</code>, all mountable datasets must be created with <code>mountpoint=legacy</code> to be mounted with <code>fileSystems</code> option.
As NixOS lacks a service to handle native ZFS mounting at boot, such as <code>zfs-mount-generator</code>, all mountable datasets must be created with <code>mountpoint=legacy</code> to be mounted with <code>fileSystems</code> option.


Datasets with <code>canmount=off</code> are used as containers, that is, no data is stored directly under such datasets, but child datasets can inherit their properties or imitate directory structures, such as <code>/var/log</code>.
Datasets with <code>canmount=off mountpoint=none</code> are used as containers, that is, no data is stored directly under such datasets, but child datasets can inherit their properties or imitate directory structures, such as <code>/var/log</code>.


When creating pools, a default dataset with the same name as the pool name is also created.
{| class="wikitable"
{| class="wikitable"
  |+ Dataset layout
  |+ Dataset layout
  |colspan="3"|<code>canmount=off</code>
|-
  |<code>canmount=noauto</code>
  |colspan="3"| Containers
|
| mountpoint
| canmount
  | comment
  |-
  |-
  | bpool
  | bpool
Line 61: Line 63:
  | BOOT
  | BOOT
  | default
  | default
| /boot
| noauto
  |-
  |-
  |rowspan="2"| rpool
  |rowspan="3"| rpool
  |rowspan="2"| sys
  |rowspan="3"| sys
  | ROOT
  | ROOT
  | default
  | default
| /
| noauto
  |-
  |-
  | DATA
  |rowspan="2"| DATA
  | default
  | local
| /
| off
| container for datasets that do not need backup, such as /nix
|-
| safe
| /
| off
| container for datasets that need backup, such as /{root,home,home,user}
  |}
  |}