Large file support
||This article includes a list of references, but its sources remain unclear because it has insufficient inline citations. (March 2009) (Learn how and when to remove this template message)|
Traditionally, many operating systems and their underlying file system implementations used 32-bit integers to represent file sizes and positions. Consequently, no file could be larger than 232 − 1 bytes (4 GB − 1). In many implementations, the problem was exacerbated by treating the sizes as signed numbers, which further lowered the limit to 231 − 1 bytes (2 GB − 1). Files that were too large for 32-bit operating systems to handle came to be known as large files.
While the limit was quite acceptable at a time when hard disks were smaller, the general increase in storage capacity combined with increased server and desktop file usage, especially for database and multimedia files, led to intense pressure for OS vendors to remove the limitation.
Merely ensuring the sizes were treated as unsigned numbers would only increase the limit from 2 GB−1 to 4 GB−1, which would have been only a stopgap measure given the explosive growth in data storage. Nevertheless, Windows 95B / DOS 7.10 introduced an API extension (most notably an extended file open call) to access files up to the full 4 GB−1 bytes possible on FAT16B and FAT32 volumes. Applications not aware of this extension continue to use the traditional file open call and were thereby still limited to a maximum of 2 GB−1 bytes for backward compatibility reasons.
This switch caused deployment issues and required design modifications, the consequences of which can still be seen:
- The change to 64-bit file sizes frequently required incompatible changes to file system layout, which meant that large file support sometimes necessitated a file system change. For example, Microsoft Windows' FAT32 file system does not support files larger than 4 GB−1; one has to use NTFS instead. (Some alternative file system implementations support an extension named FAT32+, which supports file sizes up to 256 GB−1 in a mostly backward compatible way, but this extension is not supported in mainstream operating systems so far.)
- To support binary compatibility with old applications, operating system interfaces had to retain their use of 32-bit file sizes and new interfaces had to be designed specifically for large file support.
- To support writing portable code that makes use of LFS where possible, C standard library authors devised mechanisms that, depending on preprocessor constants, transparently redefined the functions to the 64-bit large file aware ones.
- Many old interfaces, especially C-based ones, explicitly specified argument types in a way that did not allow straightforward or transparent transition to 64-bit types. For example, the C functions
ftelloperate on file positions of type
long int, which is typically 32 bits wide on 32-bit platforms, and cannot be made larger without sacrificing backward compatibility. (This was resolved by introducing new functions
ftelloin POSIX. On Windows machines, under Visual C++, functions
- In addition to all of the efforts listed above, all applications had to be recompiled to become LFS-aware. The resulting binaries were typically not running on older releases of the same operating system. This was, and to some extent still remains, a problem for some application vendors.
- File size
- 2 GB limit
- Long filename support (LFN)
- Year 2038 problem
- Comparison of text editors #Extra features
- "Adding Large File Support to the Single UNIX Specification". X/Open Base Working Group. 1996-08-14. Retrieved 2006-09-10.
- Andreas Jaeger (2005-02-15). "Large File Support in Linux". SuSE GmbH (now Novell, Inc.). Retrieved 2006-09-10.
- Solaris OS group (March 1996). "Large Files in Solaris: A White Paper" (PDF). Sun Microsystems, Inc. Archived from the original (PDF) on 2007-02-28. Retrieved 2006-09-10.