mirror of
https://github.com/nix-community/disko.git
synced 2026-11-30 13:03:28 +01:00
Add bcachefs type with encryption and multi-disk support
This update introduces a bcachefs type with encryption support and advanced formatting options. It includes a new example (`examples/bcachefs-multi-disk.nix`) to demonstrate multi-disk setups and available options. Key changes: - Deterministic UUID generation. - Addressed limitations with multi-disk root setups due to bcachefs and systemd issues. - Provided a systemd-mount alternative for fileSystems configuration. - Added subvolume support and updated scripts for clarity and functionality. --------- Co-authored-by: Jonas Heinrich <onny@project-insanity.org> Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com> Co-authored-by: Kyle Petryszak <6314611+ProjectInitiative@users.noreply.github.com> Update * Add examples * Improve descriptions Remove debugging Remove comment Use `unique` to dedup lists
This commit is contained in:
1 parent
c5140c6079
commit
ca27b88c88
6 files changed
+698
-14
No files matched your search
+224
-10
@@ -1,15 +1,15 @@
|
||||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
main = {
|
||||
device = "/dev/disk/by-path/pci-0000:02:00.0-nvme-1";
|
||||
vdb = {
|
||||
device = "/dev/vdb";
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
end = "500M";
|
||||
vdb1 = {
|
||||
type = "EF00";
|
||||
size = "100M";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
@@ -17,18 +17,232 @@
|
||||
mountOptions = [ "umask=0077" ];
|
||||
};
|
||||
};
|
||||
root = {
|
||||
name = "root";
|
||||
end = "-0";
|
||||
|
||||
vdb2 = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "bcachefs";
|
||||
mountpoint = "/";
|
||||
type = "bcachefs";
|
||||
# This refers to a filesystem in the `bcachefs_filesystems` attrset below.
|
||||
filesystem = "unmounted_subvolumes_in_multi";
|
||||
label = "group_a.vdb2";
|
||||
extraFormatArgs = [
|
||||
"--discard"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
vdc = {
|
||||
device = "/dev/vdc";
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
vdc1 = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "bcachefs";
|
||||
filesystem = "unmounted_subvolumes_in_multi";
|
||||
label = "group_a.vdc1";
|
||||
extraFormatArgs = [
|
||||
"--discard"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
vdd = {
|
||||
device = "/dev/vdd";
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
vdd1 = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "bcachefs";
|
||||
filesystem = "unmounted_subvolumes_in_multi";
|
||||
label = "group_b.vdd1";
|
||||
extraFormatArgs = [
|
||||
"--force"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
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 = {
|
||||
vdd1 = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "bcachefs";
|
||||
filesystem = "relies_on_external_subvolume";
|
||||
label = "group_a.vdi1";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
bcachefs_filesystems = {
|
||||
# Example showing unmounted subvolumes in a multi-disk configuration.
|
||||
unmounted_subvolumes_in_multi = {
|
||||
type = "bcachefs_filesystem";
|
||||
passwordFile = "/tmp/secret.key";
|
||||
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";
|
||||
# };
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user