ZFS: Difference between revisions

Tboston (talk | contribs)
finalize zfs install on root example
Tboston (talk | contribs)
fix missing dev and update fixing the disk IDs
Line 156: Line 156:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
mkswap -L swap /dev/nvme0n1p2
mkswap -L swap /dev/nvme0n1p2
swapon  
swapon /dev/nvme0n1p2
</syntaxhighlight>
</syntaxhighlight>


'''Installation:'''
'''Installation:'''
Line 181: Line 180:
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
{
{
...
   # Boot loader config for configuration.nix:
   # Boot loader config for configuration.nix:
   boot.loader.systemd-boot.enable = true;
   boot.loader.systemd-boot.enable = true;
Line 186: Line 186:
   # for local disks that are not shared over the network, we don't need this to be random
   # for local disks that are not shared over the network, we don't need this to be random
   networking.hostId = "8425e349";
   networking.hostId = "8425e349";
...
</syntaxhighlight>


Now check the hardware-configuration.nix in <code>/mnt/etc/nixos/hardware-configuration.nix</code> and add whats missing e.g. <code>options = [ "zfsutil" ] for all filesystems and <code>randomEncryption = true;</code> for the swap partition. Also change the generated swap device to the partition we created e.g. <code>/dev/disk/by-id/nvme-SKHynix_HFS512GDE9X081N_FNB6N634510106K5O-part2</code> in this case and <code>/dev/disk/by-id/nvme-SKHynix_HFS512GDE9X081N_FNB6N634510106K5O-part1</code> for boot.
<syntaxhighlight lang="nix">
...
   fileSystems."/" = {  
   fileSystems."/" = {  
     device = "zpool/root";
     device = "zpool/root";
Line 213: Line 219:


   fileSystems."/boot" = {  
   fileSystems."/boot" = {  
   device = "/dev/disk/by-partlabel/boot";
   device = "/dev/disk/by-id/nvme-SKHynix_HFS512GDE9X081N_FNB6N634510106K5O-part1";
   fsType = "vfat";
   fsType = "vfat";
   };
   };


   swapDevices = [{
   swapDevices = [{
     device = "/dev/disk/by-partlabel/swap";
     device = "/dev/disk/by-id/nvme-SKHynix_HFS512GDE9X081N_FNB6N634510106K5O-part2";
     randomEncryption = true;
     randomEncryption = true;
   }];
   }];