NTFS Write Support

From ArchWiki

Jump to: navigation, search
i18n
English
Italiano
עברית
Русский
简体中文
Español

This document guides you in setting up read/write access to NTFS partitions using ntfs-3g.

Contents

Installing ntfs-3g

Make sure the [extra] repo is enabled and then install ntfs-3g:

# pacman -Sy ntfs-3g

Basic configuration

Manual mounting

In order to mount an NTFS partion manually, issue the following command in a teminal.

ntfs-3g /dev/sda1 /mnt/<mount point>
 OR
mount -t ntfs-3g /dev/sda1 /mnt/mount_point

Editing fstab

The basic ntfs-3g /etc/fstab entry:

<partition>  <mount point>  ntfs-3g  defaults  0 0

For example:

/dev/sda1  /mnt/windows  ntfs-3g  defaults  0 0
Note: If you have an older version of ntfs-3g than 2009.1.1, add the option locale=<locale>, e.g. defaults,locale=en_PH.utf8, so file names will be shown correctly.

Advanced configuration

If you don't want to allow full access to everybody, you'll want to change the defaults option to a more specific setting.

Editing fstab

Edit your /etc/fstab accordingly:

<partition>  <mount point>  ntfs-3g  <options>  0 0

Example:

/dev/sda1  /mnt/windows  ntfs-3g  users,uid=1000,gid=100,fmask=0113,dmask=0002  0 0
  • The example above will make:
  1. Your NTFS partitions to be unmountable by any user (mounting not implemented yet).
  2. The user (uid=1000) and group (gid=100) to "own" everything in the partition and to have permissions -rw-rw-r-- (0664) for files and drwxrwxr-x (0775) for directories (not implemented yet).

The basic ntfs-3g options

  • users – allow anybody to (un)mount NTFS partitions provided that the ntfs-3g binary is set SUID root (Command: chmod u+s /bin/ntfs-3g). Take note that you have to use users instead of user.
  • uid – the decimal value of the owner of the files and directories in a particular NTFS partition
  • gid – the decimal value of the group of the files and directories in a particular NTFS partition
  • fmask – the octal value of the bitmask of the file permissions
  • dmask – the octal value of the bitmask of the directory permissions
  • locale – once required to make files with national characters visible - no longer needed with ntfs-3g 2009.1.1 and newer.
  • noauto – if noauto is set entries in fstab do not get mounted automatically (not implemented yet).

Bitmask Values

To easily know the bitmask value for a particular permission setting without doing any calculations, all you have to do is:

  1. Fire up a new shell session. Use whatever terminal emulator you like.
  2. Use the umask command to give you the octal representation of a particular permission setting.
    1. "Set" the file mode creation mask using umask. e.g.:
      $ umask ug=rw,o=r
      Take note that ug=rw,o=r is equivalent to -rw-rw-r-- or 0664.
    2. Get the octal equivalent by simply executing umask without any arguments.
      $ umask
      You should get this:
      0113
  • Consult the EXTENDED DESCRIPTION section of the chmod manpage for more info about the mode operand (string format of the new file mode creation mask).

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 it's disk checking program. Repairs of an NTFS filesystem isn't possible yet in Linux.

Mounting the partition

This part can be used to mount your NTFS partition to test if everything works fine. If you wrote everything in fstab, it will be mounted automatically everytime the computer starts.

# mount <partition>

or

# mount <mount point>

Examples:

# mount /dev/sda1
# mount /mnt/backup

Mounting the partition using HAL

HAL can automatically mount your NTFS partition via hotplugging. Create a custom HAL policy and add yourself to the storage group to obtain write permission.

Troubleshooting

If you can't mount your NTFS partion even when following this guide, try to add the UUID section to your fstab to all ntfs partions.

If you'd like to be able to toggle write access to an NTFS drive or partition take a look at ntfs-config in AUR.

Primary boot sector is invalid

If your dmesg output looks like this:

NTFS-fs error (device sdb1): read_ntfs_boot_sector(): Primary boot sector is invalid.
NTFS-fs error (device sdb1): read_ntfs_boot_sector(): Could not find a valid backup boot sector.
NTFS-fs error (device sdb1): ntfs_fill_super(): Not an NTFS volume.

it does not neccessarily mean your drive is corrupt. Try specifying *ntfs* instead of *ntfs-3g* in fstab or on the command line.

Personal tools