Difference between revisions of "NTFS-3G"

From ArchWiki
Jump to: navigation, search
(Editing fstab)
(Mounting the partition using HAL: corrected hyperlink)
Line 75: Line 75:
  
 
== Mounting the partition using HAL ==
 
== Mounting the partition using HAL ==
[[HAL]] can automatically mount your NTFS partition via hotplugging. Create a [[HAL#NTFS|custom HAL policy]] and add yourself to the '''storage''' group to obtain write permission.
+
[[HAL]] can automatically mount your NTFS partition via hotplugging. Create a [[HAL#NTFS_write_access|custom HAL policy]] and add yourself to the '''storage''' group to obtain write permission.
  
 
==Problems==
 
==Problems==
 
If you cant mount your ntfs partion even when following this guide, try to add the UUID section to your fstab to all ntfs partions, you can do it simply by using [http://aur.archlinux.org/packages.php?ID=8178 ntfs-config] package from AUR.
 
If you cant mount your ntfs partion even when following this guide, try to add the UUID section to your fstab to all ntfs partions, you can do it simply by using [http://aur.archlinux.org/packages.php?ID=8178 ntfs-config] package from AUR.

Revision as of 22:42, 14 May 2009

Template:I18n links start Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n links end

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


Installing ntfs-3g

Make sure the [extra] repo is enabled

# pacman -Sy ntfs-3g

Basic configuration

Editing fstab

Edit your /etc/fstab accordingly:

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

For example:

/dev/sda1  /mnt/windows  ntfs-3g  defaults  0 0

Template:Box Note

Advanced configuration

Basically, we don't want to put the defaults option here because we want to have more control of how our NTFS partitions get mounted.

Editing fstab

Edit your /etc/fstab accordingly:

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

Examples:

/dev/sda1  /mnt/windows  ntfs-3g  users,noauto,uid=1000,gid=100,fmask=0113,dmask=0002  0 0
/dev/sda5  /mnt/backup   ntfs-3g  users,uid=1000,gid=100,fmask=0113,dmask=0002         0 0
  • The examples above are useful if you want:
  1. Your NTFS partitions to be mountable and unmountable by any user.
  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.
  3. /dev/sda5 to be automatically mounted at boot but not /dev/sda1

Typical and very useful 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.
  • noauto - do not automatically mount the partition at boot
  • 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 - often required to make files with national characters visible. No longer needed with ntfs-3g 2009.1.1 and newer.

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).

Mounting the partition

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

# mount <partition>

or

# mount <mount point>

Examples:

# mount /dev/sda1
# mount /mnt/backup
  • You can (un)mount NTFS partitions as non-root when you follow the Advanced configuration section of this document.


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.

Problems

If you cant mount your ntfs partion even when following this guide, try to add the UUID section to your fstab to all ntfs partions, you can do it simply by using ntfs-config package from AUR.