ZFS: Difference between revisions

imported>Cyounkins
Under ZED, moved msmtp doc into separate page
imported>Aidalgol
Line 280: Line 280:


=== Laying out the filesystem hierarchy ===
=== Laying out the filesystem hierarchy ===
In this guide, we will be using a <code>tmpfs</code> for <code>/</code>, since no system state will be stored outside of the ZFS datasets we will create.
<syntaxhighlight lang="bash">
sudo mount -t tmpfs none /mnt
</syntaxhighlight>
==== Create the ZFS pool ====
==== Create the ZFS pool ====
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
Line 317: Line 312:
</syntaxhighlight>
</syntaxhighlight>


Create the datasets for the operating system.
Create the datasets for the operating system. (Experienced ZFS users may wish to split up the OS datasets further.)
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
sudo zfs create -o canmount=off -o mountpoint=/ rpool/nixos
sudo zfs create -o canmount=on -o mountpoint=/ rpool/nixos
sudo zfs create -o canmount=on rpool/nixos/nix
sudo zfs create rpool/nixos/nix
sudo zfs create -o canmount=on rpool/nixos/etc
sudo zfs create -o canmount=on rpool/nixos/var
sudo zfs create -o canmount=on rpool/nixos/var/lib
sudo zfs create -o canmount=on rpool/nixos/var/log
sudo zfs create -o canmount=on rpool/nixos/var/spool
</syntaxhighlight>
</syntaxhighlight>


Line 395: Line 385:
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
swapDevices = [
swapDevices = [
   { device = "/dev/disk/by-id/foo-part2";
   { device = "/dev/disk/by-id/DISK1-part2";
     randomEncryption = true;
     randomEncryption = true;
   }
   }
   { device = "/dev/disk/by-id/bar-part2";
   { device = "/dev/disk/by-id/DISK2-part2";
     randomEncryption = true;
     randomEncryption = true;
   }
   }