NTFS: Difference between revisions

From ArchWiki
(→‎Troubleshooting: Squish together all the related ntfs-3g/ntfs3 errors in a single section)
 
(17 intermediate revisions by 10 users not shown)
Line 11: Line 11:
:'''NTFS (New Technology File System)''' is a proprietary journaling file system developed by Microsoft. Starting with Windows NT 3.1, it is the default file system of the Windows NT family.
:'''NTFS (New Technology File System)''' is a proprietary journaling file system developed by Microsoft. Starting with Windows NT 3.1, it is the default file system of the Windows NT family.


Since Linux 5.15, [https://docs.kernel.org/filesystems/ntfs3.html ntfs3] provides read and write support for the file system. All [[Kernel#Officially supported kernels|officially supported kernels]] with versions 5.15 or newer are built with {{ic|1=CONFIG_NTFS3_FS=m}} and thus support it.
The [https://docs.kernel.org/filesystems/ntfs3.html ntfs3] kernel driver provides read and write support for the file system.


For kernels < 5.15, NTFS read and write support is provided by the [[NTFS-3G]] FUSE file system. Or you can use backported NTFS3 via {{AUR|ntfs3-dkms}}.
{{Note|
 
* All [[Kernel#Officially supported kernels|officially supported kernels]] with versions 5.15 or newer are built with {{ic|1=CONFIG_NTFS3_FS=m}} and thus support it. Before 5.15, NTFS read and write support is provided by the [[NTFS-3G]] FUSE file system. Or you can use backported NTFS3 via {{AUR|ntfs3-dkms}}.
{{Note|Paragon has not yet released userspace utilities for NTFS3.}}
* Paragon Software, the author of the kernel module, has not yet released userspace utilities for NTFS3. You can use NTFS-3G userspace utilities without NTFS-3G driver via {{AUR|ntfsprogs-ntfs3}}.
}}


== Tips and tricks ==
== Tips and tricks ==
Line 21: Line 22:
=== Improving performance ===
=== Improving performance ===


You can enable some {{man|8|mount}} options to improve the performance:
You can enable the {{ic|prealloc}} {{man|8|mount}} option to decrease fragmentation in case of parallel write operations (most useful for HDD).
 
=== Prevent creation of names not allowed by Windows ===
 
NTFS itself does not have restrictions for characters and names used, but [https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions Windows does].


* {{ic|noatime}} – can speed up the file system operations.
Since the kernel version 6.2, ntfs3 supports {{ic|windows_names}} {{man|8|mount}} option. Use it to strictly maintain compatibility.
* {{ic|prealloc}} – decreases fragmentation in case of parallel write operations (most useful for HDD).
 
{{Tip|[[udisks]] has this option enabled by default.}}


== Known issues ==
== Known issues ==
Line 51: Line 57:


Although, this method is not recommended and can confuse some 3rd party tools.
Although, this method is not recommended and can confuse some 3rd party tools.
=== udisks support ===
[[udisks]] supports NTFS3, but has some issues at the moment. See udisks [https://github.com/storaged-project/udisks/pull/917 ntfs3 PR] and [https://github.com/storaged-project/udisks/issues/932 issue 932].
Issues can present themselves as the following errors, when the NTFS3 driver is used because NTFS-3G is not installed, but with mount options that it does not recognize:
ntfs3: Unknown parameter 'windows_names'
or
Filesystem type ntfs3,ntfs not configured in kernel
The second error in particular can be encountered with [[Dolphin]].
As a workaround, add a such option to {{ic|/etc/udisks2/mount_options.conf}} in {{ic|[defaults]}} section:
ntfs_defaults=uid=$UID,gid=$GID,noatime,prealloc
See: [https://bugs.kde.org/show_bug.cgi?id=445468 Cannot mount NTFS with the new ntfs3 module from Linux 5.15]


=== Unable to mount with ntfs3 with partition marked dirty ===
=== Unable to mount with ntfs3 with partition marked dirty ===
Line 83: Line 69:
  ''sdb1'': volume is dirty and "force" flag is not set!
  ''sdb1'': volume is dirty and "force" flag is not set!


You can try passing the {{ic|--clear-dirty}} argument to {{ic|ntfsfix}} to clean it. [https://bbs.archlinux.org/viewtopic.php?id=271650]
You can try passing the {{ic|--clear-dirty}} argument to {{man|8|ntfsfix}} to clean it. [https://bbs.archlinux.org/viewtopic.php?id=271650]


== See also ==
== See also ==

Latest revision as of 11:19, 21 January 2024

From Wikipedia:

NTFS (New Technology File System) is a proprietary journaling file system developed by Microsoft. Starting with Windows NT 3.1, it is the default file system of the Windows NT family.

The ntfs3 kernel driver provides read and write support for the file system.

Note:
  • All officially supported kernels with versions 5.15 or newer are built with CONFIG_NTFS3_FS=m and thus support it. Before 5.15, NTFS read and write support is provided by the NTFS-3G FUSE file system. Or you can use backported NTFS3 via ntfs3-dkmsAUR.
  • Paragon Software, the author of the kernel module, has not yet released userspace utilities for NTFS3. You can use NTFS-3G userspace utilities without NTFS-3G driver via ntfsprogs-ntfs3AUR.

Tips and tricks

Improving performance

You can enable the prealloc mount(8) option to decrease fragmentation in case of parallel write operations (most useful for HDD).

Prevent creation of names not allowed by Windows

NTFS itself does not have restrictions for characters and names used, but Windows does.

Since the kernel version 6.2, ntfs3 supports windows_names mount(8) option. Use it to strictly maintain compatibility.

Tip: udisks has this option enabled by default.

Known issues

Explicit file system type required to mount

ntfs3 requires the file system type to mount.

To be able to mount the file system, specify its type as ntfs3. For example, using mount(8)'s -t/--types option:

# mount -t ntfs3 /dev/sdxY /mnt

Troubleshooting

unknown filesystem type 'ntfs'

When mounting NTFS, you can encounter an error such as:

mount: /mnt: unknown filesystem type 'ntfs'

See #Explicit file system type required to mount.

If you want to use ntfs3 as the default driver for ntfs partitions, such udev rule does the trick:

/etc/udev/rules.d/ntfs3_by_default.rules
SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="ntfs", ENV{ID_FS_TYPE}="ntfs3"

Although, this method is not recommended and can confuse some 3rd party tools.

Unable to mount with ntfs3 with partition marked dirty

When trying to mount a good NTFS partition (i.e. which successfully mounts with NTFS-3G and for which ntfsfix --no-action does not report any error), you may get the following error:

mount: /mnt: wrong fs type, bad option, bad superblock on /dev/sdb1, missing codepage or helper program, or other error.
       dmesg(1) may have more information after failed mount system call.

ntfs3 will not mount a partition where the volume is marked dirty without the force option. dmesg explicitly helps recognizing the situation, saying:

sdb1: volume is dirty and "force" flag is not set!

You can try passing the --clear-dirty argument to ntfsfix(8) to clean it. [1]

See also