I’ve recently installed NixOS on ZFS. I have two NVMe drives and both of them have two partitions: 1G for “EFI System” (EF00) and the rest of the disk space for “Solaris root” (BF00). ZFS pool has a single mirror vdev that consists of two BF00 partitions mentioned above. The EF00 partitions are formatted with mkfs.vfat -F 32
. I’ve also configured GRUB to use both of these partitions (with mirroredBoots
option).
Here’s the relevant snippet of my configuration.nix
:
boot.loader.grub = {
enable = true;
efiSupport = true;
mirroredBoots = [
{
path = "/boot";
devices = [ "nodev" ];
}
{
path = "/boot-fallback";
devices = [ "nodev" ];
}
];
};
boot.zfs.devNodes = "/dev/disk/by-id";
boot.supportedFilesystems = [ "zfs" ];
boot.loader.efi.canTouchEfiVariables = true;
fileSystems."/" = {
device = "zroot/os";
fsType = "zfs";
};
fileSystems."/nix" = {
device = "zroot/nix";
fsType = "zfs";
};
fileSystems."/home" = {
device = "zroot/home";
fsType = "zfs";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/2710-238A";
fsType = "vfat";
options = [ "nofail" ];
};
fileSystems."/boot-fallback" = {
device = "/dev/disk/by-uuid/2778-3DBA";
fsType = "vfat";
options = [ "nofail" ];
};
The configuration seems to work as expected, but I’m a bit worried that ZFS snapshots won’t include /boot
and /boot-fallback
.
In case of boot partitions corruption, is there a way to “restore” or “generate” /boot
using NixOS Live USB and nixos-enter
(or some other utilities)?