-
-
Notifications
You must be signed in to change notification settings - Fork 294
Expand file tree
/
Copy pathbcachefs.nix
More file actions
158 lines (150 loc) · 4.05 KB
/
bcachefs.nix
File metadata and controls
158 lines (150 loc) · 4.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
{
disko.devices = {
disk = {
vdb = {
device = "/dev/vdb";
type = "disk";
content = {
type = "gpt";
partitions = {
vdb1 = {
type = "EF00";
size = "100M";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
vdb2 = {
size = "100%";
content = {
type = "bcachefs";
# This refers to a filesystem in the `bcachefs_filesystems` attrset below.
filesystem = "mounted_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 = "mounted_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 = "mounted_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 = "relies_on_external_subvolume";
label = "group_a.vde1";
};
};
};
};
};
vdf = {
device = "/dev/vdf";
type = "disk";
content = {
type = "bcachefs";
label = "";
filesystem = "empty_label";
};
};
};
bcachefs_filesystems = {
# 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,
# which relies on a subvolume in another filesystem being mounted
# and uses a hard-coded UUID.
relies_on_external_subvolume = {
type = "bcachefs_filesystem";
mountpoint = "/home/Documents";
uuid = "64e50034-ebe2-eaf8-1f93-cf56266a8d86";
};
# Example bcachefs filesystem without a label
empty_label = {
type = "bcachefs_filesystem";
mountpoint = "/empty_label";
};
};
};
}