about summary refs log tree commit diff
path: root/nixos/doc/manual/configuration/overlayfs.section.md
diff options
context:
space:
mode:
authornikstur <nikstur@outlook.com>2024-02-04 00:29:42 +0100
committernikstur <nikstur@outlook.com>2024-02-07 22:13:00 +0100
commit1407ec7420dac14e80dba8e6393cec78f2d4571a (patch)
tree84affb40781813eef37d81a964457ddc8aa004de /nixos/doc/manual/configuration/overlayfs.section.md
parent1c1cfa073a80354fc2814265f1550bd537c01908 (diff)
nixos/filesystems: add overlayfs docs
Diffstat (limited to 'nixos/doc/manual/configuration/overlayfs.section.md')
-rw-r--r--nixos/doc/manual/configuration/overlayfs.section.md27
1 files changed, 27 insertions, 0 deletions
diff --git a/nixos/doc/manual/configuration/overlayfs.section.md b/nixos/doc/manual/configuration/overlayfs.section.md
new file mode 100644
index 0000000000000..592fb7c2e6f79
--- /dev/null
+++ b/nixos/doc/manual/configuration/overlayfs.section.md
@@ -0,0 +1,27 @@
+# Overlayfs {#sec-overlayfs}
+
+NixOS offers a convenient abstraction to create both read-only as well writable
+overlays.
+
+```nix
+fileSystems = {
+  "/writable-overlay" = {
+    overlay = {
+      lowerdir = [ writableOverlayLowerdir ];
+      upperdir = "/.rw-writable-overlay/upper";
+      workdir = "/.rw-writable-overlay/work";
+    };
+    # Mount the writable overlay in the initrd.
+    neededForBoot = true;
+  };
+  "/readonly-overlay".overlay.lowerdir = [
+    writableOverlayLowerdir
+    writableOverlayLowerdir2
+  ];
+};
+```
+
+If `upperdir` and `workdir` are not null, they will be created before the
+overlay is mounted.
+
+To mount an overlay as read-only, you need to provide at least two `lowerdir`s.