1# File Systems {#ch-file-systems} 2 3You can define file systems using the `fileSystems` configuration 4option. For instance, the following definition causes NixOS to mount the 5Ext4 file system on device `/dev/disk/by-label/data` onto the mount 6point `/data`: 7 8```nix 9{ 10 fileSystems."/data" = 11 { device = "/dev/disk/by-label/data"; 12 fsType = "ext4"; 13 }; 14} 15``` 16 17This will create an entry in `/etc/fstab`, which will generate a 18corresponding [systemd.mount](https://www.freedesktop.org/software/systemd/man/systemd.mount.html) 19unit via [systemd-fstab-generator](https://www.freedesktop.org/software/systemd/man/systemd-fstab-generator.html). 20The filesystem will be mounted automatically unless `"noauto"` is 21present in [options](#opt-fileSystems._name_.options). `"noauto"` 22filesystems can be mounted explicitly using `systemctl` e.g. 23`systemctl start data.mount`. Mount points are created automatically if they don't 24already exist. For `device`, it's best to use the topology-independent 25device aliases in `/dev/disk/by-label` and `/dev/disk/by-uuid`, as these 26don't change if the topology changes (e.g. if a disk is moved to another 27IDE controller). 28 29You can usually omit the file system type (`fsType`), since `mount` can 30usually detect the type and load the necessary kernel module 31automatically. However, if the file system is needed at early boot (in 32the initial ramdisk) and is not `ext2`, `ext3` or `ext4`, then it's best 33to specify `fsType` to ensure that the kernel module is available. 34 35::: {.note} 36System startup will fail if any of the filesystems fails to mount, 37dropping you to the emergency shell. You can make a mount asynchronous 38and non-critical by adding `options = [ "nofail" ];`. 39::: 40 41```{=include=} sections 42luks-file-systems.section.md 43sshfs-file-systems.section.md 44overlayfs.section.md 45```