about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorLuflosi <luflosi@luflosi.de>2022-05-03 17:01:39 +0200
committerLuflosi <luflosi@luflosi.de>2022-07-12 16:51:25 +0200
commitdb4fdd6247ec191677ac84e08da274ab88a0682e (patch)
tree280d61bc5f653f86653f018d52d0cee51e9b8577 /nixos
parentb3d94a92737806020c3fc13c558f32cad0726a2a (diff)
nixos/filesystems: skip fsck for bind mounts
Without this change, configurations like
```nix
fileSystems."/path/to/bindMountedDirectory" = {
  device = "/path/to/originalDirectory";
  options = [ "bind" ];
};
```
will lead to a warning message in `dmesg`:
```
systemd-fstab-generator: Checking was requested for "/path/to/originalDirectory", but it is not a device.
```
This happens because the generated /etc/fstab entry contains a non-zero fsck pass number, which doesn't make sense for a bind mount.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/tasks/filesystems.nix3
1 files changed, 2 insertions, 1 deletions
diff --git a/nixos/modules/tasks/filesystems.nix b/nixos/modules/tasks/filesystems.nix
index b8afe231dd2e1..82adc499ad0e7 100644
--- a/nixos/modules/tasks/filesystems.nix
+++ b/nixos/modules/tasks/filesystems.nix
@@ -280,7 +280,8 @@ in
     environment.etc.fstab.text =
       let
         fsToSkipCheck = [ "none" "bindfs" "btrfs" "zfs" "tmpfs" "nfs" "vboxsf" "glusterfs" "apfs" ];
-        skipCheck = fs: fs.noCheck || fs.device == "none" || builtins.elem fs.fsType fsToSkipCheck;
+        isBindMount = fs: builtins.elem "bind" fs.options;
+        skipCheck = fs: fs.noCheck || fs.device == "none" || builtins.elem fs.fsType fsToSkipCheck || isBindMount fs;
         # https://wiki.archlinux.org/index.php/fstab#Filepath_spaces
         escape = string: builtins.replaceStrings [ " " "\t" ] [ "\\040" "\\011" ] string;
         swapOptions = sw: concatStringsSep "," (