Difference between revisions of "NTFS-3G"

From ArchWiki
Jump to: navigation, search
(Configuring)
m (Kernel parameters and other configuration: Some grammar/spelling. (Still needs work, but I wasn't sure about some parts.))
 
(49 intermediate revisions by 22 users not shown)
Line 3: Line 3:
 
[[he:NTFS-3G]]
 
[[he:NTFS-3G]]
 
[[it:NTFS-3G]]
 
[[it:NTFS-3G]]
 +
[[ja:NTFS-3G]]
 
[[ru:NTFS-3G]]
 
[[ru:NTFS-3G]]
 
[[zh-CN:NTFS-3G]]
 
[[zh-CN:NTFS-3G]]
 
[[zh-TW:NTFS-3G]]
 
[[zh-TW:NTFS-3G]]
[http://www.tuxera.com/community/ntfs-3g-download/ NTFS-3G] is an open source implementation of Microsoft's NTFS file system that includes read and write support. Because it is considered to be easier to configure and developed write support earlier, users generally prefer NTFS-3G over {{Pkg|ntfsprogs}} ntfsmount.  NTFS-3G developers use the FUSE file system to facilitate development and to help with portability.  This document will describe how to setup NTFS-3G to work on your computer.
+
{{Related articles start}}
 +
{{Related|File systems}}
 +
{{Related articles end}}
 +
 
 +
[http://www.tuxera.com/community/ntfs-3g-download/ NTFS-3G] is an open source implementation of Microsoft's NTFS file system that includes read and write support. NTFS-3G developers use the FUSE file system to facilitate development and to help with portability.
  
 
== Installation ==
 
== Installation ==
  
[[pacman|Install]] the {{Pkg|ntfs-3g}} package from the [[Official Repositories|official repositories]].
+
[[Install]] the {{Pkg|ntfs-3g}} package.
  
 
== Manual mounting ==
 
== Manual mounting ==
  
Two options exist for manually mounting NTFS partitions. The traditional:
+
Two options exist for manually mounting NTFS partitions. The traditional:
  # mount -t ntfs-3g /dev/<your-NTFS-partition> /{mnt,...}/<folder>
+
 
 +
  # mount -t ntfs-3g /dev/''your_NTFS_partition'' ''/mount/point''
  
Mount type {{ic|ntfs-3g}} does not need to be explicitly specified in Arch. The {{ic|mount}} command by default will use {{ic|/sbin/mount.ntfs}} which is symlinked to {{ic|/bin/ntfs-3g}} after the {{Pkg|ntfs-3g}} package is installed.
+
Mount type {{ic|ntfs-3g}} does not need to be explicitly specified in Arch. The ''mount'' command by default will use {{ic|/usr/bin/mount.ntfs}} which is symlinked to {{ic|/usr/bin/ntfs-3g}} after the ntfs-3g package is installed.
  
 
The second option is to call {{ic|ntfs-3g}} directly:
 
The second option is to call {{ic|ntfs-3g}} directly:
# ntfs-3g /dev/<your-NTFS-partition> /<mount-location>
 
  
== Configuring ==
+
# ntfs-3g /dev/''your_NTFS_partition'' ''/mount/point''
  
Your NTFS partition(s) can be setup to mount automatically, or pre-configured to be able to mount in a certain way when you would like them to be mounted. This configuration can be done in the static filesystem configuration ([[fstab]]) or by the use of udev rules.
+
== Formatting ==
 +
 
 +
{{Warning|As always, double check the device path.}}
 +
 
 +
# mkfs.ntfs -Q -L diskLabel /dev/sd''XY''
 +
 
 +
{{Note|{{ic|-Q}} speeds up the formatting by not zeroing the drive and not checking for bad sectors.}}
 +
 
 +
== Configuring ==
 +
 
 +
Your NTFS partition(s) can be setup to mount automatically, or pre-configured to be able to mount in a certain way when you would like them to be mounted. This configuration can be done in the static filesystem configuration ([[fstab]]) or by the use of udev rules.
  
 
=== Default settings ===
 
=== Default settings ===
  
Using the default settings will mount the NTFS partition(s) at boot. With this method, '''if''' the parent folder that it is mounted upon has the proper user or group [[Users and Groups|permissions]], then that user or group will be able to read and write on that partition(s).
+
Using the default settings will mount the NTFS partition(s) at boot. With this method, '''if''' the parent folder that it is mounted upon has the proper user or group [[Users and groups|permissions]], then that user or group will be able to read and write on that partition(s).
  
 
Put this in {{ic|/etc/fstab}}:
 
Put this in {{ic|/etc/fstab}}:
 +
 
  # <file system>  <dir> <type>    <options>            <dump>  <pass>
 
  # <file system>  <dir> <type>    <options>            <dump>  <pass>
  /dev/<NTFS-part> /mnt/windows  ntfs-3g  defaults   0      0
+
  /dev/''NTFS-part'' /mnt/windows  ntfs-3g  defaults   0      0
  
 
=== Linux compatible permissions ===
 
=== Linux compatible permissions ===
 +
 
Permissions on a Linux system are normally set to 755 for folders and 644 for files. It is recommended to keep these permissions in use for the NTFS partition as well if you use the partition on a regular basis. The following example assigns the above permissions to a normal user:
 
Permissions on a Linux system are normally set to 755 for folders and 644 for files. It is recommended to keep these permissions in use for the NTFS partition as well if you use the partition on a regular basis. The following example assigns the above permissions to a normal user:
  
  # Mount internal windows partition with linux compatible permissions, i.e. 755 for directories (dmask=022) and 644 for files (fmask=133)
+
  # Mount internal Windows partition with linux compatible permissions, i.e. 755 for directories (dmask=022) and 644 for files (fmask=133)
 
  UUID=01CD2ABB65E17DE0 /run/media/user1/Windows ntfs-3g uid=user1,gid=users,dmask=022,fmask=133 0 0
 
  UUID=01CD2ABB65E17DE0 /run/media/user1/Windows ntfs-3g uid=user1,gid=users,dmask=022,fmask=133 0 0
  
=== Allowing Group/User ===
+
=== Allowing group/user ===
  
You can also tell {{ic|/etc/fstab}} (the NTFS-3G driver) other options like those who are allowed to access (read) the partition. For example, for you to allow people in the {{ic|users}} group to have access:
+
In {{ic|/etc/fstab}} you can also specify other options like those who are allowed to access (read) the partition. For example, for you to allow people in the {{ic|users}} group to have access:
  
  /dev/<NTFS-part> /mnt/windows  ntfs-3g  gid=users,umask=0022    0      0
+
  /dev/''NTFS-partition'' /mnt/windows  ntfs-3g  gid=users,umask=0022    0      0
  
 
By default, the above line will enable write support for root only. To enable user writing, you have to specify the user who should be granted write permissions. Use the {{ic|uid}} parameter together with your username to enable user writing:
 
By default, the above line will enable write support for root only. To enable user writing, you have to specify the user who should be granted write permissions. Use the {{ic|uid}} parameter together with your username to enable user writing:
  
  /dev/<NTFS-part> /mnt/windows  ntfs-3g  uid=username,gid=users,umask=0022    0      0
+
  /dev/''NTFS-partition'' /mnt/windows  ntfs-3g  uid=''username'',gid=users,umask=0022    0      0
  
 
If you are running on a single user machine, you may like to own the file system yourself and grant all possible permissions:
 
If you are running on a single user machine, you may like to own the file system yourself and grant all possible permissions:
  /dev/<NTFS-part> /mnt/windows  ntfs-3g  uid=USERNAME,gid=users    0      0
+
  /dev/''NTFS-partition'' /mnt/windows  ntfs-3g  uid=''username'',gid=users    0      0
  
 
=== Basic NTFS-3G options ===
 
=== Basic NTFS-3G options ===
  
For most, the above settings should suffice. Here are a few other options that are general common options for various Linux filesystems. For a complete list, see [http://www.tuxera.com/community/ntfs-3g-manual/#6 this]
+
For most, the above settings should suffice. Here are a few other options that are general common options for various Linux filesystems. For a complete list, see [http://www.tuxera.com/community/ntfs-3g-manual/#6 this]
  
;umask: umask is a built-in shell command which automatically sets file permissions on newly created files. For Arch Linux, the default umask for root and user is 0022. With 0022 new folders have the directory permissions of 755 and new files have permissions of 644. You can read more about umask permissions [http://www.cyberciti.biz/tips/understanding-linux-unix-umask-value-usage.html here].
+
;[[umask]]: umask is a built-in shell command which automatically sets file permissions on newly created files. For Arch Linux, the default umask for root and user is 0022. With 0022 new folders have the directory permissions of 755 and new files have permissions of 644. You can read more about umask permissions [http://www.cyberciti.biz/tips/understanding-linux-unix-umask-value-usage.html here].
 
;noauto: If {{ic|noauto}} is set, NTFS entries in {{ic|/etc/fstab}} do not get mounted automatically at boot.
 
;noauto: If {{ic|noauto}} is set, NTFS entries in {{ic|/etc/fstab}} do not get mounted automatically at boot.
;uid: The user id number. This allows a specific user to have full access to the partition. Your uid can be found with the {{ic|id}} command.
+
;uid: The user id number. This allows a specific user to have full access to the partition. Your uid can be found with the {{ic|id}} command.
 
;fmask and dmask: Like {{ic|umask}} but defining file and directory respectively individually.
 
;fmask and dmask: Like {{ic|umask}} but defining file and directory respectively individually.
;locale: (deprecated as of 2009.1.1) - <s>some locales will need to specify their region for local characters to display properly.</s>
 
  
=== NTFS-config ===
+
=== Allowing user to mount ===
  
{{AUR|ntfs-config}} is a program that may be able to help configure your NTFS partition(s) if other methods do not work.
+
By default, ''ntfs-3g'' requires root rights to mount the filesystem, even with the "user" option in {{ic|/etc/fstab}}. See [http://www.tuxera.com/community/ntfs-3g-faq/#useroption ntfs-3g-faq] for details. The user option in the fstab is still required.
  
== Troubleshooting ==
+
{{Note|
 +
* The {{Pkg|ntfs-3g}} package does not have internal FUSE support. Rebuild the package using [[ABS]], or install {{AUR|ntfs-3g-fuse}}.
 +
* There seems to be an issue with unmounting rights, so you will still need root rights if you need to unmount the filesystem. You can also use {{ic|fusermount -u /mnt/''mountpoint''}} to unmount the filesystem without root rights. Also, if you use the {{ic|''users''}} option (plural) in {{ic|/etc/fstab}} instead of the {{ic|user}} option, you will be able to both mount and unmount the filesystem using the {{ic|mount}} and {{ic|umount}} commands.}}
  
Some ideas for troubleshooting common problems.
+
=== ntfs-config ===
  
=== Damaged NTFS Filesystems ===
+
{{Aur|ntfs-config}} is a program that may be able to help configure your NTFS partition(s) if other methods do not work.
 +
 
 +
== Resizing NTFS partition ==
 +
 
 +
{{Note|Please ensure you have a backup before attempting this if your data is important!}}
 +
 
 +
Most systems that are purchased already have [[Wikipedia:Windows|Windows]] installed on it, and some people would prefer not wipe it off completely when doing an Arch Linux installation. For this reason, among others, it is useful to resize the existing Windows partition to make room for a Linux partition or two. This is often accomplished with a [[Wikipedia:Live CD|Live CD]] or bootable USB thumb drive.
 +
 
 +
For Live CDs the typical procedure is to download an ISO file, burn it to a CD, and then boot from it. [http://infrarecorder.org/ InfraRecorder] is a free (as in GPL3) CD/DVD burning application for Windows which fits the bill nicely. If you would rather use a bootable USB media instead, see [[USB flash installation media]] for methods to create bootable USB stick.
 +
 
 +
There are a number of bootable CD/USB images avaliable. This list is not exhaustive, but is a good place to start:
 +
 
 +
* {{App|[[Wikipedia:GParted|GParted]]|Small bootable GNU/Linux distribution for x86 based computers. It enables you to use all the features of the latest versions of the GParted application. Does not include additional packages System Rescue CD may incorporate, and disk encryption schemes may not be supported.|http://gparted.sourceforge.net/|}}
 +
* {{App|[[Wikipedia:Parted Magic|Parted Magic]]|Very good complete hard disk management solution. With the Partition Editor you can re-size, copy, and move partitions. You can grow or shrink your C: drive. Create space for new operating systems. Attempt data rescue from lost partitions.|http://partedmagic.com/|}}
 +
* {{App|[[Wikipedia:SystemRescueCD|SystemRescueCD]]|Good tool to have, and works seamlessly in most cases. Once booted, run GParted and the rest should be fairly obvious.|http://www.sysresccd.org/|}}
 +
 
 +
Note that the important programs for resizing NTFS partitions include ntfs-3g and a utility like (G)parted or fdisk, provided by the {{Pkg|util-linux}} package. Unless you are an "advanced" user it is advisable to use a tool like GParted to perform any resize operations to minimize the chance of data loss due to user error.
 +
 
 +
If you already have Arch Linux installed on your system and simply want to resize an existing NTFS partition, you can use the parted and ntfs-3g packages to do it. Optionally, you can use the GParted GUI after installing the [[GParted]] package.
 +
 
 +
== Troubleshooting ==
 +
 
 +
=== Damaged NTFS filesystems ===
  
 
If an NTFS filesystem has errors on it, NTFS-3G will mount it as read-only. To fix an NTFS filesystem, load Windows and run its disk checking program, chkdsk.
 
If an NTFS filesystem has errors on it, NTFS-3G will mount it as read-only. To fix an NTFS filesystem, load Windows and run its disk checking program, chkdsk.
 
Take in account that ntfsfix can only repair some errors. If it fails, chkdsk will probably succeed.
 
Take in account that ntfsfix can only repair some errors. If it fails, chkdsk will probably succeed.
 
To repair the file system without booting windows, [[pacman|install]] the {{Pkg|ntfsprogs}} package available in the [[Official Repositories|official repositories]].
 
  
 
To fix the NTFS file system, the device must already be unmounted. For example, to fix an NTFS partition residing in {{ic|/dev/sda2}}:
 
To fix the NTFS file system, the device must already be unmounted. For example, to fix an NTFS partition residing in {{ic|/dev/sda2}}:
Line 90: Line 128:
 
If all went well, the volume will now be writable.
 
If all went well, the volume will now be writable.
  
=== Mount Failure ===
+
=== Metadata kept in Windows cache, refused to mount ===
  
If you cannot mount your NTFS partition even when following this guide, try using the [[UUID]] instead of device name in {{ic|/etc/fstab}} for all NTFS partitions. Here's an fstab [[Fstab#UUID|example]].
+
When dual booting with Windows 8 or 10, trying to mount a partition that is visible to Windows may yield the following error:
  
=== Format NTFS ===
+
The disk contains an unclean file system (0, 0).
 +
Metadata kept in Windows cache, refused to mount.
 +
Failed to mount '/dev/sdc1': Operation not permitted
 +
The NTFS partition is in an unsafe state. Please resume and shutdown
 +
Windows fully (no hibernation or fast restarting), or mount the volume
 +
read-only with the 'ro' mount option.
  
Install {{pkg|ntfsprogs}}.
+
The problem is due to a feature introduced in Windows 8 called "fast startup". When fast startup is enabled, part of the metadata of all mounted partitions are restored to the state they were at the previous closing down. As a consequence, changes made on Linux may be lost. This can happen to any NTFS partition when selecting "Shut down" or "Hibernate" under Windows 8 or 10. Leaving Windows by selecting "Restart", however, is apparently safe.
  
{{Warning|As always, double check the device path.}}
+
To enable writing to the partitions on other operating systems, be sure fast restart is disabled. This can be achieved by issuing as an administrator the command:
 +
 
 +
powercfg /h off
 +
 
 +
You can check the current settings on ''Control Panel > Hardware and Sound > Power Options > System Setting > Choose what the power buttons do''. The box ''Turn on fast startup'' should either be disabled or missing.
 +
 
 +
=== Mount failure ===
 +
 
 +
If you cannot mount your NTFS partition even when following this guide, try using the [[UUID]] instead of device name in {{ic|/etc/fstab}} for all NTFS partitions. Here's an fstab [[Fstab#UUIDs|example]].
 +
 
 +
=== Kernel parameters and other configuration ===
 +
 
 +
{{Accuracy|Undone on package updates}}
 +
{{Style|This was merged from [[mount]]. Needs to be cleaned up and fit into the article better.}}
 +
 
 +
The default configuration:
 +
{{hc|$ zgrep ^CONFIG_NTFS  /proc/config.gz|2=
 +
CONFIG_NTFS_FS=m
 +
CONFIG_NTFS_RW=y
 +
}}
 +
 
 +
The kernel config option {{ic|1= CONFIG_NTFS_RW=y}} enables read-write support for [[Wikipedia:NTFS|NTFS]] file systems. It also means the kernel is predefined to use the [[Ntfs|ntfs-3g]] driver in read-write mode. The built-in support of the NTFS file systems by the kernel is ''read-only'' even if read-write is activated by an option.
 +
 
 +
{{Note|
 +
* When [[Ntfs|ntfs-3g]] is being installed it might create a symlink {{ic|/usr/bin/mount.ntfs}} to the {{ic|/usr/bin/ntfs-3g}}.
 +
* The [[Ntfs|ntfs-3g]] mount tool supports many of the same command line options as the linux standard ''mount'' utility, but is specialized for mounting of [[Wikipedia:NTFS|NTFS]] formatted partitions.
 +
* By default on mounting the [[Ntfs|ntfs-3g]] driver gives the full read-write permissions to all users. In some situations access with a full permission rights can cause damage; see [[Ntfs#Troubleshooting|NTFS troubleshooting]].
 +
}}
 +
 
 +
The default mount options can be altered when running {{ic|mount.ntfs}} by renaming the {{ic|/usr/bin/mount.ntfs}} symlink, if it exists, and creating a script in its place with a preferred set of options, or use the ''-i'' option ({{ic|mount -i -t ntfs}}) to ignore all the ''mount.X'' files and use the natively supported functionality by the kernel. This example will mount NTFS as read-only:
 +
 
 +
{{hc|/usr/bin/mount.ntfs|2=
 +
#!/bin/bash
 +
#mount -i -oro "$@"
 +
#mount with a read-only rights
 +
ntfs-3g -oro  "$@" & disown
 +
}}
 +
 
 +
See {{ic|man 8 ntfs-3g}} for more information about the ntfs-3g driver.
  
# mkfs.ntfs -L myCoolDiskName /dev/sdc1
+
You can add more actions for when an external storage device, such as a USB drive or image file (ISO, img, dd), is mounted by using scripts.
  
== Resources ==
+
== See also ==
  
* [http://www.tuxera.com/community/ntfs-3g-manual/ Official NTFS-3G Manual]
+
* [http://www.tuxera.com/community/ntfs-3g-manual/ Official NTFS-3G manual]

Latest revision as of 01:50, 1 November 2016

Related articles

NTFS-3G is an open source implementation of Microsoft's NTFS file system that includes read and write support. NTFS-3G developers use the FUSE file system to facilitate development and to help with portability.

Installation

Install the ntfs-3g package.

Manual mounting

Two options exist for manually mounting NTFS partitions. The traditional:

# mount -t ntfs-3g /dev/your_NTFS_partition /mount/point

Mount type ntfs-3g does not need to be explicitly specified in Arch. The mount command by default will use /usr/bin/mount.ntfs which is symlinked to /usr/bin/ntfs-3g after the ntfs-3g package is installed.

The second option is to call ntfs-3g directly:

# ntfs-3g /dev/your_NTFS_partition /mount/point

Formatting

Warning: As always, double check the device path.
# mkfs.ntfs -Q -L diskLabel /dev/sdXY
Note: -Q speeds up the formatting by not zeroing the drive and not checking for bad sectors.

Configuring

Your NTFS partition(s) can be setup to mount automatically, or pre-configured to be able to mount in a certain way when you would like them to be mounted. This configuration can be done in the static filesystem configuration (fstab) or by the use of udev rules.

Default settings

Using the default settings will mount the NTFS partition(s) at boot. With this method, if the parent folder that it is mounted upon has the proper user or group permissions, then that user or group will be able to read and write on that partition(s).

Put this in /etc/fstab:

# <file system>   <dir>		<type>    <options>             <dump>  <pass>
/dev/NTFS-part  /mnt/windows  ntfs-3g   defaults		  0       0

Linux compatible permissions

Permissions on a Linux system are normally set to 755 for folders and 644 for files. It is recommended to keep these permissions in use for the NTFS partition as well if you use the partition on a regular basis. The following example assigns the above permissions to a normal user:

# Mount internal Windows partition with linux compatible permissions, i.e. 755 for directories (dmask=022) and 644 for files (fmask=133)
UUID=01CD2ABB65E17DE0 /run/media/user1/Windows ntfs-3g uid=user1,gid=users,dmask=022,fmask=133 0 0

Allowing group/user

In /etc/fstab you can also specify other options like those who are allowed to access (read) the partition. For example, for you to allow people in the users group to have access:

/dev/NTFS-partition  /mnt/windows  ntfs-3g   gid=users,umask=0022    0       0

By default, the above line will enable write support for root only. To enable user writing, you have to specify the user who should be granted write permissions. Use the uid parameter together with your username to enable user writing:

/dev/NTFS-partition  /mnt/windows  ntfs-3g   uid=username,gid=users,umask=0022    0       0

If you are running on a single user machine, you may like to own the file system yourself and grant all possible permissions:

/dev/NTFS-partition  /mnt/windows  ntfs-3g   uid=username,gid=users    0       0

Basic NTFS-3G options

For most, the above settings should suffice. Here are a few other options that are general common options for various Linux filesystems. For a complete list, see this

umask
umask is a built-in shell command which automatically sets file permissions on newly created files. For Arch Linux, the default umask for root and user is 0022. With 0022 new folders have the directory permissions of 755 and new files have permissions of 644. You can read more about umask permissions here.
noauto
If noauto is set, NTFS entries in /etc/fstab do not get mounted automatically at boot.
uid
The user id number. This allows a specific user to have full access to the partition. Your uid can be found with the id command.
fmask and dmask
Like umask but defining file and directory respectively individually.

Allowing user to mount

By default, ntfs-3g requires root rights to mount the filesystem, even with the "user" option in /etc/fstab. See ntfs-3g-faq for details. The user option in the fstab is still required.

Note:
  • The ntfs-3g package does not have internal FUSE support. Rebuild the package using ABS, or install ntfs-3g-fuseAUR.
  • There seems to be an issue with unmounting rights, so you will still need root rights if you need to unmount the filesystem. You can also use fusermount -u /mnt/mountpoint to unmount the filesystem without root rights. Also, if you use the users option (plural) in /etc/fstab instead of the user option, you will be able to both mount and unmount the filesystem using the mount and umount commands.

ntfs-config

ntfs-configAUR is a program that may be able to help configure your NTFS partition(s) if other methods do not work.

Resizing NTFS partition

Note: Please ensure you have a backup before attempting this if your data is important!

Most systems that are purchased already have Windows installed on it, and some people would prefer not wipe it off completely when doing an Arch Linux installation. For this reason, among others, it is useful to resize the existing Windows partition to make room for a Linux partition or two. This is often accomplished with a Live CD or bootable USB thumb drive.

For Live CDs the typical procedure is to download an ISO file, burn it to a CD, and then boot from it. InfraRecorder is a free (as in GPL3) CD/DVD burning application for Windows which fits the bill nicely. If you would rather use a bootable USB media instead, see USB flash installation media for methods to create bootable USB stick.

There are a number of bootable CD/USB images avaliable. This list is not exhaustive, but is a good place to start:

  • GParted — Small bootable GNU/Linux distribution for x86 based computers. It enables you to use all the features of the latest versions of the GParted application. Does not include additional packages System Rescue CD may incorporate, and disk encryption schemes may not be supported.
http://gparted.sourceforge.net/ ||
  • Parted Magic — Very good complete hard disk management solution. With the Partition Editor you can re-size, copy, and move partitions. You can grow or shrink your C: drive. Create space for new operating systems. Attempt data rescue from lost partitions.
http://partedmagic.com/ ||
  • SystemRescueCD — Good tool to have, and works seamlessly in most cases. Once booted, run GParted and the rest should be fairly obvious.
http://www.sysresccd.org/ ||

Note that the important programs for resizing NTFS partitions include ntfs-3g and a utility like (G)parted or fdisk, provided by the util-linux package. Unless you are an "advanced" user it is advisable to use a tool like GParted to perform any resize operations to minimize the chance of data loss due to user error.

If you already have Arch Linux installed on your system and simply want to resize an existing NTFS partition, you can use the parted and ntfs-3g packages to do it. Optionally, you can use the GParted GUI after installing the GParted package.

Troubleshooting

Damaged NTFS filesystems

If an NTFS filesystem has errors on it, NTFS-3G will mount it as read-only. To fix an NTFS filesystem, load Windows and run its disk checking program, chkdsk. Take in account that ntfsfix can only repair some errors. If it fails, chkdsk will probably succeed.

To fix the NTFS file system, the device must already be unmounted. For example, to fix an NTFS partition residing in /dev/sda2:

# umount /dev/sda2
# ntfsfix /dev/sda2
Mounting volume... OK
Processing of $MFT and $MFTMirr completed successfully.
NTFS volume version is 3.1.
NTFS partition /dev/sda2 was processed successfully.
# mount /dev/sda2

If all went well, the volume will now be writable.

Metadata kept in Windows cache, refused to mount

When dual booting with Windows 8 or 10, trying to mount a partition that is visible to Windows may yield the following error:

The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
Failed to mount '/dev/sdc1': Operation not permitted
The NTFS partition is in an unsafe state. Please resume and shutdown
Windows fully (no hibernation or fast restarting), or mount the volume
read-only with the 'ro' mount option.

The problem is due to a feature introduced in Windows 8 called "fast startup". When fast startup is enabled, part of the metadata of all mounted partitions are restored to the state they were at the previous closing down. As a consequence, changes made on Linux may be lost. This can happen to any NTFS partition when selecting "Shut down" or "Hibernate" under Windows 8 or 10. Leaving Windows by selecting "Restart", however, is apparently safe.

To enable writing to the partitions on other operating systems, be sure fast restart is disabled. This can be achieved by issuing as an administrator the command:

powercfg /h off

You can check the current settings on Control Panel > Hardware and Sound > Power Options > System Setting > Choose what the power buttons do. The box Turn on fast startup should either be disabled or missing.

Mount failure

If you cannot mount your NTFS partition even when following this guide, try using the UUID instead of device name in /etc/fstab for all NTFS partitions. Here's an fstab example.

Kernel parameters and other configuration

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: Undone on package updates (Discuss in Talk:NTFS-3G#)

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements.Tango-edit-clear.png

Reason: This was merged from mount. Needs to be cleaned up and fit into the article better. (Discuss in Talk:NTFS-3G#)

The default configuration:

$ zgrep ^CONFIG_NTFS  /proc/config.gz
CONFIG_NTFS_FS=m
CONFIG_NTFS_RW=y

The kernel config option CONFIG_NTFS_RW=y enables read-write support for NTFS file systems. It also means the kernel is predefined to use the ntfs-3g driver in read-write mode. The built-in support of the NTFS file systems by the kernel is read-only even if read-write is activated by an option.

Note:
  • When ntfs-3g is being installed it might create a symlink /usr/bin/mount.ntfs to the /usr/bin/ntfs-3g.
  • The ntfs-3g mount tool supports many of the same command line options as the linux standard mount utility, but is specialized for mounting of NTFS formatted partitions.
  • By default on mounting the ntfs-3g driver gives the full read-write permissions to all users. In some situations access with a full permission rights can cause damage; see NTFS troubleshooting.

The default mount options can be altered when running mount.ntfs by renaming the /usr/bin/mount.ntfs symlink, if it exists, and creating a script in its place with a preferred set of options, or use the -i option (mount -i -t ntfs) to ignore all the mount.X files and use the natively supported functionality by the kernel. This example will mount NTFS as read-only:

/usr/bin/mount.ntfs
#!/bin/bash
#mount -i -oro "$@"
#mount with a read-only rights
ntfs-3g -oro  "$@" & disown

See man 8 ntfs-3g for more information about the ntfs-3g driver.

You can add more actions for when an external storage device, such as a USB drive or image file (ISO, img, dd), is mounted by using scripts.

See also