Make bcachefs subvolumes boot-time mount tests pass + more tests

This commit is contained in:
nothingnesses authored and Jörg Thalheim committed 2025-05-04 22:17:15 +02:00
1 parent d0c543d740
commit 404786c442
4 files changed
+167 -176

No files matched your search

+40 -141
View File
@@ -23,7 +23,7 @@
content = {
type = "bcachefs";
# This refers to a filesystem in the `bcachefs_filesystems` attrset below.
filesystem = "unmounted_subvolumes_in_multi";
filesystem = "mounted_subvolumes_in_multi";
label = "group_a.vdb2";
extraFormatArgs = [
"--discard"
@@ -44,7 +44,7 @@
size = "100%";
content = {
type = "bcachefs";
filesystem = "unmounted_subvolumes_in_multi";
filesystem = "mounted_subvolumes_in_multi";
label = "group_a.vdc1";
extraFormatArgs = [
"--discard"
@@ -65,7 +65,7 @@
size = "100%";
content = {
type = "bcachefs";
filesystem = "unmounted_subvolumes_in_multi";
filesystem = "mounted_subvolumes_in_multi";
label = "group_b.vdd1";
extraFormatArgs = [
"--force"
@@ -79,87 +79,6 @@
vde = {
device = "/dev/vde";
type = "disk";
content = {
type = "gpt";
partitions = {
vde1 = {
size = "100%";
content = {
type = "bcachefs";
filesystem = "mounted_subvolumes_in_multi";
label = "group_a.vde1";
extraFormatArgs = [
"--discard"
];
};
};
};
};
};
vdf = {
device = "/dev/vdf";
type = "disk";
content = {
type = "gpt";
partitions = {
vdf1 = {
size = "100%";
content = {
type = "bcachefs";
filesystem = "mounted_subvolumes_in_multi";
label = "group_a.vdf1";
extraFormatArgs = [
"--discard"
];
};
};
};
};
};
vdg = {
device = "/dev/vdg";
type = "disk";
content = {
type = "gpt";
partitions = {
vdd1 = {
size = "100%";
content = {
type = "bcachefs";
filesystem = "mounted_subvolumes_in_multi";
label = "group_b.vdg1";
extraFormatArgs = [
"--force"
];
};
};
};
};
};
vdh = {
device = "/dev/vdh";
type = "disk";
content = {
type = "gpt";
partitions = {
vdd1 = {
size = "100%";
content = {
type = "bcachefs";
filesystem = "no_reliance_on_external_subvolume";
label = "group_a.vdh1";
};
};
};
};
};
vdi = {
device = "/dev/vdi";
type = "disk";
content = {
type = "gpt";
partitions = {
@@ -168,7 +87,7 @@
content = {
type = "bcachefs";
filesystem = "relies_on_external_subvolume";
label = "group_a.vdi1";
label = "group_a.vde1";
};
};
};
@@ -177,72 +96,52 @@
};
bcachefs_filesystems = {
# Example showing unmounted subvolumes in a multi-disk configuration.
unmounted_subvolumes_in_multi = {
# Example showing mounted subvolumes in a multi-disk configuration.
mounted_subvolumes_in_multi = {
type = "bcachefs_filesystem";
passwordFile = "/tmp/secret.key";
extraFormatArgs = [
"--compression=lz4"
"--background_compression=lz4"
];
subvolumes = {
# Subvolume name is different from mountpoint.
"subvolumes/root" = {
mountpoint = "/";
mountOptions = [
"verbose"
];
};
# Subvolume name is the same as the mountpoint.
"subvolumes/home" = {
mountpoint = "/home";
};
# Nested subvolume doesn't need a mountpoint as its parent is mounted.
"subvolumes/home/user" = {
};
# Parent is not mounted so the mountpoint must be set.
"subvolumes/nix" = {
mountpoint = "/nix";
};
# This subvolume will be created but not mounted.
"subvolumes/test" = {
};
};
};
# Example showing a bcachefs filesystem without subvolumes
# and which relies on a subvolume in another filesystem being mounted.
relies_on_external_subvolume = {
type = "bcachefs_filesystem";
mountpoint = "/home/Documents";
extraFormatArgs = [
"--compression=lz4"
"--background_compression=lz4"
];
mountOptions = [
"verbose"
];
mountpoint = "/";
subvolumes = {
"subvolumes/rootfs" = { };
"subvolumes/home" = { };
"subvolumes/home/user" = { };
"subvolumes/nix" = { };
"subvolumes/test" = { };
};
};
# # Example showing mounted subvolumes in a multi-disk configuration (not yet working).
# mounted_subvolumes_in_multi = {
# type = "bcachefs_filesystem";
# passwordFile = "/tmp/secret.key";
# extraFormatArgs = [
# "--compression=lz4"
# "--background_compression=lz4"
# ];
# mountOptions = [
# "verbose"
# ];
# subvolumes = {
# # Subvolume name is different from mountpoint
# "foo" = {
# mountpoint = "/bar";
# };
# # Subvolume name is the same as the mountpoint
# "home" = {
# mountpoint = "/home";
# };
# # Sub(sub)volume doesn't need a mountpoint as its parent is mounted
# "home/user" = {
# };
# # Parent is not mounted so the mountpoint must be set
# "nix" = {
# mountpoint = "/nix";
# };
# # This subvolume will be created but not mounted
# "test" = {
# };
# };
# };
# Example showing another bcachefs filesystem.
no_reliance_on_external_subvolume = {
type = "bcachefs_filesystem";
mountpoint = "/sometestdir";
};
# # Example showing another bcachefs filesystem that relies on a subvolume
# # in another filesystem being mounted (not yet working).
# relies_on_external_subvolume = {
# type = "bcachefs_filesystem";
# mountpoint = "/home/somedir/vdf1";
# };
};
};
}