File Allocation Table: Difference between revisions

Content deleted Content added
m Fixed k capitalization in frequency and storage capacity units (via WP:JWB)
m Restored kB to KB per Kilobyte#Use of term (via WP:JWB)
Line 25:
| max_files_no = {{ubli
| FAT12: 4,068 for 8&nbsp;[[kilobyte|KB]] clusters <!-- 2^12 − 12 (reserved clusters) − 16 (number of 8&nbsp;KB clusters for directory entries) -->
| FAT16: 65,460 for 32&nbsp;kBKB clusters <!-- 2^16 − 12 (reserved clusters) − 64 (number of 32&nbsp;KB clusters for directory entries) -->
| FAT32: 268,173,300 for 32&nbsp;kBKB clusters <!-- 2^28 − 12 (reserved clusters) − 262144 (number of 32&nbsp;KB clusters for directory entries) -->
}}
| max_filename_size = [[8.3 filename]], or 255 [[UCS-2]] characters when using [[Long filename|LFN]]<ref group="nb" name="NB_LFN_UNI">Since [[Windows 2000]], Microsoft Windows uses [[UTF-16]] instead of [[UCS-2]] for the [[Unicode in Microsoft Windows|internal "Unicode"]]. In UTF-16, a "character" (code point) may take up two code units.</ref>
| max_volume_size = {{ubli
| FAT12: 32&nbsp;[[megabyte|MB]]<!-- with 2^16 sectors á 512 bytes, or with 8&nbsp;KB clusters --> (256&nbsp;MB for 64&nbsp;kBKB clusters<!-- and EBPB -->)
| FAT16: 2&nbsp;GB (4&nbsp;GB for 64&nbsp;kBKB clusters)
| FAT32: 2&nbsp;[[terabyte|TB]] (16&nbsp;TB for [[4Kn|4 KB sectors]])
}}
Line 170:
}}
| max_volume_size = {{ubli
| 16&nbsp;MB (with 4&nbsp;kBKB clusters)
| 32&nbsp;MB (with 8&nbsp;kBKB clusters)<!-- larger volumes should use logical sectored FAT partition IDs or FAT16 partition IDs -->
}}
| max_file_size = Limited by volume size
| file_size_granularity = 1&nbsp;byte
| max_files_no = 4,068 for 8&nbsp;kBKB clusters<!-- 2^12 - 12 (reserved clusters) - 16 (number of 8&nbsp;KB clusters for directory entries) -->
| max_filename_size = [[8.3 filename]] with [[OEM character set|OEM]] characters, <br />255 [[UCS-2]] characters<ref group="nb" name="NB_LFN_UNI"/> when using [[Long filename|LFN]]
| max_directory_depth = 32&nbsp;levels or 66&nbsp;characters (with [[Current Directory Structure|CDS]]), <br />60&nbsp;levels or more (without CDS)
Line 201:
| encryption = Per-volume only with [[DR-DOS]]
}}
Between April and August 1980, while borrowing the FAT concept for SCP's own 8086 operating system [[QDOS 0.10]],<ref name="Hunter_1983_Softalk" /> Tim Paterson extended the table elements to '''12 bits''',<ref name="Paterson_2007_Design-DOS" /> reduced the number of FATs to two, redefined the semantics of some of the reserved cluster values, and modified the disk layout, so that the root directory was now located between the FAT and the data area for his implementation of '''FAT12'''. Paterson also increased the nine-character (6.3) filename<ref name="Microsoft_1979_BASIC80-50" /><ref name="Microsoft_1979_BASIC80-51" /> length limit to eleven characters to support [[CP/M]]-style [[8.3 filename]]s and [[File Control Block]]s. The format used in Microsoft ''Standalone Disk BASIC's'' 8-bit file system precursor was not supported by QDOS. By August 1980, QDOS had been renamed [[86-DOS]].<ref name="BYTE_1980_86-DOS" /> Starting with [[86-DOS 0.42]], the size and layout of directory entries was changed from 16&nbsp;bytes to 32&nbsp;bytes<ref name="SCP_1981_86-DOS_1.0_Addendum" /> in order to add a file date stamp<ref name="SCP_1981_86-DOS_1.0_Addendum" /> and increase the theoretical file size limit beyond the previous limit of 16 &nbsp;MB.<ref name="SCP_1981_86-DOS_1.0_Addendum" />
[[86-DOS 1.00]] became available in early 1981. Later in 1981, 86-DOS evolved into Microsoft's [[MS-DOS]] and [[IBM]] [[PC DOS]].<ref name="Duncan_1988_MS-DOS_Encyclopedia" /><ref name="Paterson_2007_Design-DOS" /><ref name="Wallace_1992_Harddrive" />
The capability to read previously formatted volumes with 16-byte directory entries<ref name="SCP_1981_86-DOS_1.0_Addendum" /> was dropped with [[MS-DOS 1.20]].
 
FAT12 used 12-bit entries for the cluster addresses; some values were reserved to mark the end of a chain of clusters, to mark unusable areas of the disk, or for other purposes, so the maximum number of clusters was limited to 4078.<ref name="Norton2" /><ref name="Jenkinson_2000_Forensic" /> To conserve disk space, two 12-bit FAT entries used three consecutive 8-bit bytes on disk, requiring manipulation to unpack the 12-bit values. This was sufficient for the original floppy disk drives, and small hard disks up to 32 megabytes. The [[#FAT16B|FAT16B]] version available with DOS&nbsp;3.31 supported [[32-bit]] sector numbers, and so increased the volume size limit.
 
All the control structures fit inside the first track, to avoid head movement during read and write operations. Any bad sector in the control structures area would make the disk unusable. The DOS formatting tool rejected such disks completely. Bad sectors were allowed only in the file data area. Clusters containing bad sectors were marked unusable with the reserved value <code>0xFF7</code> in the FAT.
 
While 86-DOS supported three disk formats (250.25&nbsp;kBKB, 616&nbsp;kBKB and 1232&nbsp;kBKB, with [[FAT ID]]s <code>0xFF</code> and <code>0xFE</code>) on 8-inch (200&nbsp;mm) floppy drives, IBM [[PC&nbsp;DOS 1.0]], released with the original [[IBM Personal Computer]] in 1981, supported only an 8-sector floppy format with a formatted capacity of 160&nbsp;kBKB (FAT ID <code>0xFE</code>) for single-sided 5.25-inch floppy drives, and [[PC&nbsp;DOS 1.1]] added support for a [[double-sided disk|double-sided]] format with 320&nbsp;kBKB (FAT ID <code>0xFF</code>). [[PC DOS 2.0]] introduced support for 9-sector floppy formats with 180&nbsp;kBKB (FAT ID <code>0xFC</code>) and 360&nbsp;kBKB (FAT ID <code>0xFD</code>).
 
86-DOS&nbsp;1.00 and PC&nbsp;DOS 1.0 directory entries included only one date, the last modified date. PC&nbsp;DOS 1.1 added the last modified time. PC&nbsp;DOS 1.x [[file attribute]]s included a hidden bit and system bit, with the remaining six bits undefined. At this time, DOS did not support sub-directories, but typically there were only a few dozen files on a [[floppy disk|diskette]].
 
The [[PC XT]] was the first PC with an IBM-supplied hard drive, and PC&nbsp;DOS 2.0 supported that hard drive with FAT12 ([[FAT ID]] <code>0xF8</code>). The fixed assumption of 8&nbsp;sectors per clusters on hard disks practically limited the maximum partition size to 16&nbsp;MB for 512&nbsp;byte sectors and 4&nbsp;kBKB clusters.
 
The ''[[BIOS Parameter Block]]'' (''BPB'') was introduced with PC&nbsp;DOS&nbsp;2.0 as well, and this version also added read-only, [[archive bit|archive]], [[volume (computing)|volume label]], and [[Directory (file systems)|directory]] attribute bits for hierarchical sub-directories.<ref name="two" />
Line 236:
| max_file_size = 4,294,967,295 bytes (4&nbsp;GB − 1)<!-- Not "limited by volume size" if volumes larger than 4 GB are possible. -->
| file_size_granularity = 1&nbsp;byte
| max_files_no = 65,536 for 32&nbsp;kBKB clusters<!-- 2^16 − 12 (reserved clusters) − 64 (number of 32 KB clusters for directory entries) -->
| max_filename_size = [[8.3 filename]] with [[OEM character set|OEM]] characters, 255&nbsp;[[UCS-2]] characters<ref group="nb" name="NB_LFN_UNI"/> when using [[Long filename|LFN]]
| max_directory_depth = 32&nbsp;levels or 66&nbsp;characters (with [[Current Directory Structure|CDS]]), <br />60&nbsp;levels or more (without CDS)
Line 262:
| encryption = Per-volume only with [[DR-DOS]]
}}
In 1984, IBM released the [[PC AT]], which required PC&nbsp;DOS&nbsp;3.0 to access its 20&nbsp;MB hard disk.<ref name="IBM_1984_PCDOS30" /><ref name="IBM_1985_Reference" /> Microsoft introduced MS-DOS&nbsp;3.0 in parallel. Cluster addresses were increased to 16-bit, allowing for up to 65,526&nbsp;clusters per volume. However, the maximum possible number of sectors and the maximum [[Disk partitioning|partition]] size of 32&nbsp;MB did not change. Although cluster addresses were 16&nbsp;bits, this format was not what today is commonly understood as '''FAT16'''.
A [[partition type]] <code>[[Partition type#PID_04h|0x04]]</code> indicates this form of FAT16 with less than 65,536&nbsp;sectors (less than 32&nbsp;MB for sector size 512). The benefit of FAT16 was the use of smaller clusters, making disk usage more efficient, particularly for large numbers of files only a few hundred bytes in size.
 
Line 309:
| max_volume_size = {{ubli
| 2&nbsp;[[gigabyte|GB]] (with 32&nbsp;[[kilobyte|KB]] clusters)
| 4&nbsp;GB (with 64&nbsp;kBKB clusters) (NT&nbsp;4, PTS-DOS, EDR-DOS)
| 8&nbsp;GB (with 128&nbsp;kBKB clusters and <!-- 128 s/c -->1 or <!-- 64 s/c -->2&nbsp;kBKB sectors) (NT&nbsp;4 and EDR-DOS only)
| 8&nbsp;GB (with 128&nbsp;kBKB clusters and <!-- 256 s/c -->512 byte sectors) (EDR-DOS only)
| 16&nbsp;GB (with 256&nbsp;kBKB clusters and <!-- 128 s/c -->2 or <!-- 64 s/c -->4&nbsp;kBKB sectors) (NT&nbsp;4 only)
}}
| max_file_size = {{ubli
Line 320:
}}
| file_size_granularity = 1&nbsp;byte
| max_files_no = 65,460 for 32&nbsp;kBKB clusters<!-- 2^16 − 12 (reserved clusters) − 64 (number of 32 KB clusters for directory entries) -->
| max_filename_size = [[8.3 filename]] with [[OEM character set|OEM]] characters, <br />255 [[UCS-2]] characters<ref group="nb" name="NB_LFN_UNI"/> when using [[Long filename|LFN]]
| max_directory_depth = 32&nbsp;levels or 66&nbsp;characters (with [[Current Directory Structure|CDS]]), <br />60&nbsp;levels or more (without CDS)
Line 354:
If partitions to be used by pre-DOS&nbsp;3.31 issues of DOS need to be created by modern tools, the only criteria theoretically necessary to meet are a sector count of less than 65536, and the usage of the old partition ID (<code>[[Partition type#PID_04h|0x04]]</code>). In practice however, type <code>[[Partition type#PID_01h|0x01]]</code> and <code>[[Partition type#PID_04h|0x04]]</code> primary partitions should not be physically located outside the first 32&nbsp;MB of the disk, due to other restrictions in MS-DOS&nbsp;2.x, which could not cope with them otherwise.
 
In 1988, the FAT16B improvement became more generally available through [[DR&nbsp;DOS]]&nbsp;3.31, PC&nbsp;DOS&nbsp;4.0, [[OS/2]]&nbsp;1.1, and MS-DOS&nbsp;4.0. The limit on partition size was dictated by the 8-bit [[Signedness|signed]] count of sectors per cluster, which originally had a maximum power-of-two value of 64. With the standard hard disk sector size of 512&nbsp;bytes, this gives a maximum of 32&nbsp;kBKB cluster size, thereby fixing the "definitive" limit for the FAT16 partition size at 2&nbsp;GB for sector size 512. On [[magneto-optical]] media, which can have 1 or 2&nbsp;kBKB sectors instead of 0.5&nbsp;kBKB, this size limit is proportionally larger.
 
Much later, [[Windows&nbsp;NT]] increased the maximum cluster size to 64&nbsp;kBKB, by considering the sectors-per-cluster count as unsigned. However, the resulting format was not compatible with any other FAT implementation of the time, and it generated greater [[internal fragmentation]]. [[Windows 98]], SE and ME also supported reading and writing this variant, but its disk utilities did not work with it and some [[File control block|FCB]] services are not available for such volumes. This contributes to a confusing compatibility situation.
 
Prior to 1995, versions of DOS accessed the disk via [[Cylinder-head-sector|CHS]] addressing only. When [[Windows&nbsp;95]](MS-DOS 7.0) introduced [[Logical block addressing|LBA]] disk access, partitions could start being physically located outside the first c. 8&nbsp;GB<!-- exact value is somewhat smaller --> of this disk and thereby out of the reach of the traditional CHS addressing scheme. Partitions partially or fully located beyond the CHS barrier therefore had to be hidden from non-LBA-enabled operating systems by using the new partition type <code>[[Partition type#PID_0Eh|0x0E]]</code> in the partition table instead. FAT16 partitions using this partition type are also named '''FAT16X'''.<ref name="Microsoft_2004_KB120138" /> The only difference, compared to previous FAT16 partitions, is the fact that some CHS-related geometry entries in the BPB record, namely the number of sectors per track and the number of heads, may contain no or misleading values and should not be used.
Line 380:
| min_volume_size = {{ubli
| 32&nbsp;[[megabyte|MB]] – 4.5&nbsp;[[kilobyte|KB]] (with 65525 clusters and 512 byte sectors)
| 256&nbsp;MB – 36&nbsp;kBKB (with 65525 clusters and 4&nbsp;[[kilobyte|KB]] sectors)
}}
| max_volume_size = {{ubli
| 2&nbsp;[[terabyte|TB]] (with 512&nbsp;byte sectors)
| 8&nbsp;TB (with 2&nbsp;kBKB sectors and 32&nbsp;kBKB clusters)
| 16&nbsp;TB (with 4&nbsp;kBKB sectors and 64&nbsp;kBKB clusters)
}}
| max_file_size = {{ubli
Line 392:
| 274,877,906,943 bytes (256&nbsp;GiB − 1 byte)<!-- 2^38 - 1 --> (only with FAT32+<ref name="DRDOS_FAT+_R2" />)
}}
| max_files_no = 268,173,300 for 32&nbsp;kBKB clusters<!-- 2^28 − 12 (reserved clusters) − 262144 (number of 32&nbsp;KB clusters for directory entries) -->
| max_filename_size = [[8.3 filename]] with [[OEM character set|OEM]] characters, <br />255 [[UCS-2]] characters<ref group="nb" name="NB_LFN_UNI"/> when using [[Long filename|LFN]]
| max_directory_depth = 32&nbsp;levels or 66&nbsp;characters (with [[Current Directory Structure|CDS]]), <br />60&nbsp;levels or more (without CDS)
Line 417:
}}
 
In order to overcome the volume size limit of FAT16, while at the same time allowing DOS [[Real mode|real-mode]] code to handle the format, Microsoft designed a new version of the file system, '''FAT32''', which supported an increased number of possible clusters, but could reuse most of the existing code, so that the [[conventional memory]] footprint was increased by less than 5&nbsp;kBKB under DOS.<ref name="Microsoft_1998_CC768180" /> Cluster values are represented by [[32-bit]] numbers, of which 28 bits are used to hold the cluster number.
 
==== Maximal sizes ====
Line 505:
While resembling the same basic design ideas as [[#FAT16|FAT16]] and [[#FAT32|FAT32]], the '''FATX16''' and '''FATX32''' on-disk structures are simplified, but fundamentally incompatible with normal FAT16 and FAT32 file systems, making it impossible for normal FAT file system drivers to mount such volumes.
 
The non-bootable [[superblock (file systems)|superblock]] sector is 4&nbsp;kBKB in size and holds an 18&nbsp;byte large BPB-like structure completely different from normal [[FAT BPB|BPB]]s. Clusters are typically 16&nbsp;kBKB in size and there is only one copy of the FAT on the Xbox. Directory entries are 64&nbsp;bytes in size instead of the normal [[FAT directory entry|32&nbsp;bytes]]. Files can have filenames up to 42 characters long using the [[OEM character set]]<!-- not Unicode --> and be up to 4&nbsp;GB minus 1&nbsp;byte in size. The on-disk timestamps hold creation, modification and access dates and times but differ from FAT: in FAT, the [[Epoch (computing)|epoch]] is [[Epoch of 1980-01-01|1980]]; in FATX, the epoch is [[Epoch of 2000-01-01|2000]]. On the [[Xbox 360]], the epoch is 1980.<ref name="Xbox360_FATX" />
 
=== exFAT ===