NTFS
New Technology File System (NTFS) is a proprietary journaling 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
Using nixos-generate-config to automatically generate Nix config is the recommended way to setup filesystems.
1. Run lsblk to list device names
2. Mount the device using mount, where /dev/sdX replaced with your device name and /mnt/sdX replaced with an existing folder path to mount your drive.
mount /dev/sdX /mnt/sdX -t ntfs33. Run nixos-generate-config --dir . to generate hardware configuration. This will automatically add all currently mounted devices to hardware-configuration.nix.
+ boot.supportedFilesystems = [ "ntfs" ];
+ fileSystems."/mnt/sdX" = {
+ device = "/dev/disk/by-uuid/F258FB9E58FB5FB1";
+ fsType = "ntfs3";
+ };
4. Add "uid=$UID" to fileSystems.<name>.options to get write access, where $UID replaced with your UID:
fileSystems =
let
ntfs-drives = [
"/mnt/sdX"
];
in
lib.genAttrs ntfs-drives (path: {
options = [
"uid=$UID"
# "nofail"
];
});
echo $UID.hardware-configuration.nix.
Troubleshooting
Read-only file system
This is most likely caused by Windows not marking the disk as "clean" and unmounted.
To verify:
journalctl -b0 | grep -i "The disk contains an unclean file system"
It should return a similar message to what follows:
The disk contains an unclean file system (0,0). Metadata kept in Windows cache, refused to mount. Falling back to read-only mount because the NTFS partition is in an unsafe state. Please resume and shutdown Windows fully (no hibernation or fast restarting.)
If you have shutdown Windows fully, and not used hibernation, it may be caused by the fast startup or fast boot feature of Windows. It has been reported that major Windows updates may reset this setting to on.
This TechNet entry explains how to disable fast startup. Additionally, this blog post on howtogeek.com explains how the fast startup mode works, and how to disable it.