vuls: init at 0.27.0
[NixPkgs.git] / nixos / doc / manual / configuration / overlayfs.section.md
blob7027a6f426d4b04aea833b88f4fd669890139e8f
1 # Overlayfs {#sec-overlayfs}
3 NixOS offers a convenient abstraction to create both read-only as well writable
4 overlays.
6 ```nix
8   fileSystems = {
9     "/writable-overlay" = {
10       overlay = {
11         lowerdir = [ writableOverlayLowerdir ];
12         upperdir = "/.rw-writable-overlay/upper";
13         workdir = "/.rw-writable-overlay/work";
14       };
15       # Mount the writable overlay in the initrd.
16       neededForBoot = true;
17     };
18     "/readonly-overlay".overlay.lowerdir = [
19       writableOverlayLowerdir
20       writableOverlayLowerdir2
21     ];
22   };
24 ```
26 If `upperdir` and `workdir` are not null, they will be created before the
27 overlay is mounted.
29 To mount an overlay as read-only, you need to provide at least two `lowerdir`s.