Filesystems: Difference between revisions
imported>Harärmat m Move references to the bottom of the page |
m →Bind mounts: Drop stray quoted ref :/ |
||
(10 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{ic|fileSystems}} is a [https://nixos.org/manual/nixos/stable/options.html#opt-fileSystems | [[category:filesystem]] | ||
{{ic|fileSystems}} is a NixOS[[Category:NixOS]] option that allows the user to mount filesystems at specific mount points. The mounted filesystems may also be encrypted. Also see [https://nixos.org/manual/nixos/stable/options.html#opt-fileSystems the fileSystem option documentation]. | |||
For boot mount options, [https://manpages.ubuntu.com/manpages/noble/en/man8/mount.8.html#filesystem-independent%20mount%20options check here]. | |||
Common example filesystem mount. You can put this in configuration.nix: | |||
<syntaxhighlight lang="nix"> | |||
fileSystems."/mnt/exampleDrive" = { | |||
device = "/dev/disk/by-uuid/4f999afe-6114-4531-ba37-4bf4a00efd9e"; | |||
fsType = "exfat"; | |||
options = [ # If you don't have this options attribute, it'll default to "defaults" | |||
# boot options for fstab. Search up fstab mount options you can use | |||
"users" # Allows any user to mount and unmount | |||
"nofail" # Prevent system from failing if this drive doesn't mount | |||
]; | |||
}; | |||
</syntaxhighlight> | |||
== Making disk visible in your file explorer == | |||
You might not see the disk in your file explorer (ie GNOME Nautilus). Add to the options: <code>x-gvfs-show</code> and it'll show up. | |||
== Porting /etc/fstab == | |||
The options specified in /etc/fstab may not be fully compatible with NixOS fileSystems options. For example, here are some options NixOS doesn't recognize that are available on some Linux distributions: | |||
* iocharset | |||
* rw (but it seems to not be needed) | |||
* uid with username rather than actual uid | |||
== Mount order == | == Mount order == | ||
Line 10: | Line 37: | ||
<blockquote> | <blockquote> | ||
Bind mounting allows a filesystem hierarchy or a file to be mounted at a different mount point. Unlike a symbolic link, a bind mount does not exist on the filesystem itself. | Bind mounting allows a filesystem hierarchy or a file to be mounted at a different mount point. Unlike a symbolic link, a bind mount does not exist on the filesystem itself. In the following example, the path {{ic|/olddir}} will be mounted in {{ic|/newdir}} | ||
<ref>[https://en.wikipedia.org/wiki/Mount_(Unix)#Bind_mounting Wikipedia - Bind mount]</ref> | <ref>[https://en.wikipedia.org/wiki/Mount_(Unix)#Bind_mounting Wikipedia - Bind mount]</ref> | ||
</blockquote> | </blockquote> | ||
Line 40: | Line 67: | ||
= References = | = References = | ||
<references /> | |||
<references/> |