Skip to content

Commit

Permalink
Merge pull request #883 from MaienM/feature/zfs-vdev-types
Browse files Browse the repository at this point in the history
ZFS: Add log, spare & dedup vdev types, support multiple special vdevs, fix bug with mixed vdev types
  • Loading branch information
Mic92 authored Nov 20, 2024
2 parents c3b83db + 811fb74 commit a0c384e
Show file tree
Hide file tree
Showing 4 changed files with 346 additions and 34 deletions.
213 changes: 199 additions & 14 deletions example/zfs-with-vdevs.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
disko.devices = {
disk = {
x = {
data1 = {
type = "disk";
device = "/dev/sdx";
device = "/dev/vda";
content = {
type = "gpt";
partitions = {
Expand All @@ -27,9 +27,9 @@
};
};
};
y = {
data2 = {
type = "disk";
device = "/dev/sdy";
device = "/dev/vdb";
content = {
type = "gpt";
partitions = {
Expand All @@ -43,9 +43,169 @@
};
};
};
z = {
data3 = {
type = "disk";
device = "/dev/sdz";
device = "/dev/vdc";
content = {
type = "gpt";
partitions = {
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
spare = {
type = "disk";
device = "/dev/vdd";
content = {
type = "gpt";
partitions = {
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
log1 = {
type = "disk";
device = "/dev/vde";
content = {
type = "gpt";
partitions = {
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
log2 = {
type = "disk";
device = "/dev/vdf";
content = {
type = "gpt";
partitions = {
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
log3 = {
type = "disk";
device = "/dev/vdg";
content = {
type = "gpt";
partitions = {
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
dedup1 = {
type = "disk";
device = "/dev/vdh";
content = {
type = "gpt";
partitions = {
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
dedup2 = {
type = "disk";
device = "/dev/vdi";
content = {
type = "gpt";
partitions = {
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
dedup3 = {
type = "disk";
device = "/dev/vdj";
content = {
type = "gpt";
partitions = {
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
special1 = {
type = "disk";
device = "/dev/vdk";
content = {
type = "gpt";
partitions = {
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
special2 = {
type = "disk";
device = "/dev/vdl";
content = {
type = "gpt";
partitions = {
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
special3 = {
type = "disk";
device = "/dev/vdm";
content = {
type = "gpt";
partitions = {
Expand All @@ -61,7 +221,7 @@
};
cache = {
type = "disk";
device = "/dev/vdc";
device = "/dev/vdn";
content = {
type = "gpt";
partitions = {
Expand All @@ -85,15 +245,40 @@
vdev = [
{
mode = "mirror";
members = [
"x"
"y"
];
members = [ "data1" "data2" ];
}
{
members = [ "data3" ];
}
];
spare = [ "spare" ];
log = [
{
mode = "mirror";
members = [ "log1" "log2" ];
}
{
members = [ "log3" ];
}
];
dedup = [
{
mode = "mirror";
members = [ "dedup1" "dedup2" ];
}
{
members = [ "dedup3" ];
}
];
special = [
{
mode = "mirror";
members = [ "special1" "special2" ];
}
{
members = [ "special3" ];
}
];
special = {
members = [ "z" ];
};
cache = [ "cache" ];
};
};
Expand Down
18 changes: 17 additions & 1 deletion lib/tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,23 @@ let
};

# list of devices generated inside qemu
devices = [ "/dev/vda" "/dev/vdb" "/dev/vdc" "/dev/vdd" "/dev/vde" "/dev/vdf" ];
devices = [
"/dev/vda"
"/dev/vdb"
"/dev/vdc"
"/dev/vdd"
"/dev/vde"
"/dev/vdf"
"/dev/vdg"
"/dev/vdh"
"/dev/vdi"
"/dev/vdj"
"/dev/vdk"
"/dev/vdl"
"/dev/vdm"
"/dev/vdn"
"/dev/vdo"
];

# This is the test generator for a disko test
makeDiskoTest =
Expand Down
Loading

0 comments on commit a0c384e

Please sign in to comment.