Skip to content

fileSystems

Filesystems

fileSystems

The file systems to be mounted. It must include an entry for the root directory (mountPoint = "/"). Each entry in the list is an attribute set with the following fields: mountPoint, device, fsType (a file system type recognised by {command}mount; defaults to "auto"), and options (the mount options passed to {command}mount using the {option}-o flag; defaults to [ "defaults" ]).

Instead of specifying device, you can also specify a volume label (label) for file systems that support it, such as ext2/ext3 (see {command}mke2fs -L).

Type: attribute set of (submodule)

Default

{ }

Example

{"/".device = "/dev/hda1";"/data" = {device = "/dev/hda2";fsType = "ext3";options = [ "data=journal" ];};"/bigdisk".label = "bigdisk";}

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/tasks/filesystems/overlayfs.nix

fileSystems.<name>.autoFormat

If the device does not currently contain a filesystem (as determined by {command}blkid), then automatically format it with the filesystem type specified in {option}fsType. Use with caution.

Type: boolean

Default

false

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/tasks/filesystems.nix

fileSystems.<name>.autoResize

If set, the filesystem is grown to its maximum size before being mounted. (This is typically the size of the containing partition.) This is currently only supported for ext2/3/4 filesystems that are mounted during early boot.

Type: boolean

Default

false

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/tasks/filesystems.nix

fileSystems.<name>.depends

List of paths that should be mounted before this one. This filesystem's {option}device and {option}mountPoint are always checked and do not need to be included explicitly. If a path is added to this list, any other filesystem whose mount point is a parent of the path will be mounted before this filesystem. The paths do not need to actually be the {option}mountPoint of some other filesystem.

Type: list of string (with check: non-empty without trailing slash)

Default

[ ]

Example

["/persist"]

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/tasks/filesystems.nix

fileSystems.<name>.device

Location of the device. Type: null or string (with check: non-empty)

Default

null

Example

"/dev/sda"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/tasks/filesystems.nix

fileSystems.<name>.encrypted.blkDev

Location of the backing encrypted device. Type: null or string

Default

null

Example

"/dev/sda1"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/tasks/encrypted-devices.nix

fileSystems.<name>.encrypted.enable

The block device is backed by an encrypted one, adds this device as a initrd luks entry. Type: boolean

Default

false

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/tasks/encrypted-devices.nix

fileSystems.<name>.encrypted.keyFile

Path to a keyfile used to unlock the backing encrypted device. When systemd stage 1 is not enabled, at the time this keyfile is accessed, the neededForBoot filesystems (see utils.fsNeededForBoot) will have been mounted under /mnt-root, so the keyfile path should usually start with "/mnt-root/". When systemd stage 1 is enabled, fsNeededForBoot file systems will be mounted as needed under /sysroot, and the keyfile will not be accessed until its requisite mounts are done.

Type: null or string

Default

null

Example

"/mnt-root/root/.swapkey"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/tasks/encrypted-devices.nix

fileSystems.<name>.encrypted.label

Label of the unlocked encrypted device. Set fileSystems.<name?>.device to /dev/mapper/<label> to mount the unlocked device. Type: null or string

Default

null

Example

"rootfs"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/tasks/encrypted-devices.nix

fileSystems.<name>.fsType

Type of the file system. Type: string (with check: non-empty)

Default

"auto"

Example

"ext3"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/tasks/filesystems.nix

fileSystems.<name>.label

Label of the device (if any). Type: null or string (with check: non-empty)

Default

null

Example

"root-partition"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/tasks/filesystems.nix

fileSystems.<name>.mountPoint

Location of the mounted file system. Type: string (with check: non-empty without trailing slash)

Example

"/mnt/usb"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/tasks/filesystems.nix

fileSystems.<name>.neededForBoot

If set, this file system will be mounted in the initial ramdisk. Note that the file system will always be mounted in the initial ramdisk if its mount point is one of the following: {file}/, {file}/nix, {file}/nix/store, {file}/var, {file}/var/log, {file}/var/lib, {file}/var/lib/nixos, {file}/etc, {file}/usr.

Type: boolean

Default

false

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/system/boot/stage-1.nix

fileSystems.<name>.noCheck

Disable running fsck on this filesystem. Type: boolean

Default

false

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/tasks/filesystems.nix

fileSystems.<name>.options

Options used to mount the file system. Type: non-empty (list of string (with check: non-empty))

Default

["defaults"]

Example

["data=journal"]

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/tasks/filesystems.nix

fileSystems.<name>.overlay.lowerdir

The list of path(s) to the lowerdir(s).

To create a writable overlay, you MUST provide an upperdir and a workdir.

You can create a read-only overlay when you provide multiple (at least 2!) lowerdirs and neither an upperdir nor a workdir.

Type: null or (non-empty (list of (string or path in the Nix store)))

Default

null

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/tasks/filesystems/overlayfs.nix

fileSystems.<name>.overlay.upperdir

The path to the upperdir.

If this is null, a read-only overlay is created using the lowerdir.

If you set this to some value you MUST also set workdir.

Type: null or string

Default

null

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/tasks/filesystems/overlayfs.nix

fileSystems.<name>.overlay.workdir

The path to the workdir.

This MUST be set if you set upperdir.

Type: null or string

Default

null

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/tasks/filesystems/overlayfs.nix

fileSystems.<name>.stratis.poolUuid

UUID of the stratis pool that the fs is located in

Type: null or string

Default

null

Example

"04c68063-90a5-4235-b9dd-6180098a20d9"

Declared by: https://github.com/nixos/nixpkgs/blob/master/nixos/modules/tasks/filesystems.nix