From 1237ac36db1a457ae561134d191d2924a9ce5ffc Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 25 Aug 2022 13:13:20 +0200 Subject: fix mdadm mounting, move test to mdadm test --- example/mdadm.nix | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ example/raid.nix | 60 ------------------------------------------------------- 2 files changed, 59 insertions(+), 60 deletions(-) create mode 100644 example/mdadm.nix delete mode 100644 example/raid.nix (limited to 'example') diff --git a/example/mdadm.nix b/example/mdadm.nix new file mode 100644 index 0000000..cb0ad91 --- /dev/null +++ b/example/mdadm.nix @@ -0,0 +1,59 @@ +# usage: nix-instantiate --eval --json --strict example/config.nix | jq . +{ + type = "devices"; + content = { + vdb = { + type = "table"; + format = "gpt"; + partitions = [ + { + type = "partition"; + part-type = "primary"; + start = "1MiB"; + end = "100%"; + content = { + type = "mdraid"; + name = "raid1"; + }; + } + ]; + }; + vdc = { + type = "table"; + format = "gpt"; + partitions = [ + { + type = "partition"; + part-type = "primary"; + start = "1MiB"; + end = "100%"; + content = { + type = "mdraid"; + name = "raid1"; + }; + } + ]; + }; + raid1 = { + type = "mdadm"; + level = 1; + content = { + type = "table"; + format = "gpt"; + partitions = [ + { + type = "partition"; + part-type = "primary"; + start = "1MiB"; + end = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/raid"; + }; + } + ]; + }; + }; + }; +} diff --git a/example/raid.nix b/example/raid.nix deleted file mode 100644 index 490ea01..0000000 --- a/example/raid.nix +++ /dev/null @@ -1,60 +0,0 @@ -# usage: nix-instantiate --eval --json --strict example/config.nix | jq . -{ - type = "devices"; - content = { - vdb = { - type = "table"; - format = "gpt"; - partitions = [ - { - type = "partition"; - part-type = "primary"; - start = "1MiB"; - end = "100%"; - content = { - type = "mdraid"; - name = "raid1"; - }; - } - ]; - }; - vdc = { - type = "table"; - format = "gpt"; - partitions = [ - { - type = "partition"; - part-type = "primary"; - start = "1MiB"; - end = "100%"; - content = { - type = "mdraid"; - name = "raid1"; - }; - } - ]; - }; - raid1 = { - type = "mdadm"; - level = 1; - content = { - type = "table"; - format = "gpt"; - partitions = [ - { - type = "partition"; - part-type = "primary"; - start = "1MiB"; - end = "100%"; - content = { - type = "filesystem"; - format = "ext4"; - mountpoint = "/raid"; - }; - } - ]; - - }; - }; - }; -} -- cgit v1.2.3 From dd99e29edc994056d5f700e24a75406115e98dff Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 25 Aug 2022 13:14:07 +0200 Subject: fix cryptsetup luksOpen idempotency, add luks-lvm test --- example/luks-lvm.nix | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 example/luks-lvm.nix (limited to 'example') diff --git a/example/luks-lvm.nix b/example/luks-lvm.nix new file mode 100644 index 0000000..d0b4d26 --- /dev/null +++ b/example/luks-lvm.nix @@ -0,0 +1,78 @@ +{ + type = "devices"; + content = { + vdb = { + type = "table"; + format = "gpt"; + partitions = [ + { + type = "partition"; + part-type = "ESP"; + start = "1MiB"; + end = "100MiB"; + fs-type = "FAT32"; + bootable = true; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + options = [ + "defaults" + ]; + }; + } + { + type = "partition"; + part-type = "primary"; + start = "100MiB"; + end = "100%"; + content = { + type = "luks"; + algo = "aes-xts..."; + name = "crypted"; + keyfile = "/tmp/secret.key"; + extraArgs = [ + "--hash sha512" + "--iter-time 5000" + ]; + content = { + type = "lvm"; + name = "pool"; + lvs = { + root = { + type = "lv"; + size = "100M"; + mountpoint = "/"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + options = [ + "defaults" + ]; + }; + }; + home = { + type = "lv"; + size = "10M"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/home"; + }; + }; + raw = { + type = "lv"; + size = "10M"; + content = { + type = "noop"; + }; + }; + }; + }; + }; + } + ]; + }; + }; +} -- cgit v1.2.3 From 83fb8f661eb574f32fad1d51bbebd0c36595db01 Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 25 Aug 2022 15:08:26 +0200 Subject: add zfs support/test/example --- example/zfs.nix | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 example/zfs.nix (limited to 'example') diff --git a/example/zfs.nix b/example/zfs.nix new file mode 100644 index 0000000..e344289 --- /dev/null +++ b/example/zfs.nix @@ -0,0 +1,41 @@ +{ + type = "devices"; + content = { + vdb = { + type = "zfs"; + pool = "zroot"; + }; + vdc = { + type = "zfs"; + pool = "zroot"; + }; + zroot = { + type = "zpool"; + mode = "mirror"; + datasets = [ + { + type = "zfs_filesystem"; + name = "zfs_fs"; + mountpoint = "/zfs_fs"; + } + { + type = "zfs_filesystem"; + name = "zfs_legacy_fs"; + options.mountpoint = "legacy"; + mountpoint = "/zfs_legacy_fs"; + } + { + type = "zfs_volume"; + name = "zfs_testvolume"; + size = "10M"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/ext4onzfs"; + }; + } + ]; + }; + }; +} + -- cgit v1.2.3 From dadc49133042834dada6eafc98dcb1f7f2c5e43b Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 25 Aug 2022 18:36:56 +0200 Subject: add lvm raid --- example/luks-lvm.nix | 69 +++++++++++++++++++++++++++------------------------- example/lvm-raid.nix | 66 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+), 33 deletions(-) create mode 100644 example/lvm-raid.nix (limited to 'example') diff --git a/example/luks-lvm.nix b/example/luks-lvm.nix index d0b4d26..22c029e 100644 --- a/example/luks-lvm.nix +++ b/example/luks-lvm.nix @@ -36,43 +36,46 @@ "--iter-time 5000" ]; content = { - type = "lvm"; - name = "pool"; - lvs = { - root = { - type = "lv"; - size = "100M"; - mountpoint = "/"; - content = { - type = "filesystem"; - format = "ext4"; - mountpoint = "/"; - options = [ - "defaults" - ]; - }; - }; - home = { - type = "lv"; - size = "10M"; - content = { - type = "filesystem"; - format = "ext4"; - mountpoint = "/home"; - }; - }; - raw = { - type = "lv"; - size = "10M"; - content = { - type = "noop"; - }; - }; - }; + type = "lvm_pv"; + vg = "pool"; }; }; } ]; }; + pool = { + type = "lvm_vg"; + lvs = { + root = { + type = "lvm_lv"; + size = "100M"; + mountpoint = "/"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + options = [ + "defaults" + ]; + }; + }; + home = { + type = "lvm_lv"; + size = "10M"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/home"; + }; + }; + raw = { + type = "lvm_lv"; + size = "10M"; + content = { + type = "noop"; + }; + }; + }; + }; }; } diff --git a/example/lvm-raid.nix b/example/lvm-raid.nix new file mode 100644 index 0000000..48930ec --- /dev/null +++ b/example/lvm-raid.nix @@ -0,0 +1,66 @@ +{ + type = "devices"; + content = { + vdb = { + type = "table"; + format = "gpt"; + partitions = [ + { + type = "partition"; + part-type = "primary"; + start = "0%"; + end = "100%"; + content = { + type = "lvm_pv"; + vg = "pool"; + }; + } + ]; + }; + vdc = { + type = "table"; + format = "gpt"; + partitions = [ + { + type = "partition"; + part-type = "primary"; + start = "0%"; + end = "100%"; + content = { + type = "lvm_pv"; + vg = "pool"; + }; + } + ]; + }; + pool = { + type = "lvm_vg"; + lvs = { + root = { + type = "lvm_lv"; + size = "100M"; + mountpoint = "/"; + lvm_type = "mirror"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + options = [ + "defaults" + ]; + }; + }; + home = { + type = "lvm_lv"; + size = "10M"; + lvm_type = "raid0"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/home"; + }; + }; + }; + }; + }; +} -- cgit v1.2.3 From 81e704b638a8a7158bd9106b7fd592fb982d1864 Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 25 Aug 2022 21:46:17 +0200 Subject: add btrfs subvolumes --- example/btrfs-subvolumes.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 example/btrfs-subvolumes.nix (limited to 'example') diff --git a/example/btrfs-subvolumes.nix b/example/btrfs-subvolumes.nix new file mode 100644 index 0000000..0124c86 --- /dev/null +++ b/example/btrfs-subvolumes.nix @@ -0,0 +1,26 @@ +{ + type = "devices"; + content = { + vdb = { + type = "table"; + format = "gpt"; + partitions = [ + { + type = "partition"; + part-type = "primary"; + start = "0%"; + end = "100%"; + content = { + type = "btrfs"; + mountpoint = "/"; + subvolumes = [ + "/home" + "/test" + ]; + }; + } + ]; + }; + }; +} + -- cgit v1.2.3 From 57b7c5506a64e169370f291bffa75d2888027ee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 26 Aug 2022 09:07:24 +0200 Subject: also test zfs filesystem options --- example/zfs.nix | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'example') diff --git a/example/zfs.nix b/example/zfs.nix index e344289..2b56bd7 100644 --- a/example/zfs.nix +++ b/example/zfs.nix @@ -12,11 +12,16 @@ zroot = { type = "zpool"; mode = "mirror"; + rootFsOptions = { + compression = "lz4"; + "com.sun:auto-snapshot" = "false"; + }; datasets = [ { type = "zfs_filesystem"; name = "zfs_fs"; mountpoint = "/zfs_fs"; + options."com.sun:auto-snapshot" = "true"; } { type = "zfs_filesystem"; -- cgit v1.2.3 From 722dde361ca51864fd9b3b6b9a78875e436fbc24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 26 Aug 2022 10:28:07 +0200 Subject: zfs: support for root dataset mountpoint and mountpoint=none --- example/zfs.nix | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'example') diff --git a/example/zfs.nix b/example/zfs.nix index 2b56bd7..60e4700 100644 --- a/example/zfs.nix +++ b/example/zfs.nix @@ -16,6 +16,8 @@ compression = "lz4"; "com.sun:auto-snapshot" = "false"; }; + mountpoint = "/"; + datasets = [ { type = "zfs_filesystem"; @@ -23,6 +25,11 @@ mountpoint = "/zfs_fs"; options."com.sun:auto-snapshot" = "true"; } + { + type = "zfs_filesystem"; + name = "zfs_unmounted_fs"; + options.mountpoint = "none"; + } { type = "zfs_filesystem"; name = "zfs_legacy_fs"; -- cgit v1.2.3 From 9bb4aec9640cbc30e241c267158e506278862b5e Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 26 Aug 2022 12:50:52 +0200 Subject: support zfs over legacy fs --- example/zfs-over-legacy.nix | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 example/zfs-over-legacy.nix (limited to 'example') diff --git a/example/zfs-over-legacy.nix b/example/zfs-over-legacy.nix new file mode 100644 index 0000000..8f5a8bc --- /dev/null +++ b/example/zfs-over-legacy.nix @@ -0,0 +1,42 @@ +{ + type = "devices"; + content = { + vdb = { + type = "table"; + format = "gpt"; + partitions = [ + { + type = "partition"; + # leave space for the grub aka BIOS boot + start = "0%"; + end = "100%"; + part-type = "primary"; + bootable = true; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + } + ]; + }; + vdc = { + type = "zfs"; + pool = "zroot"; + }; + zroot = { + type = "zpool"; + mountpoint = "/"; + + datasets = [ + { + type = "zfs_filesystem"; + name = "zfs_fs"; + mountpoint = "/zfs_fs"; + options."com.sun:auto-snapshot" = "true"; + } + ]; + }; + }; +} + -- cgit v1.2.3