Reading and writing NTFS in Linux

Section: Linux

NTFS is the New Technology File System that Microsoft introduced with Windows NT. It is designed as an alternative to FAT filesystems and uses a tree structure for more efficient searching of files on disk. As is the idea with search trees, NTFS is supposed to give slightly better performance for games that might be regularly scouring the disk for texture files and the like.

In most situations a Linux user won't have an NTFS partition, but if you're new to Linux and haven't let go of Windows yet, or are simply still dual-booting with a Windows install that uses NTFS on at least one partition, then you may want to access it and even write to it from Linux. This is the situation I was in - I keep Windows to play games like Dawn of War but mainly run under Linux.

Note: Although the following recommended drivers are considered stable and suitable for normal every-day use, they may still cause problems. You follow the instructions at your own risk!

Installing NTFS-3G

Although most flavours of Linux now have in-built NTFS support, it's normally only read support with basic write support (which consists of writing to pre-existing files, but not necessarily creating, deleting or renaming). To get full NTFS support at the moment requires the NTFS-3G drivers.

NTFS-3G is based on the FUSE system that supports the creation of new filesystems based on almost anything. Both FUSE and NTFS-3G are available in the Fedora Extras repository. To install them either select NTFS-3G from your favourite package manager and let it install all of the dependencies, or run the following command (as root):

# yum install ntfs-3g fuse fuse-libs

Once this is complete, you should now have a functional NTFS-3G filesystem that can be used with the mount command with the filesystem type "ntfs-3g".

NTFS-3G and the fstab file

Although a normal install lets you mount the filesystem as root, it won't auto-mount the filesystem at boot time. Instead you need to add an entry into your fstab file.

If your NTFS partition was already mounted using the standard NTFS drivers then replace the file system type (the third column) with "ntfs-3g". If your NTFS partition was not already mounted then add a line similar to the following into your fstab file:

/dev/sdx# /windows/g ntfs-3g silent,user,locale=en_US.utf8,no_def_opts,allow_other,gid=Users,umask=007,exec 0 0

/dev/sdx# should be replaced with your actual partition reference (e.g. /dev/hda1), and /windows/g should be replaced with the folder that you want the partition mounted to. I've also included gid=Users, user and umask=007 to allow my normal user account to have full access to the root of the partition so that I can create files or folders that are equivalent to "g:\temp.txt" (since the partition is my G: drive in Windows).

Notes on NTFS

Even though NTFS-3G is a very stable driver (it is now up to a 1.4 release) it still shows some signs of slight delay compared to more native file systems. The ideal solution would be to copy all Windows NTFS content to Linux EXT3 partitions and keep the data synchronised, but in reality it's often easier to just accept the minor performance issues for the sake of easy access to Windows files.