Section: Maintenance Commands (8)
Updated: Mar 2014
ntfs-3g [-o option[,...]] volume mount_point
mount -t ntfs-3g [-o option[,...]] volume mount_point
lowntfs-3g [-o option[,...]] volume mount_point
ntfs-3g is an NTFS driver, which can create, remove, rename, move files, directories, hard links, and streams; it can read and write files, including streams, sparse files and transparently compressed files; it can handle special files like symbolic links, devices, and FIFOs; moreover it provides standard management of file ownership and permissions, including POSIX ACLs.
It comes in two variants ntfs-3g and lowntfs-3g with a few differences mentioned below in relevant options descriptions.
On computers which can be dual-booted into Windows or Linux, Windows has to be fully shut down before booting into Linux, otherwise the NTFS file systems on internal disks may be left in an inconsistent state and changes made by Linux may be ignored by Windows.
So, Windows may not be left in hibernation when starting Linux, in order to avoid inconsistencies. Moreover, the fast restart feature available on recent Windows systems has to be disabled. This can be achieved by issuing as an Administrator the Windows command which disables both hibernation and fast restarting :
powercfg /h off
By default, files and directories are owned by the effective user and group of the mounting process, and everybody has full read, write, execution and directory browsing permissions. You can also assign permissions to a single user by using the uid and/or the gid options together with the umask, or fmask and dmask options.
Doing so, Windows users have full access to the files created by ntfs-3g.
But, by setting the permissions option, you can benefit from the full ownership and permissions features as defined by POSIX. Moreover, by defining a Windows-to-Linux user mapping, the ownerships and permissions are even applied to Windows users and conversely.
NTFS supports several filename namespaces: DOS, Win32 and POSIX. While the ntfs-3g driver handles all of them, it always creates new files in the POSIX namespace for maximum portability and interoperability reasons. This means that filenames are case sensitive and all characters are allowed except '/' and '\0'. This is perfectly legal on Windows, though some application may get confused. The option windows_names may be used to apply Windows restrictions to new file names.
NTFS stores all data in streams. Every file has exactly one unnamed data stream and can have many named data streams. The size of a file is the size of its unnamed data stream. By default, ntfs-3g will only read the unnamed data stream.
By using the options "streams_interface=windows", with the ntfs-3g driver (not possible with lowntfs-3g), you will be able to read any named data streams, simply by specifying the stream's name after a colon. For example:
Named data streams act like normal files, so you can read from them, write to them and even delete them (using rm). You can list all the named data streams a file has by getting the "ntfs.streams.list" extended attribute.
Below is a summary of the options that ntfs-3g accepts.
The noatime option disables inode access time updates which can speed up file operations and prevent sleeping (notebook) disks spinning up too often thus saving energy and disk lifetime.
The relatime option is very similar to noatime. It updates inode access times relative to modify or change time. The access time is only updated if the previous access time was earlier than the current modify or change time. Unlike noatime this option doesn't break applications that need to know if a file has been read since the last time it was modified. This is the default behaviour.
- it contains some not allowed character,
- or the last character is a space or a dot,
- or the name is reserved.
The forbidden characters are the nine characters " * / : < > ? \ | and those whose code is less than 0x20, and the reserved names are CON, PRN, AUX, NUL, COM1..COM9, LPT1..LPT9, with no suffix or followed by a dot.
Existing such files can still be read (and renamed).
NTFS uses specific ids to record the ownership of files instead of the uid and gid used by Linux. As a consequence a mapping between the ids has to be defined for ownerships to be recorded into NTFS and recognized.
By default, this mapping is fetched from the file .NTFS-3G/UserMapping located in the NTFS partition. The option usermapping= may be used to define another location. When the option permissions is set and no mapping file is found, a default mapping is used.
Each line in the user mapping file defines a mapping. It is organized in three fields separated by colons. The first field identifies a uid, the second field identifies a gid and the third one identifies the corresponding NTFS id, known as a SID. The uid and the gid are optional and defining both of them for the same SID is not recommended.
If no interoperation with Windows is needed, you can use the option permissions to define a standard mapping. Alternately, you may define your own mapping by setting a single default mapping with no uid and gid. In both cases, files created on Linux will appear to Windows as owned by a foreign user, and files created on Windows will appear to Linux as owned by root. Just copy the example below and replace the 9 and 10-digit numbers by any number not greater than 4294967295. The resulting behavior is the same as the one with the option permission set with no ownership option and no user mapping file available.
If a strong interoperation with Windows is needed, the mapping has to be defined for each user and group known in both system, and the SIDs used by Windows has to be collected. This will lead to a user mapping file like :
john::S-1-5-21-3141592653-589793238-462643383-1008 mary::S-1-5-21-3141592653-589793238-462643383-1009 :smith:S-1-5-21-3141592653-589793238-462643383-513 ::S-1-5-21-3141592653-589793238-462643383-10000
Mount /dev/sda1 to /mnt/windows:
ntfs-3g /dev/sda1 /mnt/windows
<DD CLASS="c3|mount -t ntfs-3g /dev/sda1 /mnt/windows:
Mount the ntfs data partition /dev/sda3 to /mnt/data with standard Linux permissions applied :
ntfs-3g -o permissions /dev/sda3 /mnt/data
<DD CLASS="c3|mount -t ntfs-3g -o permissions /dev/sda3 /mnt/data:
Read-only mount /dev/sda5 to /home/user/mnt and make user with uid 1000 to be the owner of all files:
ntfs-3g /dev/sda5 /home/user/mnt -o ro,uid=1000
/etc/fstab entry for the above (the sixth and last field has to be zero to avoid a file system check at boot time) :
/dev/sda5 /home/user/mnt ntfs-3g ro,uid=1000 0 0
To facilitate the use of the ntfs-3g driver in scripts, an exit code is returned to give an indication of the mountability status of a volume. Value 0 means success, and all other ones mean an error. The unique error codes are documented in the (8) manual page.
for common questions and known issues. If you would find a new one in the latest release of the software then please send an email describing it in detail. You can contact the development team on the [email protected] address.
ntfs-3g was based on and a major improvement to ntfsmount and libntfs which were written by Yura Pakhuchiy and the Linux-NTFS team. The improvements were made, the ntfs-3g project was initiated and currently led by long time Linux-NTFS team developer Szabolcs Szakacsits ([email protected]).
Several people made heroic efforts, often over five or more years which resulted the ntfs-3g driver. Most importantly they are Anton Altaparmakov, Jean-Pierre André, Richard Russon, Szabolcs Szakacsits, Yura Pakhuchiy, Yuval Fledel, and the author of the groundbreaking FUSE filesystem development framework, Miklos Szeredi.
Tutoriais de Tecnologia Web