NTFS: Difference between revisions
m Fix grammar and spelling |
Remove unnecessary use of ntfs-3g and recommend generating the configuration using `nixos-generate-config`. |
||
| Line 1: | Line 1: | ||
New Technology File System (NTFS) is a proprietary journaling [[Filesystems|file system]] developed by Microsoft. It is still in use by modern Windows systems, although NTFS has not evolved since the release of version 3.1 in 2001. | New Technology File System (NTFS) is a proprietary journaling [[Filesystems|file system]] developed by Microsoft. It is still in use by modern Windows systems, although NTFS has not evolved since the release of version 3.1 in 2001. | ||
== Mount NTFS filesystem on boot == | == Mount NTFS filesystem on boot == | ||
Using [[nixos-generate-config]] to automatically generate Nix config is the recommended way to setup filesystems. | |||
1. Run {{ic|lsblk}} to list device names | |||
nixos-generate-config | 2. Mount the device using {{ic|mount}}, where {{ic|/dev/sdX}} replaced with your device name and {{ic|/mnt/sdX}} replaced with an existing folder path to mount your drive. | ||
{{code|<nowiki>mount /dev/sdX /mnt/sdX -t ntfs3</nowiki>}} | |||
3. Run {{ic|nixos-generate-config --dir .}} to generate hardware configuration. This will automatically add all currently mounted devices to {{ic|hardware-configuration.nix}}. | |||
{{file|/etc/nixos/hardware-configuration.nix|diff|3= | |||
+ boot.supportedFilesystems = [ "ntfs" ]; | |||
+ fileSystems."/mnt/sdX" = { | |||
+ device = "/dev/disk/by-uuid/F258FB9E58FB5FB1"; | |||
+ fsType = "ntfs3"; | |||
+ }; | |||
}} | |||
4. Add {{ic|<nowiki>"uid=$UID"</nowiki>}} to {{nixos:option|fileSystems.*.options|fileSystems.<name>.options}} to get write access, where {{ic|<nowiki>$UID</nowiki>}} replaced with your UID: | |||
{{file|/etc/nixos/configuration.nix|diff|3= | |||
fileSystems = | |||
let | |||
ntfs-drives = [ | |||
"/mnt/sdX" | |||
]; | |||
in | |||
lib.genAttrs ntfs-drives (path: { | |||
options = [ | |||
"uid=$UID" | |||
# "nofail" | |||
]; | |||
}); | |||
}} | |||
{{note|You may find your UID by running {{ic|echo $UID}}.}} | |||
{{aside|It is not recommended to manually edit {{ic|hardware-configuration.nix}}.}} | |||
== Troubleshooting == | == Troubleshooting == | ||