Navigation:Documentation:Other:Link Collection:~~CLOUD:30~~ |
NTFS FAQ (Frequently Asked Questions)IntroductionThis FAQ is part of the Linux NTFS Project. The latest version can be found online at http://wiki.linux-ntfs.org/doku.php?id=faq If you have an NTFS question that isn't answered in this FAQ, or you have comments about the FAQ, please use the help forums: http://forum.linux-ntfs.org KeyContents1. General NTFS Questions
2. NTFS Volumes 3. Linux and NTFS 4. Mounting NTFS Volumes 5. Booting Operating Systems on NTFS
6. Linux Distributions 7. The New Linux NTFS Driver 1. General NTFS Questions1.1 What is NTFS?NTFS is an abbreviation for New Technology Filesystem. NT because it was originally used in Windows NT and a filesystem is just how the computer stores files on disk. Different operating system, stores files in different ways. NTFS is used by Windows NT, 2000, XP, Windows Server 2003 and Windows Vista. 1.2 Is NTFS better than FAT/FAT32?In brief, yes. It's far more robust, it supports Unicode filenames, proper security, compression and encryption. Its main fault is that it can only be read from Windows NT, 2000 or XP, i.e. you can't use a DOS boot disk and then read your data. As always there are exceptions to this rule. Linux has had a driver for NTFS since December 1997. Also there's a program to give DOS NTFS support (see Section 2.1 for more details). 1.3 Do I have to use NTFS? (Or upgrade?)No, you don't have to, though for most people it is a good idea. You probably won't even notice the difference. The only catch, is that you cannot convert back to FAT (see Section 2.3 for more details).
1.4 Is NTFS the same in every version of Windows?No. They will look similar, but newer versions have extra features. For example, Windows 2000 has quotas.
Version 1.2 is sometimes known as 4.0. 1.5 What are NTFS's limits?NTFS is a 64 bit filesystem and in theory its limits are fairly big, however the Microsoft implementation limits file size to 16 TB, volume size to 256 TB and the number of files to 4 billions. See more on the Microsoft site 2. NTFS Volumes2.1 How do I read an NTFS Volume from Windows 95/98/ME or DOS?Unfortunately, you can't. These versions of Windows can only understand FAT. NTFS can only be read by Windows NT, 2000 and XP. However, with a little work, you can use a couple of utilities from http://www.sysinternals.com “NTFS for Windows 98” and “NTFSDOS” allow you to read NTFS from Windows 95, 98 and DOS. If you are prepared to pay, they even have versions that will write to NTFS (N.B. It is very expensive). 2.2 How do I convert a FAT Volume to a NTFS Volume?Open a command window and type (replacing x: with the correct volume): convert x: /fs:ntfs If the volume is in use, the conversion will happen when you next reboot. 2.3 How do I convert an NTFS Volume to a FAT Volume?The simple answer is, “You can't”. There is an exception if you have money. Partition Magic, available from http://www.powerquest.com can convert between several filesystems, including NTFS and FAT. 2.4 How do I delete an NTFS Volume?This depends on which Operating System you are using. DOS, Windows 95/98/ME: fdisk. Use a boot disk, or ask Windows to go to DOS mode. Then run fdisk. If you have more than one disk, first select that. Then you want to delete a non-DOS partition. Be very careful, your changes will be committed immediately. Windows NT: Computer management. Windows 2000, XP and Server 2003: Logical Disk Manager. Start at the Control Panel, select Administrative Tools, then Computer Management. 2.5 Why/How do I defragment an NTFS Volume?
Files like mailboxes which are enlarged very frequently can have hundreds of fragments. This is a good reason to create a seperate volume for storing mailboxes. Cache files for your browser are created and deleted very often and are best placed on a seperate volume. Defragmentation is the process of collecting the fragments of each file and placing them consecutively. This can greatly reduce the time to read existing files and create new ones. Windows 98, 2000, XP and Server 2003 have a defragmenting program included which processes the entire volume. Right click on a volume in explorer and select properties, tools. For users of Windows NT, a free program, Diskeeper Lite, can be downloaded from: http://diskeeper.com This will take several hours depending on the size of the volume and is a good thing to keep you PC busy while you are sleeping.
Some other file systems handle the allocation differently and may not have fragmentation problems. 2.6 How do I resize an NTFS Volume?Use our stable and widely used program, ntfsresize. Or even better, one of the easy-to-use partitioners (DiskDrake, QTParted, YAST, EVMS, Partman, GParted, etc) that integrated it. For more information, please read the ntfsresize FAQ. 3. Linux and NTFS3.1 Which versions of NTFS can Linux read?The Linux Driver can read all versions of NTFS: Windows XP, Windows Server 2003, Windows 2000, Windows NT4 and Windows Vista, used by both 32-bit and 64-bit Windows. Back to the top 3.2 Can I write to an NTFS volume?The Linux-NTFS project provides safe write support in different ways and with different degree of functionality since 2002. At first the kernel driver started to support file overwrite which was used by several distributions to install and run Linux from NTFS by loopback mounting an image file, or use it to store private data or configuration files. In the same year, 2002, ntfsresize was developed and in the following year significantly improved to provide safe and full data relocation support. Today this code is almost exclusively used in numerous partitioners and installers. The next huge step towards much improved write functionality was the release of ntfsmount as part of ntfsprogs, in 2005. Ntfsmount has almost full feature write support. It can resize, create and delete files and directories and even operate on symlinks, devices, FIFOs and sockets. Though ntfsmount has still some restrictions, data safety should not be in risk, especially if you make regular backups with ntfsclone. This is a highly adviced, given that the most often problems we are reported are physical hard disk failures! The development of the kernel driver didn't stop either, though the kernel driver's feature set is much less appealing than ntfsmount's at present. 3.3 What features of NTFS does Linux support?NTFS supports a wide range of features, and the Linux NTFS drivers support the most important and used ones: Unicode filenames (converted into a local codepage, or utf8); compressed files, sparse files, all NTFS cluster sizes from 512 bytes up to 64 kB. The drivers cannot read encrypted files (but ntfsdecrypt can), they ignore Windows' security information, quotas and distributed link tracking. 3.4 What should I do if something goes wrong?The driver is pretty safe, but it's impossible to test everything eventually. If something would go wrong then please help us to find the problem and we'll fix it. Please email the development team at linux-ntfs-dev@lists.sourceforge.net and tell us which version of the driver you are using, which Linux version (uname -a) and which version of NTFS (Win NT, 2K, XP, 2K3 or Vista). Additionally, if there are any NTFS messages in /var/log/messages then please include them. Thanks. 3.5 How do I add NTFS support to Linux?You either need ntfsprogs and FUSE, or the NTFS kernel driver. However most users won't have to do anything to enable NTFS support. Almost every Linux distribution, with the notable exception of RedHat/Fedora, comes with NTFS support out of the box. If you are using RedHat 7.3 or later, then you can simply go to http://www.linux-ntfs.org/content/view/120/59 for NTFS support. The rpm comes with detailed instructions. If you have an older version of RedHat, or another distribution which doesn't include NTFS support, then you will have to compile the kernel yourself. 3.6 Which version is best?The latest versions of the drivers are always the best. 3.7 What other tools are there?There is a wide list of tools available for both users and developers. See them in detail at http://wiki.linux-ntfs.org/doku.php?id=ntfsprogs. 3.8 How was the Linux NTFS Driver written?Microsoft haven't released any documention about the internals of NTFS, so we had to reverse engineer the filesystem from scratch. The method was roughly:
If this sounds like a lot of work, then you probably understand how hard the task has been. We now understand pretty much everything about NTFS and we have documented it for the benefit of others: http://www.linux-ntfs.org/content/view/103/42 Actually writing the driver was far simpler than gathering the information. 3.9 Who do we thank?First we have to thank Martin von Löwis. He created the original NTFS driver back in 1995. It was added to the Linux Kernel in December 1997 (2.1.74). He has been helped by the following kind souls: Albert Cahalan, Anton Altaparmakov, Damon Casale, David Dillard, Domagoj Pensa, Joseph Malicki, Matthew Fanto, Olof Wolgast, Rani Assaf, Régis Duchesne, Richard Russon, Steve Dodd, Werner Seiler. Next we have to thank Anton Altaparmakov, it was his enthusiasm which kept the project alive. At a time when the project was effectively unmaintained, he took over and stabilised the code. He went on to rewrite the driver from scratch in order to have a clean base to progress with write support. He has been helped by: Pawel Kot, Richard Russon, Szabolcs Szakacsits, Yuval Fledel, Yura Pakhuchiy, Mario Emmenlauer, Christophe Grenier. 4. Mounting NTFS Volumes4.1 Can I mount an NTFS Volume?Of course. The NTFS kernel driver and ntfsmount can read all versions of NTFS and they also have restricted but safe write support. 4.2 How safe is the NTFS Driver?We aren't aware of any reliability problem either in the NTFS kernel driver, or in ntfsmount. But we do have lots of positive feedbacks. 4.3 Which partition should I use?In Linux disks are named hda, hdb for the first two disk on the first IDE controller and hdc, hdd for the third and fourth disks. SCSI disks are named sda, sdb, etc, in the order they are discovered. A simple way to look for NTFS Volumes is using: fdisk -l The output might look like: Disk /dev/hda: 64 heads, 63 sectors, 4465 cylinders Units = cylinders of 4032 * 512 bytes Device Boot Start End Blocks Id System /dev/hda1 1 2125 4283968+ 07 NTFS/HPFS /dev/hda2 2126 19851 35735616 0f Win95 Ext'd (LBA) /dev/hda5 * 2126 4209 4201312+ 83 Linux /dev/hda6 4210 4465 516064+ 82 Linux swap 4.4 Which version of the NTFS Driver do I have?If your kernel version is 2.4.*, then you probably have the obsolete NTFS driver which was not developed and are not supported by this project. If you have later kernel versions, then you have our NTFS driver. A better test is to look through the kernel logs for the NTFS log message. Try either of these commands (you may need to be root to read the logs). dmesg | grep -i ntfs grep -i ntfs /var/log/messages The obsolete NTFS driver is version 1.1.*, whereas our project's driver is version 2.*. 4.5 How do I mount an NTFS Volume?First of all, it might be an idea to check that your kernel understands NTFS. The command below will give a list of all the filesystems that Linux understands. If you see ntfs, then you are OK. Also it might be a good idea to read the mount manual, man 8 mount. cat /proc/filesystems Next you need to create a place to mount the NTFS Volume. Then you can mount it. mkdir /mnt/windows mount /dev/hda1 /mnt/windows -t ntfs -r If this gives you the error “The device /dev/hda1 doesn't exist”, see Section 4.3
When you have finished, you can unmount the partition with either of: umount /mnt/windows umount /dev/hda1 4.6 Common mount options.These mount options are common to both drivers. It's recommended to also read the man page for mount. The general form of mount is: mount device directory [options] Additional options of the for -o option can be given individually, or as one parameter separated with commas. These two commands are equivalent: mount /dev/hda1 /mnt/windows -o X -o Y -o Z mount /dev/hda1 /mnt/windows -o X,Y,Z -t ntfsTell mount the type of the filesystem it will mount. This option isn't necessary, since mount knows how to identify most filesystem types. -rMount the volume, read-only. By default, mount will attempt to mount the volume read-write. Unless forced, the driver will automatically mount the filesystem read-only. -o roThis is the same as -r. -o umask={VALUE}The default permissions given to a mounted NTFS Volume are rwx—— (this is for security reasons). The umask parameter controls the permissions of files and directories. For more details and examples, see Section 4.9. mount /dev/hda1 /mnt/windows -t ntfs -r -o umask=0222 -o uid={USERID}By default all the files on a mounted NTFS Volume will be owned by root. If you supply a uid parameter you can set the owner of the files. The userid can be any name from /etc/passwd, or any number representing a user id. mount /dev/hda1 /mnt/windows -t ntfs -r -o uid=flatcap mount /dev/hda1 /mnt/windows -t ntfs -r -o uid=500 -o gid={GROUPID}By default all the files on a mounted NTFS Volume will have a group owner of root. If you supply a gid parameter you can set the group of the files. The groupid can be any name from /etc/group, or any number representing a group id. mount /dev/hda1 /mnt/windows -t ntfs -r -o gid=winusers mount /dev/hda1 /mnt/windows -t ntfs -r -o gid=520 4.7 Mount options for the Obsolete Driver.To find out which driver you are using, see Section 4.4. This section discusses the options for the Original Driver only. All the common mount options are discussed in Section 4.6.
Several options take a true or false parameter. -o iocharset={NAME}NTFS stores all file and directory names in Unicode which can represent any character from any language. By default the Linux NTFS driver converts the names to ASCII which is OK for some people, but no good if your languages includes letters like å or é. NLS (Native Language Support) controls how characters are displayed. You can choose either utf8 which, like Unicode, can represent all characters, or your own codepage, e.g. iso8859-1 (Western Europe), iso8859-2 (Central Europe), gb2312 (Simplified Chinese), iso8859-8 (Hebrew). Below are some example mount commands: mount /dev/hda1 /mnt/windows -t ntfs -r -o iocharset=utf8 mount /dev/hda1 /mnt/windows -t ntfs -r -o iocharset=iso8859-2 mount /dev/hda1 /mnt/windows -t ntfs -r -o iocharset=gb2312 -o utf8=trueIf your kernel doesn't support utf8, then you can use this option to work with utf8 support from the NTFS Driver. You should use -o iocharset=utf8 wherever possible. mount /dev/hda1 /mnt/windows -t ntfs -r -o utf8=true -o posix={BOOL}Windows preserves the case of filenames, but it doesn't distinguish when you read. Therefore you can create a file called MyFileName and then open it by asking for mYfILEname. By default Linux is case sensitive, MyFile, MyFile and myfile are all different files. If you would like Linux to behave like Windows, for an NTFS volume, set the posix option to true. Setting the option to false will make the driver behave like Linux (the default). mount /dev/hda1 /mnt/windows -t ntfs -r -o posix=true -o show_sys_files={BOOL}If this option is set to true, then the filesystem metadata will be visible. If the aren't visible, they can still be explicitly listed by providing their name, e.g. ls -l \$MFT
mount /dev/hda1 /mnt/windows -t ntfs -r -o show_sys_files=true 4.8 Mount options for the New Driver.To find out which driver you are using, see Section 4.4. This section discusses the options for the New Driver only. All the common mount options are discussed in Section 4.6.
Several options take a true or false parameter. -o nls={NAME}NTFS stores all file and directory names in Unicode which can represent any character from any language. By default the Linux NTFS driver converts the names to ASCII which is OK for some people, but no good if your languages includes letters like å or é.. NLS (Native Language Support) controls how characters are displayed. You can choose either utf8 which, like Unicode, can represent all characters, or your own codepage, e.g. iso8859-1 (Western Europe), iso8859-2 (Central Europe), gb2312 (Simplified Chinese), iso8859-8 (Hebrew). Below are some example mount commands: mount /dev/hda1 /mnt/windows -t ntfs -r -o nls=utf8 mount /dev/hda1 /mnt/windows -t ntfs -r -o nls=iso8859-2 mount /dev/hda1 /mnt/windows -t ntfs -r -o nls=gb2312 -o fmask={VALUE}-o dmask={VALUE}The umask parameter alters the permissions of both files and directories (see Section 4.6 for a reminder). fmask works on files and dmask works on directories in the same way. The effect of the options can be combined, too. Here are some examples: mount /dev/hda1 /mnt/windows -t ntfs -r -o fmask=0222 mount /dev/hda1 /mnt/windows -t ntfs -r -o dmask=0222 mount /dev/hda1 /mnt/windows -t ntfs -r -o fmask=0077,dmask=0222 -o case_sensitive={BOOL}Windows preserves the case of filenames, but it doesn't distinguish when you read. Therefore you can create a file called MyFileName and then open it by asking for mYfILEname. By default Linux is case sensitive, MyFile, MyFile and myfile are all different files. If you would like Linux to behave like Windows, for an NTFS volume, set the case_sensitive option to false. Setting the option to true will make the driver behave like Linux (the default). mount /dev/hda1 /mnt/windows -t ntfs -r -o case_sensitive=true mount /dev/hda1 /mnt/windows -t ntfs -r -o case_sensitive=false -o sloppy={BOOL}By default, the driver will refuse to mount if any of the options are incorrect. By adding the sloppy parameter the driver will simply ignore bad parameters. mount /dev/hda1 /mnt/windows -t ntfs -r -o sloppy=true mount /dev/hda1 /mnt/windows -t ntfs -r -o sloppy=false -o errors={VALUE}This option controls how the driver copes with problems. The default is to try and continue. Any corruption will be marked and worked around. The alternative is to get the driver to try and recover. At present the only recovery the driver can do is to replace the boot sector with the backup. mount /dev/hda1 /mnt/windows -t ntfs -r -o errors=continue mount /dev/hda1 /mnt/windows -t ntfs -r -o errors=recover 4.9 How do I change the permissions of a mounted NTFS Volume?There are three options to control the permissions and ownership of files and directories. They are: umask, uid and gid. They are mentioned in Common mount options. Below are some examples of each option and how it affects the files. We will use the same mount command each time and just show the options. mount /dev/hda1 /mnt/windows -t ntfs -r umask is a filter of permissions, so it works in the opposite way to chmod. Full permissions are equivalent to 777 (rwxrwxrwx). A umask of 0222 (-w–w–w-) leaves 555 (r-xr-xr-x). The default umask is set to 0077, for security reasons. mount ... -o umask=0277 -r-x------ 1 root root 28096 Aug 24 1996 chkdsk.exe mount ... -o umask=0222 -r-xr-xr-x 1 root root 28096 Aug 24 1996 chkdsk.exe So far the files still have an owner and group of root. Next we try the uid and gid options. mount ... -o uid=flatcap -r-x------ 1 flatcap root 28096 Aug 24 1996 chkdsk.exe mount ... -o gid=winuser -r-x------ 1 root winuser 28096 Aug 24 1996 chkdsk.exe mount ... -o uid=flatcap,gid=winuser -r-x------ 1 flatcap winuser 28096 Aug 24 1996 chkdsk.exe Finally we combine a few options for precise control. Below we allow the user flatcap full control, the group of users winuser has read permissions and other people have no access at all. mount ... -o umask=0027,uid=flatcap,gid=winuser -rwxr-x--- 1 flatcap winuser 28096 Aug 24 1996 chkdsk.exe 4.10 How do I mount an NTFS Volume automatically?Once you are happy with your mount command, you can teach Linux how to mount the volume automatically by adding a line to /etc/fstab (filesystem table).
Below are some example mount commands and their equivalent fstab. mount /dev/hda1 /mnt/windows -t ntfs -r /dev/hda1 /mnt/windows ntfs ro 0 0 Here we've transformed ”-r” into the equivalent ”-o ro”. mount /dev/hda1 /mnt/windows -t ntfs -r -o umask=0222 /dev/hda1 /mnt/windows ntfs ro,umask=0222 0 0 mount /dev/hda1 /mnt/windows -t ntfs -r -o umask=0222,uid=flatcap,gid=winuser /dev/hda1 /mnt/windows ntfs ro,umask=0222,uid=flatcap,gid=winuser 0 0 5. Booting Operating Systems on NTFS5.1 Can I boot Windows on an NTFS volume?Yes, both grub and lilo can boot Windows from an NTFS Volume. What actually happens, is that the Linux boot loader finds the NTFS boot loader and gives control to it. 5.2 How do I use lilo?Add this entry to /etc/lilo.conf, then rerun lilo.
other = /dev/hda1
table = /dev/hda
label = Windows
The other points to the partition containing Windows and table points to the partition table of the disk. 5.3 How do I use grub?Add this entry to /boot/grub/grub.conf
title Windows
root (hd0,0)
makeactive
chainloader +1
According to the grub disk numbering, /dev/hda is hd0, hdb is hd1, etc. The partitions are numbered from zero. Therefore, hda1 is hd0,0, hdc4 is hd2,3. 6. Linux Distributions6.1 Which distributions support NTFS out of the box?Virtually all Linux Distributions support NTFS by default except RedHat/Fedora. 6.2 Why don't Red Hat/Fedora support NTFS?Nobody really knows. Red Hat always refers patents which don't exist. This is quite unfortunate since the NTFS specification would have been a great source of information and would have saved a huge amount of reverse engineering work. Thankfully today this isn't a matter anymore. 6.3 Why does Red Hat Linux lock up when accessing an NTFS Volume?Check which kernel version you are using with the command uname -a. If the version is 2.4.9 then it is important for you to update your kernel. See the Red Hat Website for more details. If you'd prefer, you could compile your own kernel. See How do I add NTFS support to Linux? for more details. 6.4 Do any distributions install onto NTFS?Several since 2002. The most popular is Topologilinux. 7. The New Linux NTFS Driver7.1 What is the new NTFS Driver?It is a complete rewrite of the NTFS driver. The original driver was writen over a period of many years. In the beginning we knew little about NTFS or Linux and the source code became hard to maintain. We created a new driver, with our new knowledge, which is much simpler, faster and easier to maintain. 7.2 Do I have to use it?Yes. It's way much better both in functionality and reliability than the obsolete NTFS driver. 7.3 How do I use the new Driver?It is part of the Linux 2.6 kernels. 7.4 What is a patch?A patch is a set of changes for a set of text files. Since we are only altering the NTFS code, it is inefficient to release all the kernel code every time we make a small change. We make our patches against official Linux kernel releases. Once you have unpacked the source, change directory into the source directory and use the command (replacing the path and patchname as necessary): patch -p1 < path/to/patchname This will modify the source code. There should be no rejects or failures. Next build the kernel as normal. There are instructions for this elsewhere in this FAQ. 7.5 What if I still don't understand?Sorry. We try to help everyone we can, but we have a limited amount of time. There are a few sites that might help you understand the basics about Linux. Alternatively, find out if there is a Linux User Group near you. 7.6 When will the new code be in the Linux Kernel?It is already in the Linux 2.6 kernels. 7.7 Can't we write a wrapper for Windows' driver?No. The Linux-NTFS project is about to write a better, open source NTFS driver than the Windows one. Anyway, Jan Kratochvil's Captive is such a Windows' driver wrapper. It is able to write NTFS files, but is known to have limitations and is at least hundred times slower than the native Linux drivers. Captive is based on ReactOS and uses FUSE. |