patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / Documentation / filesystems / ntfs.txt
1 The Linux NTFS filesystem driver
2 ================================
3
4
5 Table of contents
6 =================
7
8 - Overview
9 - Web site
10 - Features
11 - Supported mount options
12 - Known bugs and (mis-)features
13 - Using Software RAID with NTFS
14 - Limitiations when using the MD driver
15 - ChangeLog
16
17
18 Overview
19 ========
20
21 Linux-NTFS comes with a number of user-space programs known as ntfsprogs.
22 These include mkntfs, a full-featured ntfs file system format utility,
23 ntfsundelete used for recovering files that were unintentionally deleted
24 from an NTFS volume and ntfsresize which is used to resize an NTFS partition.
25 See the web site for more information.
26
27 To mount an NTFS 1.2/3.x (Windows NT4/2000/XP/2003) volume, use the file
28 system type 'ntfs'.  The driver currently supports read-only mode (with no
29 fault-tolerance, encryption or journalling) and very limited, but safe, write
30 support.
31
32 For fault tolerance and raid support (i.e. volume and stripe sets), you can
33 use the kernel's Software RAID / MD driver. See section "Using Software RAID
34 with NTFS" for details.
35
36
37 Web site
38 ========
39
40 There is plenty of additional information on the linux-ntfs web site
41 at http://linux-ntfs.sourceforge.net/
42
43 The web site has a lot of additional information, such as a comprehensive
44 FAQ, documentation on the NTFS on-disk format, informaiton on the Linux-NTFS
45 userspace utilities, etc.
46
47
48 Features
49 ========
50
51 - This is a complete rewrite of the NTFS driver that used to be in the kernel.
52   This new driver implements NTFS read support and is functionally equivalent
53   to the old ntfs driver.
54 - The new driver has full support for sparse files on NTFS 3.x volumes which
55   the old driver isn't happy with.
56 - The new driver supports execution of binaries due to mmap() now being
57   supported.
58 - The new driver supports loopback mounting of files on NTFS which is used by
59   some Linux distributions to enable the user to run Linux from an NTFS
60   partition by creating a large file while in Windows and then loopback
61   mounting the file while in Linux and creating a Linux filesystem on it that
62   is used to install Linux on it.
63 - A comparison of the two drivers using:
64         time find . -type f -exec md5sum "{}" \;
65   run three times in sequence with each driver (after a reboot) on a 1.4GiB
66   NTFS partition, showed the new driver to be 20% faster in total time elapsed
67   (from 9:43 minutes on average down to 7:53). The time spent in user space
68   was unchanged but the time spent in the kernel was decreased by a factor of
69   2.5 (from 85 CPU seconds down to 33).
70 - The driver does not support short file names in general. For backwards
71   compatibility, we implement access to files using their short file names if
72   they exist. The driver will not create short file names however, and a rename
73   will discard any existing short file name.
74 - The new driver supports exporting of mounted NTFS volumes via NFS.
75
76
77 Supported mount options
78 =======================
79
80 In addition to the generic mount options described by the manual page for the
81 mount command (man 8 mount, also see man 5 fstab), the NTFS driver supports the
82 following mount options:
83
84 iocharset=name          Deprecated option.  Still supported but please use
85                         nls=name in the future.  See description for nls=name.
86
87 nls=name                Character set to use when returning file names.
88                         Unlike VFAT, NTFS suppresses names that contain
89                         unconvertible characters.  Note that most character
90                         sets contain insufficient characters to represent all
91                         possible Unicode characters that can exist on NTFS.
92                         To be sure you are not missing any files, you are
93                         advised to use nls=utf8 which is capable of
94                         representing all Unicode characters.
95
96 utf8=<bool>             Option no longer supported.  Currently mapped to
97                         nls=utf8 but please use nls=utf8 in the future and
98                         make sure utf8 is compiled either as module or into
99                         the kernel.  See description for nls=name.
100
101 uid=
102 gid=
103 umask=                  Provide default owner, group, and access mode mask.
104                         These options work as documented in mount(8).  By
105                         default, the files/directories are owned by root and
106                         he/she has read and write permissions, as well as
107                         browse permission for directories.  No one else has any
108                         access permissions.  I.e. the mode on all files is by
109                         default rw------- and for directories rwx------, a
110                         consequence of the default fmask=0177 and dmask=0077.
111                         Using a umask of zero will grant all permissions to
112                         everyone, i.e. all files and directories will have mode
113                         rwxrwxrwx.
114
115 fmask=
116 dmask=                  Instead of specifying umask which applies both to
117                         files and directories, fmask applies only to files and
118                         dmask only to directories.
119
120 sloppy=<BOOL>           If sloppy is specified, ignore unknown mount options.
121                         Otherwise the default behaviour is to abort mount if
122                         any unknown options are found.
123
124 show_sys_files=<BOOL>   If show_sys_files is specified, show the system files
125                         in directory listings.  Otherwise the default behaviour
126                         is to hide the system files.
127                         Note that even when show_sys_files is specified, "$MFT"
128                         will not be visible due to bugs/mis-features in glibc.
129                         Further, note that irrespective of show_sys_files, all
130                         files are accessible by name, i.e. you can always do
131                         "ls -l \$UpCase" for example to specifically show the
132                         system file containing the Unicode upcase table.
133
134 case_sensitive=<BOOL>   If case_sensitive is specified, treat all file names as
135                         case sensitive and create file names in the POSIX
136                         namespace.  Otherwise the default behaviour is to treat
137                         file names as case insensitive and to create file names
138                         in the WIN32/LONG name space.  Note, the Linux NTFS
139                         driver will never create short file names and will
140                         remove them on rename/delete of the corresponding long
141                         file name.
142                         Note that files remain accessible via their short file
143                         name, if it exists.  If case_sensitive, you will need
144                         to provide the correct case of the short file name.
145
146 errors=opt              What to do when critical file system errors are found.
147                         Following values can be used for "opt":
148                           continue: DEFAULT, try to clean-up as much as
149                                     possible, e.g. marking a corrupt inode as
150                                     bad so it is no longer accessed, and then
151                                     continue.
152                           recover:  At present only supported is recovery of
153                                     the boot sector from the backup copy.
154                                     If read-only mount, the recovery is done
155                                     in memory only and not written to disk.
156                         Note that the options are additive, i.e. specifying:
157                            errors=continue,errors=recover
158                         means the driver will attempt to recover and if that
159                         fails it will clean-up as much as possible and
160                         continue.
161
162 mft_zone_multiplier=    Set the MFT zone multiplier for the volume (this
163                         setting is not persistent across mounts and can be
164                         changed from mount to mount but cannot be changed on
165                         remount).  Values of 1 to 4 are allowed, 1 being the
166                         default.  The MFT zone multiplier determines how much
167                         space is reserved for the MFT on the volume.  If all
168                         other space is used up, then the MFT zone will be
169                         shrunk dynamically, so this has no impact on the
170                         amount of free space.  However, it can have an impact
171                         on performance by affecting fragmentation of the MFT.
172                         In general use the default.  If you have a lot of small
173                         files then use a higher value.  The values have the
174                         following meaning:
175                               Value          MFT zone size (% of volume size)
176                                 1               12.5%
177                                 2               25%
178                                 3               37.5%
179                                 4               50%
180                         Note this option is irrelevant for read-only mounts.
181
182
183 Known bugs and (mis-)features
184 =============================
185
186 - The link count on each directory inode entry is set to 1, due to Linux not
187   supporting directory hard links.  This may well confuse some user space
188   applications, since the directory names will have the same inode numbers.
189   This also speeds up ntfs_read_inode() immensely.  And we haven't found any
190   problems with this approach so far.  If you find a problem with this, please
191   let us know.
192
193
194 Please send bug reports/comments/feedback/abuse to the Linux-NTFS development
195 list at sourceforge: linux-ntfs-dev@lists.sourceforge.net
196
197
198 Using Software RAID with NTFS
199 =============================
200
201 For support of volume and stripe sets, use the kernel's Software RAID / MD
202 driver and set up your /etc/raidtab appropriately (see man 5 raidtab).
203
204 Linear volume sets, i.e. linear raid, as well as stripe sets, i.e. raid level
205 0, have been tested and work fine (though see section "Limitiations when using
206 the MD driver with NTFS volumes" especially if you want to use linear raid).
207 Even though untested, there is no reason why mirrors, i.e. raid level 1, and
208 stripes with parity, i.e. raid level 5, should not work, too.
209
210 You have to use the "persistent-superblock 0" option for each raid-disk in the
211 NTFS volume/stripe you are configuring in /etc/raidtab as the persistent
212 superblock used by the MD driver would damange the NTFS volume.
213
214 Windows by default uses a stripe chunk size of 64k, so you probably want the
215 "chunk-size 64k" option for each raid-disk, too.
216
217 For example, if you have a stripe set consisting of two partitions /dev/hda5
218 and /dev/hdb1 your /etc/raidtab would look like this:
219
220 raiddev /dev/md0
221         raid-level      0
222         nr-raid-disks   2
223         nr-spare-disks  0
224         persistent-superblock   0
225         chunk-size      64k
226         device          /dev/hda5
227         raid-disk       0
228         device          /dev/hdb1
229         raid-disl       1
230
231 For linear raid, just change the raid-level above to "raid-level linear", for
232 mirrors, change it to "raid-level 1", and for stripe sets with parity, change
233 it to "raid-level 5".
234
235 Note for stripe sets with parity you will also need to tell the MD driver
236 which parity algorithm to use by specifying the option "parity-algorithm
237 which", where you need to replace "which" with the name of the algorithm to
238 use (see man 5 raidtab for available algorithms) and you will have to try the
239 different available algorithms until you find one that works.  Make sure you
240 are working read-only when playing with this as you may damage your data
241 otherwise.  If you find which algorithm works please let us know (email the
242 linux-ntfs developers list linux-ntfs-dev@lists.sourceforge.net or drop in on
243 IRC in channel #ntfs on the irc.freenode.net network) so we can update this
244 documentation.
245
246 Once the raidtab is setup, run for example raid0run -a to start all devices or
247 raid0run /dev/md0 to start a particular md device, in this case /dev/md0.
248
249 Then just use the mount command as usual to mount the ntfs volume using for
250 example:        mount -t ntfs -o ro /dev/md0 /mnt/myntfsvolume
251
252 It is advisable to do the mount read-only to see if the md volume has been
253 setup correctly to avoid the possibility of causing damage to the data on the
254 ntfs volume.
255
256
257 Limitiations when using the MD driver
258 =====================================
259
260 Using the md driver will not work properly if any of your NTFS partitions have
261 an odd number of sectors.  This is especially important for linear raid as all
262 data after the first partition with an odd number of sectors will be offset by
263 one or more sectors so if you mount such a partition with write support you
264 will cause massive damage to the data on the volume which will only become
265 apparent when you try to use the volume again under Windows.
266
267 So when using linear raid, make sure that all your partitions have an even
268 number of sectors BEFORE attempting to use it.  You have been warned!
269
270
271 ChangeLog
272 =========
273
274 Note, a technical ChangeLog aimed at kernel hackers is in fs/ntfs/ChangeLog.
275
276 2.1.14:
277         - Fix an NFSd caused deadlock reported by several users.
278 2.1.13:
279         - Implement writing of inodes (access time updates are not implemented
280           yet so mounting with -o noatime,nodiratime is enforced).
281         - Enable writing out of resident files so you can now overwrite any
282           uncompressed, unencrypted, nonsparse file as long as you do not
283           change the file size.
284         - Add housekeeping of ntfs system files so that ntfsfix no longer needs
285           to be run after writing to an NTFS volume.
286           NOTE:  This still leaves quota tracking and user space journalling on
287           the side but they should not cause data corruption.  In the worst
288           case the charged quotas will be out of date ($Quota) and some
289           userspace applications might get confused due to the out of date
290           userspace journal ($UsnJrnl).
291 2.1.12:
292         - Fix the second fix to the decompression engine from the 2.1.9 release
293           and some further internals cleanups.
294 2.1.11:
295         - Driver internal cleanups.
296 2.1.10:
297         - Force read-only (re)mounting of volumes with unsupported volume
298           flags and various cleanups.
299 2.1.9:
300         - Fix two bugs in handling of corner cases in the decompression engine.
301 2.1.8:
302         - Read the $MFT mirror and compare it to the $MFT and if the two do not
303           match, force a read-only mount and do not allow read-write remounts.
304         - Read and parse the $LogFile journal and if it indicates that the
305           volume was not shutdown cleanly, force a read-only mount and do not
306           allow read-write remounts.  If the $LogFile indicates a clean
307           shutdown and a read-write (re)mount is requested, empty $LogFile to
308           ensure that Windows cannot cause data corruption by replaying a stale
309           journal after Linux has written to the volume.
310         - Improve time handling so that the NTFS time is fully preserved when
311           converted to kernel time and only up to 99 nano-seconds are lost when
312           kernel time is converted to NTFS time.
313 2.1.7:
314         - Enable NFS exporting of mounted NTFS volumes.
315 2.1.6:
316         - Fix minor bug in handling of compressed directories that fixes the
317           erroneous "du" and "stat" output people reported.
318 2.1.5:
319         - Minor bug fix in attribute list attribute handling that fixes the
320           I/O errors on "ls" of certain fragmented files found by at least two
321           people running Windows XP.
322 2.1.4:
323         - Minor update allowing compilation with all gcc versions (well, the
324           ones the kernel can be compiled with anyway).
325 2.1.3:
326         - Major bug fixes for reading files and volumes in corner cases which
327           were being hit by Windows 2k/XP users.
328 2.1.2:
329         - Major bug fixes aleviating the hangs in statfs experienced by some
330           users.
331 2.1.1:
332         - Update handling of compressed files so people no longer get the
333           frequently reported warning messages about initialized_size !=
334           data_size.
335 2.1.0:
336         - Add configuration option for developmental write support.
337         - Initial implementation of file overwriting. (Writes to resident files
338           are not written out to disk yet, so avoid writing to files smaller
339           than about 1kiB.)
340         - Intercept/abort changes in file size as they are not implemented yet.
341 2.0.25:
342         - Minor bugfixes in error code paths and small cleanups.
343 2.0.24:
344         - Small internal cleanups.
345         - Support for sendfile system call. (Christoph Hellwig)
346 2.0.23:
347         - Massive internal locking changes to mft record locking. Fixes
348           various race conditions and deadlocks.
349         - Fix ntfs over loopback for compressed files by adding an
350           optimization barrier. (gcc was screwing up otherwise ?)
351         Thanks go to Christoph Hellwig for pointing these two out:
352         - Remove now unused function fs/ntfs/malloc.h::vmalloc_nofs().
353         - Fix ntfs_free() for ia64 and parisc.
354 2.0.22:
355         - Small internal cleanups.
356 2.0.21:
357         These only affect 32-bit architectures:
358         - Check for, and refuse to mount too large volumes (maximum is 2TiB).
359         - Check for, and refuse to open too large files and directories
360           (maximum is 16TiB).
361 2.0.20:
362         - Support non-resident directory index bitmaps. This means we now cope
363           with huge directories without problems.
364         - Fix a page leak that manifested itself in some cases when reading
365           directory contents.
366         - Internal cleanups.
367 2.0.19:
368         - Fix race condition and improvements in block i/o interface.
369         - Optimization when reading compressed files.
370 2.0.18:
371         - Fix race condition in reading of compressed files.
372 2.0.17:
373         - Cleanups and optimizations.
374 2.0.16:
375         - Fix stupid bug introduced in 2.0.15 in new attribute inode API.
376         - Big internal cleanup replacing the mftbmp access hacks by using the
377           new attribute inode API instead.
378 2.0.15:
379         - Bug fix in parsing of remount options.
380         - Internal changes implementing attribute (fake) inodes allowing all
381           attribute i/o to go via the page cache and to use all the normal
382           vfs/mm functionality.
383 2.0.14:
384         - Internal changes improving run list merging code and minor locking
385           change to not rely on BKL in ntfs_statfs().
386 2.0.13:
387         - Internal changes towards using iget5_locked() in preparation for
388           fake inodes and small cleanups to ntfs_volume structure.
389 2.0.12:
390         - Internal cleanups in address space operations made possible by the
391           changes introduced in the previous release.
392 2.0.11:
393         - Internal updates and cleanups introducing the first step towards
394           fake inode based attribute i/o.
395 2.0.10:
396         - Microsoft says that the maximum number of inodes is 2^32 - 1. Update
397           the driver accordingly to only use 32-bits to store inode numbers on
398           32-bit architectures. This improves the speed of the driver a little.
399 2.0.9:
400         - Change decompression engine to use a single buffer. This should not
401           affect performance except perhaps on the most heavy i/o on SMP
402           systems when accessing multiple compressed files from multiple
403           devices simultaneously.
404         - Minor updates and cleanups.
405 2.0.8:
406         - Remove now obsolete show_inodes and posix mount option(s).
407         - Restore show_sys_files mount option.
408         - Add new mount option case_sensitive, to determine if the driver
409           treats file names as case sensitive or not.
410         - Mostly drop support for short file names (for backwards compatibility
411           we only support accessing files via their short file name if one
412           exists).
413         - Fix dcache aliasing issues wrt short/long file names.
414         - Cleanups and minor fixes.
415 2.0.7:
416         - Just cleanups.
417 2.0.6:
418         - Major bugfix to make compatible with other kernel changes. This fixes
419           the hangs/oopses on umount.
420         - Locking cleanup in directory operations (remove BKL usage).
421 2.0.5:
422         - Major buffer overflow bug fix.
423         - Minor cleanups and updates for kernel 2.5.12.
424 2.0.4:
425         - Cleanups and updates for kernel 2.5.11.
426 2.0.3:
427         - Small bug fixes, cleanups, and performance improvements.
428 2.0.2:
429         - Use default fmask of 0177 so that files are no executable by default.
430           If you want owner executable files, just use fmask=0077.
431         - Update for kernel 2.5.9 but preserve backwards compatibility with
432           kernel 2.5.7.
433         - Minor bug fixes, cleanups, and updates.
434 2.0.1:
435         - Minor updates, primarily set the executable bit by default on files
436           so they can be executed.
437 2.0.0:
438         - Started ChangeLog.
439