Mount windows NTFS partitions with ntfs3 drivers instead of ntfs-3g.

Original link: https://www.insidentally.com/articles/000029/

NTFSNew Technology File System is a disk file system format supported by a series of operating systems of the Windows NT kernel, specially designed for network and disk quota, file encryption and other management security features. And NTFS3 is a full-featured NTFS read and write driver. This driver works with NTFS versions up to 3.1.

Introduction

Initially, the Linux kernel did not support NTFS natively. The NTFS-3G from Tuxera is the current mainstream solution, but there are many small problems in actual use. NTFS-3G is a file system that imitates NTFS support and is implemented in the user layer with the help of the Linux user space file system FUSE module. The access logic code to NTFS is implemented in the user layer code.

The main problem with using NTFS on Linux before NTFS3 was the lack of stable and fully functional read/write support.

In 2020, Paragon Software made a surprising decision: try to Mainline the previously only commercial NTFS3 driver. Finally Linux Kernel 5.15 incorporates the NTFS3 kernel driver provided by Paragon, which has higher performance and more features.

  • This driver implements read/write support for normal, sparse, and compressed files in the NTFS file system.

  • Support local log playback.

  • NFS export of mounted NTFS volumes is supported.

  • Extended attributes are supported. Predefined extended properties:

    • system.ntfs_security gets/sets security

      Keywords: SECURITY_DESCRIPTOR_RELATIVE

    • system.ntfs_attrib gets/sets ntfs file/dir attributes.

    Note: This item applies to empty files, allowing to switch the type between sparse (0x200), compressed (0x800) and normal.

mount

The filesystem type used when mounting is ntfs3.

Mount manually

Manually mount using the command:

 1
 # mount -t ntfs3 /dev/sdxY /mnt

-t indicates the file system type, /dev/sdxY is the path of your partition, which can be viewed with the lsblk command. /mnt is the folder to mount to.

Auto mount at boot

Edit the /etc/fstab file and add the line:

 1
 UUID =**** /data ntfs3 iocharset =utf8,umask=0,prealloc 0 0

Where UUID=**** is the UUID of the specified partition. The benefit of using UUID is that they are independent of disk order. If you change the order of your storage devices in the BIOS, or if you reseat the storage devices, or because some BIOSes may randomly change the order of the storage devices, then using UUID will be more efficient. UUID can be viewed using the blkid command.

/data is the mount location. The location for this example is /data you need to create this folder in advance.

The following options are all mount parameters. For details, please refer to the following introduction.

The last two 0 0 indicate whether to backup and whether to check. 0 0 means do not backup, do not check.

mount parameters

parameter explain
iocharset=name This option tells the driver how to interpret the path string and convert it to Unicode or back. If this option is not set, the default code page (CONFIG\u NLS\u default) will be used. Example: iocharset=utf8
uid= mount user id
gid= mount group id
umask= Controls the default permissions for files/directories created after mounting an NTFS volume.
dmask= Instead of specifying a umask that applies to both files and directories, fmask applies only to files, and dmask applies only to directories.
fmask=
noacsrules The “No Access Rules” mount option sets the file/folder access to 777 and the owner/group to root. This mount option absorbs all other permissions.
Permission changes for files/folders will be reported as successful, but will remain 777.
Owner/group changes will be reported as successful, but they will remain root.
nohidden Files with the Windows-specific hidden (FILE_ATTRIBUTE_HIDDEN) attribute are not displayed under Linux.
sys_immutable A file with a Windows-specific system (FILE_ATTRIBUTE_SYSTEM) attribute will be marked as system immutable.
discard The TRIM command is supported to improve the performance of delete operations and is recommended for solid state drives (SSDs).
force Forces the driver to mount the partition even if the volume is marked dirty. Not recommended for use.
sparse Create sparse new files.
showmeta Use this parameter to display all metafiles (system files) on mounted NTFS partitions. All meta files are hidden by default.
prealloc Over-preallocates space for a file when the file size increases while writing. Reduce fragmentation when performing parallel writes to different files.
acl POSIX ACLs (Access Control Lists) are supported. Works if the kernel supports it. Not to be confused with NTFS ACLs. Options specified as acl support POSIX acl.

Advantages of NTFS3

NTFS3 is a kernel-mode driver, and ntfs3 is much better than nfts-3g in terms of speed and load.

Many netizens have done the test:

In addition to better performance, NTFS3 also supports features such as mount user and file permission management. For specific usage, you can learn the usage of gid, uid and umask by yourself.

In addition, NTFS3 also supports the prealloc of NTFS, which can greatly reduce the generation of file fragmentation.

Problems with unmaintained NTFS3 drivers

Since the driver was finally mainlined in Linux 5.15 in 2021, so far, in nearly a year, no major bug fixes have been sent to the driver.

It has been speculated that the drive’s defender, Konstantin Komarov, was in Russia and was affected by the Russian-Ukrainian war.

Subsequently, many programmers, including Linus Torvalds, expressed concern and willingness to contribute.

Now, we’re seeing Konstantin Komarov from Paragon Software re-active on the kernel mailing list after leaving for a break and other business. Komarov submitted a batch of NTFS3 fixes for the merge window for Linux 5.19 on June 3, 2022.

I believe that ntfs3 will get better and better in the future. And at present, nfts3 is already the best NTFS driver in Linux, I think you might as well try it.

This article is reprinted from: https://www.insidentally.com/articles/000029/
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment