From cee27e584c1bd639b925a8fc160f772f1744a5bc Mon Sep 17 00:00:00 2001 From: hand7s <117505144+s0me1newithhand7s@users.noreply.github.com> Date: Sun, 23 Mar 2025 15:12:00 +0300 Subject: [PATCH] add btrfs-raid1 example --- example/btrfs-raid1.nix | 65 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 example/btrfs-raid1.nix diff --git a/example/btrfs-raid1.nix b/example/btrfs-raid1.nix new file mode 100644 index 00000000..74e5b00a --- /dev/null +++ b/example/btrfs-raid1.nix @@ -0,0 +1,65 @@ +{ + disko.devices = { + disk = { + nvme0 = { + type = "disk"; + device = "/dev/nvme0n1"; + content = { + type = "gpt"; + partitions = { + ESP = { + type = "EF00"; + size = "1024M"; + name = "boot"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ + "umask=0022" + "iocharset=utf8" + "rw" + ]; + }; + }; + empty = { + # in order for btrfs raid to work we need to do this + size = "100%"; + }; + }; + }; + }; + nvme1 = { + type = "disk"; + device = "/dev/nvme1n1"; + content = { + type = "gpt"; + partitions = { + root = { + size = "100%"; + content = { + type = "btrfs"; + extraArgs = [ + "-f" + "-m raid1" + "-d single" + "/dev/nvme0n1p2" # needs to be partition 2 of 1st disk and needs to be 2nd disk + ]; + mountpoint = "/"; + mountOptions = [ + "rw" + "ssd_spread" + "max_inline=256" + "commit=150" + "compress=zstd" + "noatime" + "discard=async" + ]; + }; + }; + }; + }; + }; + }; + }; +}