disko
disko copied to clipboard
top-level option for btrfs multi-device volume
Context
I am looking to implement a layout composed of two NVMe devices, similar to the following example:
In contrast to that example, I would like to use BTRFS' native support for multi-device volumes instead of using mdadm:
mkfs.btrfs --force \
--label nixos \
--data single \
--metadata raid1 \
"${NVME01}p3" \
"${NVME02}p3"
Problem
I would expect to be able to configure subvolumes for a multi-device BTRFS volume at disko.devices.btrfs
(or some more-fitting name) in the same way that other volume-like domains e.g. mdadm
, zpool
do:
https://github.com/nix-community/disko/blob/5d9f362aecd7a4c2e8a3bf2afddb49051988cab9/lib/default.nix#L306-L334
While similar to #99, this problem pertains more to first-class BTRFS support with a top-level option. Such an option was suggested in https://github.com/nix-community/disko/issues/99#issuecomment-1368275363 but the issue was closed shortly thereafter.
Question
Is it currently possible to configure multi-device BTRFS subvolumes using Disko?
No this is not implemented just now, but feel free to implement it. @Lassulus might have some guidelines on how to do this.
Pretty much the same feature is also supported for zfs user space tools, but Disko doesn't implement it for zfs neither so far.
Well, you can great raids with zfs: https://github.com/nix-community/disko/blob/5d9f362aecd7a4c2e8a3bf2afddb49051988cab9/example/zfs.nix#L58
Well, you can great raids with zfs:
Yes, that's what I am talking about here. But with standard zfs tools you can i.e. create a mirror (or raidz) on N disks and add a cache on a faster SSD, all in the same command. I.e.
zpool create my-pool raidz /dev/by-name/disk-1 /dev/by-name/disk-2 /dev/by-name/disk-3 [..] /dev/by-name/disk-N cache /dev/by-name/ssd-1
I believe this isn't supported by disko at the moment and seems similar to the btrfs feature in terms of nixos module code? Pretty sure there's a thread where @Lassulus and me've talked about this already but i can't find that atm.
No this is not implemented just now, but feel free to implement it. @Lassulus might have some guidelines on how to do this.
@Lassulus, after the holidays may I please have guidelines for this? Assuming ignore or deny raid 5/6.
Currently I think it may already be possible to do this by using extraArgs and mountOptions to achieve something like
mkfs.btrfs -m raid1 -d raid1
with disko btrfs config. May be mistaken though.