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