NTFS-3G

From Gentoo Linux Wiki
Jump to: navigation, search

Filesystems TOC

Filesystem.png

NTFS-3G is an open source implementation of the NTFS file system with read-write support. NTFS-3G uses the FUSE file system interface and is licensed under the GNU General Public License.

Contents

[edit] Installation

NTFS-3g supports the following USE flags:

  • external-fuse: Use external FUSE library instead of internal one. Must be disabled for unprivileged mounting to work.
  • acl: Adds support for Access Control Lists.
  • debug: Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see http://www.gentoo.org/proj/en/qa/backtraces.xml
  • hal: Enable Hardware Abstraction Layer (HAL) support
  • suid: Enable setuid root for the program, with potential security risks. This flag allows simple users to mount an ntfs partition using ntfs-3g.
  • udev: Enable sys-fs/udev integration (device discovery, power and storage device support, etc)

Check the default state of the flags:

emerge -pv ntfs3g

Enable flags that you need and emerge this package.

[edit] Configuration

[edit] Kernel Configuration

Linux Kernel Configuration: NTFS-3G kernel configuration
 File systems  --->
     <M> FUSE (Filesystem in Userspace) support

Build and install this module:

make && make modules_install

Load the module (this also updates /etc/modules.conf):

update-modules

[edit] Usage examples

Replace /dev/hda1 with your NTFS volume and /mnt/windows with your mountpoint.

[edit] Mount a volume manually

Full access to all users, permission free (if suid USE-flag is set):

ntfs-3g /dev/hda1 /mnt/windows

[edit] Mount at boot

To mount windows partition we need to edit /etc/fstab.

Note: You can combine the options provided in the following examples into one single line of /etc/fstab
Warning: Make sure that if /usr is a separate partition, the mount line for ntfs-3g has to be after the mount line for /usr, otherwise it won't load because the ntfs-3g files are stored in there.
File: /etc/fstab
# Simple mount
#  /dev/hda1 /mnt/windows ntfs-3g 0 0

# Add Locale:
#  /dev/hda1 /mnt/windows ntfs-3g locale=en_US.utf8 0 0

# Access for non Root-Users(make ntfs partitions mountable for a normal user, unmountable for everyone else): 
# Set the suid flag for the ntfs-3g binary and then re-emerge it:
#  /dev/hda1 /mnt/windows ntfs-3g users 0 0

# To make a user/group own everything on the ntfs drive:
# A User's ID and GID can be found with command: id your_username
#  /dev/hda1 /mnt/windows ntfs-3g users,uid=THE_ID_OF_THE_OWNER,gid=THE_ID_OF_THE_GROUP 0 0

# If you don't want the drive to be automounted at boot:
#  /dev/hda1 /mnt/windows ntfs-3g noauto 0 0

# One single line doing all above options 
   /dev/hda1 /mnt/windows ntfs-3g users,locale=en_US.utf8,uid=THE_ID_OF_THE_OWNER,gid=THE_ID_OF_THE_GROUP,noauto 0 0

# Also, if you've given the partition a label (by giving it a "volume name" from Windows or a "label" using ntfslabel 
# from sys-fs/ntfsprogs), you can mount the partition by it's label in /etc/fstab: 
#  LABEL=Windows-XP /mnt/windows ntfs-3g users,locale=en_US.utf8,uid=THE_ID_OF_THE_OWNER,gid=THE_ID_OF_THE_GROUP,noauto 0 0

For more mount options please read the manual:

man ntfs-3g

If you added option users then now you can mount the drive as a normal user:

mount /mnt/windows

When using the automount features, you can set the read/write mode by default by creating the following symlink:

ln -s /sbin/mount.ntfs-3g /sbin/mount.ntfs

To disable it, just remove the symlink.

[edit] Mount automatically through udev

The udev flag is now the easiest way to automount yours ntfs storage devices (external hdd, pendrives, etc.) with essentially writing support. If you missed to compile ntfs3g with this flag there's anyway a quick workaround.

Create the following file:

File: /etc/udev/rules.d/99-ntfs3g.rules
ENV{ID_FS_TYPE}=="ntfs", ENV{ID_FS_TYPE}="ntfs-3g"
Personal tools
In other languages