NTFS: Difference between revisions

34j (talk | contribs)
mNo edit summary
Pigs (talk | contribs)
Troubleshooting: adds section on dirty flag
 
(One intermediate revision by one other user not shown)
Line 10: Line 10:
└─sdX
└─sdX
}}
}}
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.
2. Mount the device using [https://man7.org/linux/man-pages/man8/mount.8.html {{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>}}
{{code|<nowiki>mount /dev/sdX /mnt/sdX -t ntfs3 -o uid=$UID</nowiki>}}
3. Run {{ic|nixos-generate-config --dir .}} to generate hardware configuration. This will <strong>automatically</strong> add all currently mounted devices to {{ic|hardware-configuration.nix}}.
3. Run {{ic|nixos-generate-config --dir .}} to generate hardware configuration. This will <strong>automatically</strong> add all currently mounted devices to {{ic|hardware-configuration.nix}}.
{{file|/etc/nixos/hardware-configuration.nix|diff|3=
{{file|/etc/nixos/hardware-configuration.nix|diff|3=
Line 65: Line 65:


[https://social.technet.microsoft.com/wiki/contents/articles/25908.fast-startup-how-to-disable-if-it-s-causing-problems.aspx This TechNet entry] explains how to disable fast startup. Additionally, [https://www.howtogeek.com/243901/the-pros-and-cons-of-windows-10s-fast-startup-mode/ this blog post on howtogeek.com] explains how the fast startup mode works, and how to disable it.
[https://social.technet.microsoft.com/wiki/contents/articles/25908.fast-startup-how-to-disable-if-it-s-causing-problems.aspx This TechNet entry] explains how to disable fast startup. Additionally, [https://www.howtogeek.com/243901/the-pros-and-cons-of-windows-10s-fast-startup-mode/ this blog post on howtogeek.com] explains how the fast startup mode works, and how to disable it.
=== Unable to mount ntfs3 with dirty volume ===
When attempting to mount an <code>NTFS</code> partition using the <code>ntfs3</code> filesystem driver via the {{nixos:package|ntfs3g}} package, the mount operation may fail:
<syntaxhighlight lang="console">
# mount /dev/sda1 /mnt -t ntfs3
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/sda1, missing codepage or helper program, or other error.
      dmesg(1) may have more information after failed mount system call.
</syntaxhighlight>
With the resulting dmesg output:
<syntaxhighlight lang="console">
# dmesg
...
[168659.819978] ntfs3: sda1: It is recommened to use chkdsk.
[168659.820833] ntfs3: sda1: volume is dirty and "force" flag is not set!
</syntaxhighlight>
This indicates that the NTFS volume has the “dirty” flag set. In this state, the <code>ntfs3</code> driver refuses to mount the filesystem.
To clear the dirty flag, run <code>ntfsfix</code> on the affected partition:
<syntaxhighlight lang="console">
# ntfsfix --clear-dirty /dev/sda1
</syntaxhighlight>
If <code>ntfsfix</code> fails with an error <code>Windows is hibernated, refused to mount</code>, the partition can be mounted using <code>ntfs-3g</code> with the hibernation file removed:
<syntaxhighlight lang="console">
# ntfs-3g -o remove_hiberfile /dev/sda1 /mnt
</syntaxhighlight>


[[Category:Filesystem]]
[[Category:Filesystem]]