ZFS: Difference between revisions
imported>Thblt m Typo |
imported>Eskytthe No edit summary |
||
Line 27: | Line 27: | ||
== Guides == | == Guides == | ||
==== '''OpenZFS Documentation for installing:''' ==== | |||
{{warning|This guide is not endorsed by NixOS and some features like immutable root do not have upstream support and could break on updates. If an issue arises while following this guide, please consult the guides support channels.}} | {{warning|This guide is not endorsed by NixOS and some features like immutable root do not have upstream support and could break on updates. If an issue arises while following this guide, please consult the guides support channels.}} | ||
Line 40: | Line 40: | ||
* Give understandable, easy to follow and close to the standard installation guide instructions | * Give understandable, easy to follow and close to the standard installation guide instructions | ||
* integrating ZFS into your existing config | * integrating ZFS into your existing config | ||
==== '''Simple nixos zfs installation''' ==== | |||
Start from here in the NixOS manual: [https://nixos.org/manual/nixos/stable/#sec-installation-manual]. | |||
Under manual partitioning [https://nixos.org/manual/nixos/stable/#sec-installation-manual-partitioning] do this instead: | |||
'''Partition your disk with an boot and an zfs partition with your favorite partition tool.''' | |||
Eg. 1G for boot partion, rest for zfs. | |||
Example output from fdisk: | |||
<syntaxhighlight lang="bash"> | |||
fdisk /dev/nvme0n1 | |||
Command (m for help): p | |||
Disk /dev/nvme0n1: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors | |||
... | |||
Device Start End Sectors Size Type | |||
/dev/nvme0n1p1 2048 2099199 2097152 1G EFI System | |||
/dev/nvme0n1p2 2099200 1953523711 1951424512 930.5G Linux filesystem | |||
</syntaxhighlight> | |||
'''Note:''' Remember to set boot partition (first partition) to "EFI System" type | |||
'''Make zfs pool with encryption and mount points:''' | |||
<syntaxhighlight lang="bash"> | |||
zpool create -O encryption=on -O keyformat=passphrase -O keylocation=prompt -O compression=on -O mountpoint=none -O xattr=sa -O acltype=posixacl zpool /dev/nvme0n1p2 | |||
zfs create -o mountpoint=legacy zpool/root | |||
zfs create -o mountpoint=legacy zpool/nix | |||
zfs create -o mountpoint=legacy zpool/var | |||
zfs create -o mountpoint=legacy zpool/home | |||
mkdir /mnt/root | |||
mount -F zfs zpool/root /mnt | |||
mkdir /mnt/nix /mnt/var /mnt/home | |||
mount -F zfs zpool/nix /mnt/nix | |||
mount -F zfs zpool/var /mnt/var | |||
mount -F zfs zpool/zpool /mnt/zpool | |||
</syntaxhighlight> | |||
Output from <syntaxhighlight lang="bash" inline>zpool status</syntaxhighlight>: | |||
<syntaxhighlight > | |||
zpool status | |||
pool: zpool | |||
state: ONLINE | |||
... | |||
config: | |||
NAME STATE READ WRITE CKSUM | |||
zpool ONLINE 0 0 0 | |||
nvme-eui.0025384b21406566-part2 ONLINE 0 0 0 | |||
</syntaxhighlight> | |||
'''Make fat filesystem on boot partition''' | |||
<syntaxhighlight lang="bash"> | |||
mkfs.fat -F 32 -n boot /dev/nvme0n1p1 | |||
</syntaxhighlight> | |||
'''Installation:''' | |||
Install: [https://nixos.org/manual/nixos/stable/#sec-installation-manual-installing] | |||
Jump to "2. UEFI systems" | |||
<syntaxhighlight lang="bash"> | |||
mkdir -p /mnt/boot | |||
mount /dev/disk/by-label/boot /mnt/boot | |||
</syntaxhighlight> | |||
Jump to "4." ... /mnt/etc/nixos/configuration.nix ... | |||
Continue from here and add this Boot loader config to your configuration.nix: | |||
<syntaxhighlight lang="nix"> | |||
Boot loader config for configuration.nix: | |||
boot.loader.grub = { | |||
enable = true; | |||
zfsSupport = true; | |||
efiSupport = true; | |||
efiInstallAsRemovable = true; | |||
mirroredBoots = [ | |||
{ devices = [ "nodev"]; path = "/boot"; } | |||
]; | |||
}; | |||
</syntaxhighlight> | |||
'''Note:''' Remove / comment out <syntaxhighlight lang="nix" inline>boot.loader.systemd-boot.enable = true;</syntaxhighlight> config if added by<syntaxhighlight lang="nix" inline>nixos-generate-config</syntaxhighlight> | |||
== Importing on boot == | == Importing on boot == |