3
0
Fork 0
forked from mirrors/nixpkgs

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.
This commit is contained in:
Luflosi 2022-05-03 17:01:39 +02:00
parent b3d94a9273
commit db4fdd6247
No known key found for this signature in database
GPG key ID: 4E41E29EDCC345D0

View file

@ -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 "," (