File Allocation Table
Encyclopedia
FAT
Developer
Software developer
A software developer is a person concerned with facets of the software development process. Their work includes researching, designing, developing, and testing software. A software developer may take part in design, computer programming, or software project management...

Microsoft
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...

Full Name File Allocation Table
FAT12
(12‑bit version)
FAT16/FAT16B (16‑bit versions) FAT32 (32‑bit version with 28 bits used)
Introduced August 1980 (QDOS) August 1984 (DOS 3.0 with FAT16), November 1987 (Compaq
Compaq
Compaq Computer Corporation is a personal computer company founded in 1982. Once the largest supplier of personal computing systems in the world, Compaq existed as an independent corporation until 2002, when it was acquired for US$25 billion by Hewlett-Packard....

 DOS 3.31 with FAT16B)
August 1996 (Windows 95
Windows 95
Windows 95 is a consumer-oriented graphical user interface-based operating system. It was released on August 24, 1995 by Microsoft, and was a significant progression from the company's previous Windows products...

 OSR2)
MBR
Master boot record
A master boot record is a type of boot sector popularized by the IBM Personal Computer. It consists of a sequence of 512 bytes located at the first sector of a data storage device such as a hard disk...

 Partition type
Partition type
This is not an exhaustive list, notably ambiguous or obscure partition types are not covered....

0x01 0x04, 0x06, 0x0E 0x0B, 0x0C
GPT
GUID Partition Table
In computer hardware, GUID Partition Table is a standard for the layout of the partition table on a physical hard disk. Although it forms a part of the Extensible Firmware Interface standard , it is also used on some BIOS systems because of the limitations of MBR partition tables, which restrict...

 Partition type
Basic data partition
Basic Data Partition
In Microsoft operating systems, when using basic disk partitioned with GUID Partition Table layout, a basic data partition is any partition identified with Globally Unique Identifier of EBD0A0A2-B9E5-4433-87C0-68B6B72699C7....


EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
Structures
Directory contents Table
File allocation Linked list
Linked list
In computer science, a linked list is a data structure consisting of a group of nodes which together represent a sequence. Under the simplest form, each node is composed of a datum and a reference to the next node in the sequence; more complex variants add additional links...

Bad blocks Cluster tagging
Limits
Max file size 4 GB minus 1 byte
Max number
of cluster
Cluster (file system)
In computer file systems, a cluster or allocation unit is the unit of disk space allocation for files and directories. To reduce the overhead of managing on-disk data structures, the filesystem does not allocate individual disk sectors, but contiguous groups of sectors, called clusters.On a disk...

s
4,084 (212‑12) 65,524 (216‑12) 268,435,444 (228‑12)
Max cluster number 4,085 65,525 268,435,445
Max filename size 8.3 filename, or 255 UTF-16 characters when using LFN
Long filename
Long filenames , are Microsoft's way of implementing filenames longer than the 8.3 filename, or short-filename, naming scheme used in Microsoft DOS in their modern FAT and NTFS filesystems. Because these filenames can be longer than an 8.3 filename, they can be more descriptive...

Max volume size 32 MB
Megabyte
The megabyte is a multiple of the unit byte for digital information storage or transmission with two different values depending on context: bytes generally for computer memory; and one million bytes generally for computer storage. The IEEE Standards Board has decided that "Mega will mean 1 000...

 

with clusters

with sectors
Features
Dates recorded Creation, modified, access (accuracy to day only)
(Creation time and access date are only available when ACCDATE support is enabled)
Date range January 1, 1980 - December 31, 2107
Date resolution 2 s
Second
The second is a unit of measurement of time, and is the International System of Units base unit of time. It may be measured using a clock....

Forks
Fork (filesystem)
In a computer file system, a fork is byte stream associated with a file system object. Every non-empty file must have at least one fork, and depending on the file system, a file may have one or more other associated forks, which in turn may contain primary data integral to the file, or just metadata...

Not natively
Attributes Read-only, hidden, system, volume label, subdirectory, archive
Archive bit
The archive bit is a file attribute used by Microsoft operating systems and by OS/2. Typically it's state indicates whether or not the file has been backed up....

, (NetWare only) executable
Permissions
File system permissions
Most current file systems have methods of administering permissions or access rights to specific users and groups of users. These systems control the ability of the users to view or make changes to the contents of the filesystem....

Global/directory/file-based only with DR-DOS
DR-DOS
DR-DOS is an MS-DOS-compatible operating system for IBM PC-compatible personal computers, originally developed by Gary Kildall's Digital Research and derived from Concurrent PC DOS 6.0, which was an advanced successor of CP/M-86...

 and Multiuser DOS
Multiuser DOS
Multiuser DOS is a soft real-time multi-user multi-tasking operating system for IBM PC-compatible microcomputers.An evolution of the older Concurrent CP/M-86 and Concurrent DOS operating systems, it was originally developed by Digital Research and later further developed by Novell...

, world/group/owner file permissions only with multiuser security
No
Transparent compression Per-volume, Stacker
Stac Electronics
Stac Electronics, originally incorporated as State of the Art Consulting and later shortened to Stac, Inc, was a technology company founded in 1983...

, DoubleSpace
DoubleSpace
DriveSpace is a disk compression utility supplied with MS-DOS starting from version 6.0. The purpose of DriveSpace is to increase the amount of data the user could store on disks, by transparently compressing and decompressing data on-the-fly. It is primarily intended for use with hard drives, but...

, DriveSpace 
No
Transparent encryption Per-volume only with DR-DOS
DR-DOS
DR-DOS is an MS-DOS-compatible operating system for IBM PC-compatible personal computers, originally developed by Gary Kildall's Digital Research and derived from Concurrent PC DOS 6.0, which was an advanced successor of CP/M-86...

 
No

File Allocation Table (FAT) is a computer file system
File system
A file system is a means to organize data expected to be retained after a program terminates by providing procedures to store, retrieve and update data, as well as manage the available space on the device which contain it. A file system organizes data in an efficient manner and is tuned to the...

 architecture now widely used on many computer systems and most memory cards, such as those used with digital cameras. FAT file systems are commonly found on floppy disk
Floppy disk
A floppy disk is a disk storage medium composed of a disk of thin and flexible magnetic storage medium, sealed in a rectangular plastic carrier lined with fabric that removes dust particles...

s, flash memory
Flash memory
Flash memory is a non-volatile computer storage chip that can be electrically erased and reprogrammed. It was developed from EEPROM and must be erased in fairly large blocks before these can be rewritten with new data...

 cards, digital camera
Digital camera
A digital camera is a camera that takes video or still photographs, or both, digitally by recording images via an electronic image sensor. It is the main device used in the field of digital photography...

s, and many other portable devices because of their relative simplicity. FAT was also commonly used on hard disks throughout the DOS
DOS
DOS, short for "Disk Operating System", is an acronym for several closely related operating systems that dominated the IBM PC compatible market between 1981 and 1995, or until about 2000 if one includes the partially DOS-based Microsoft Windows versions 95, 98, and Millennium Edition.Related...

 and Windows 9x
Windows 9x
Windows 9x is a generic term referring to a series of Microsoft Windows computer operating systems produced since 1995, which were based on the original and later modified Windows 95 kernel...

 eras, but its use on hard drives has declined since the introduction of Windows XP
Windows XP
Windows XP is an operating system produced by Microsoft for use on personal computers, including home and business desktops, laptops and media centers. First released to computer manufacturers on August 24, 2001, it is the second most popular version of Windows, based on installed user base...

, which primarily uses the newer NTFS
NTFS
NTFS is the standard file system of Windows NT, including its later versions Windows 2000, Windows XP, Windows Server 2003, Windows Server 2008, Windows Vista, and Windows 7....

.

The name originates from the usage of a table which centralizes the information about which areas belong to files, are free or possibly unusable, and where each file is stored on the disk. To limit the size of the table, disk space is allocated to files in contiguous groups of hardware sectors
Disk sector
In computer disk storage, a sector is a subdivision of a track on a magnetic disk or optical disc. Each sector stores a fixed amount of user data. Traditional formatting of these storage media provides space for 512 bytes or 2048 bytes of user-accessible data per sector...

 called cluster
Cluster (file system)
In computer file systems, a cluster or allocation unit is the unit of disk space allocation for files and directories. To reduce the overhead of managing on-disk data structures, the filesystem does not allocate individual disk sectors, but contiguous groups of sectors, called clusters.On a disk...

s
. As disk drives have evolved, the maximum number of clusters has dramatically increased, and so the number of bits used to identify each cluster has grown. The successive major versions of the FAT format are named after the number of table element bits: 12 (FAT12), 16 (FAT16), and 32 (FAT32). Each is still in use. The FAT standard has also been expanded in other ways while generally preserving backward compatibility with existing software.

For floppy disks, the FAT has been standardized as ECMA
Ecma International
Ecma International is an international, private non-profit standards organization for information and communication systems. It acquired its name in 1994, when the European Computer Manufacturers Association changed its name to reflect the organization's global reach and activities...

-107 and ISO
International Organization for Standardization
The International Organization for Standardization , widely known as ISO, is an international standard-setting body composed of representatives from various national standards organizations. Founded on February 23, 1947, the organization promulgates worldwide proprietary, industrial and commercial...

/IEC
International Electrotechnical Commission
The International Electrotechnical Commission is a non-profit, non-governmental international standards organization that prepares and publishes International Standards for all electrical, electronic and related technologies – collectively known as "electrotechnology"...

 9293. These standards cover FAT12 and FAT16 with only short 8.3 filename support; long filename
Long filename
Long filenames , are Microsoft's way of implementing filenames longer than the 8.3 filename, or short-filename, naming scheme used in Microsoft DOS in their modern FAT and NTFS filesystems. Because these filenames can be longer than an 8.3 filename, they can be more descriptive...

s with FAT are partially patent
Patent
A patent is a form of intellectual property. It consists of a set of exclusive rights granted by a sovereign state to an inventor or their assignee for a limited period of time in exchange for the public disclosure of an invention....

ed.

The FAT file system is technically simple and supported by virtually all existing operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

s for personal computer
Personal computer
A personal computer is any general-purpose computer whose size, capabilities, and original sales price make it useful for individuals, and which is intended to be operated directly by an end-user with no intervening computer operator...

s. This makes it a useful format for solid-state
Solid-state drive
A solid-state drive , sometimes called a solid-state disk or electronic disk, is a data storage device that uses solid-state memory to store persistent data with the intention of providing access in the same manner of a traditional block i/o hard disk drive...

 memory card
Memory card
A memory card or flash card is an electronic flash memory data storage device used for storing digital information. They are commonly used in many electronic devices, including digital cameras, mobile phones, laptop computers, MP3 players, and video game consoles...

s and a convenient way to share data between operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

s.

History

Designed and coded by Marc McDonald
Marc McDonald
Marc B. McDonald is an American who was Microsoft's first salaried employee . He is credited with designing the FAT File System for Standalone Basic which was the file system for the MS-DOS operating system and Microsoft Windows...

, Microsoft Stand-alone Disk BASIC
Microsoft BASIC
Microsoft BASIC was the foundation product of the Microsoft company. It first appeared in 1975 as Altair BASIC, which was the first BASIC, and the first high level programming language available for the MITS Altair 8800 hobbyist microcomputer....

 introduced the FAT in 1977 with 8-bit table elements, produced for NCR
NCR Corporation
NCR Corporation is an American technology company specializing in kiosk products for the retail, financial, travel, healthcare, food service, entertainment, gaming and public sector industries. Its main products are self-service kiosks, point-of-sale terminals, automated teller machines, check...

's 8-bit 8080
Intel 8080
The Intel 8080 was the second 8-bit microprocessor designed and manufactured by Intel and was released in April 1974. It was an extended and enhanced variant of the earlier 8008 design, although without binary compatibility...

 file system. The FAT, born during one of a series of discussions between McDonald and Bill Gates
Bill Gates
William Henry "Bill" Gates III is an American business magnate, investor, philanthropist, and author. Gates is the former CEO and current chairman of Microsoft, the software company he founded with Paul Allen...

, was later used in a stand-alone BASIC for the 8086
Intel 8086
The 8086 is a 16-bit microprocessor chip designed by Intel between early 1976 and mid-1978, when it was released. The 8086 gave rise to the x86 architecture of Intel's future processors...

 chip and eventually through the M-DOS
M-DOS
M-DOS or MIDAS refers to an operating system that was designed by Marc McDonald of Microsoft in 1979...

 operating system, became the basis for the file-handling routines in MS-DOS
MS-DOS
MS-DOS is an operating system for x86-based personal computers. It was the most commonly used member of the DOS family of operating systems, and was the main operating system for IBM PC compatible personal computers during the 1980s to the mid 1990s, until it was gradually superseded by operating...

. In 1980, Tim Paterson
Tim Paterson
Tim Paterson is an American computer programmer, best known as the original author of MS-DOS, the most widely used personal computer operating system in the 1980s....

 extended the table elements to 12 bits in 86-DOS, which supported 8-inch floppy drives.

IBM
IBM
International Business Machines Corporation or IBM is an American multinational technology and consulting corporation headquartered in Armonk, New York, United States. IBM manufactures and sells computer hardware and software, and it offers infrastructure, hosting and consulting services in areas...

 PC-DOS 1.0, released with the original IBM Personal Computer in 1981, supported single-sided 5.25-inch floppy drives, and PC-DOS 1.1 added double-sided
Double-sided disk
In computer science, a double-sided disk is a disk of which both sides are used to store data.Early floppy disks only used one surface for recording. The term "single sided disk" was not common until the introduction of double-sided disks, which offered double the capacity in the same physical size...

 support. Neither of these versions had a BIOS parameter block
BIOS parameter block
In computing, the BIOS parameter block, often shortened to BPB, is a data structure in the Volume Boot Record describing the physical layout of a data storage volume. On partitioned devices, such as hard disks, the BPB describes the volume partition, whereas, on unpartitioned devices, such as...

. The BPB was introduced in PC-DOS 2.0. PC-DOS 1.0 directory entries included only one date, the last modified date. PC-DOS 1.1 added the last modified time. PC-DOS 1.x file attribute
File attribute
A file attribute is metadata that describes or is associated with a computer file. For example, an operating system often keeps track of the date a file was created and last modified, as well as the file's size and extension . File permissions are also kept track of...

s included a hidden bit and system bit, with the remaining six bits undefined. PC-DOS 2.0 added read-only, volume label
Volume (computing)
In the context of computer operating systems, volume is the term used to describe a single accessible storage area with a single file system, typically resident on a single partition of a hard disk. Similarly, it refers to the logical interface used by an operating system to access data stored on...

, subdirectory and archive
Archive bit
The archive bit is a file attribute used by Microsoft operating systems and by OS/2. Typically it's state indicates whether or not the file has been backed up....

 attribute bits.

Both editions of ECMA 107 specify a Max Cluster Number MAX determined by the formula MAX=1+trunc((TS-SSA)/SC), and reserve cluster numbers MAX+1 up to 4086 (hex. FF6, FAT12) and later 65526 (hex. FFF6, FAT16) for future standardization.

Microsoft's EFI FAT32 specification states that any FAT file system with less than 4085 clusters is FAT12, else any FAT file system with less than 65525 clusters is FAT16, and otherwise it is FAT32. The entries for cluster numbers 0 and 1 at the begin of the FAT contain the media descriptor and end at a byte boundary even for FAT12, e.g., hex. F9FFFF for media descriptor hex. F9. The first data cluster is 2, and consequently the last cluster MAX gets number MAX+1. This results in data cluster numbers 2…4085 (hex. FF5) for FAT12, 2…65525 (hex. FFF5) for FAT16, and 2…268435445 (hex. 0FFF FFF5) for FAT32.

The only available values reserved for future standardization are therefore hex. FF6 (FAT12) and hex. FFF6 (FAT16). As noted below "less than 4085" is also used for Linux implemementations, or as Microsoft
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...

's FAT specification puts it:
when it says <, it does not mean <=. Note also that the numbers are correct. The first number for FAT12 is 4085; the second number for FAT16 is 65525. These numbers and the ‘<’ signs are not wrong.

FAT12

The initial version of FAT designed for 16-bit microprocessor
Microprocessor
A microprocessor incorporates the functions of a computer's central processing unit on a single integrated circuit, or at most a few integrated circuits. It is a multipurpose, programmable device that accepts digital data as input, processes it according to instructions stored in its memory, and...

s is now referred to as FAT12. Designed as a file system for floppy disks, it limited cluster addresses to 12-bit values, which not only limited the cluster count to 4084,
but made FAT manipulation tricky with the PC's 8-bit and 16-bit registers. (The literature also mentions a limit 4078.) The disk's size is stored as a 16-bit count of sectors
Cylinder-head-sector
Cylinder-head-sector, also known as CHS, was an early method for giving addresses to each physical block of data on a hard disk drive. In the case of floppy drives, for which the same exact diskette medium can be truly low-level formatted to different capacities, this is still true.Though CHS...

, which limited the size to 32 MB. FAT12 was used by several manufacturers with different physical formats, but a typical floppy disk at the time was 5.25-inch, single-sided, , with per track, resulting in a capacity of 160 KB for both the system areas and files. The FAT12 limitations exceeded this capacity by a factor of ten or more.

By convention, all the control structures were organized to fit inside the first track, thus avoiding head movement during read and write operations, although this varied depending on the manufacturer and physical format of the disk. At the time FAT12 was introduced, DOS did not support hierarchical directories, and the maximum number of files was typically limited to a few dozen. Hierarchical directories were introduced in MS-DOS

A limitation which was not addressed until much later was that any bad sector in the control structures area, , could prevent the disk from being usable. The DOS formatting tool rejected such disks completely. Bad sectors were allowed only in the file area, where they made the entire containing cluster unusable as well. FAT12 remains in use on all common floppy disks, including 1.44 MB disks.

Initial FAT16

In 1984, IBM released the PC AT, which featured a 20 MB hard disk. Microsoft introduced MS-DOS 3.0 in parallel. (The earlier PC XT was the first PC with a hard drive from IBM, and MS-DOS 2.0 supported that hard drive with FAT12.) Cluster addresses were increased to 16-bit, allowing for up to 65,524 clusters per volume, and consequently much greater file system sizes, at least in theory. However, the maximum possible number of sectors and the maximum (partition
Disk partitioning
Disk partitioning is the act of dividing a hard disk drive into multiple logical storage units referred to as partitions, to treat one physical disk drive as if it were multiple disks. Partitions are also termed "slices" for operating systems based on BSD, Solaris or GNU Hurd...

, rather than disk) size of 32 MB did not change. Therefore, although technically already "FAT16", this format was not what today is commonly understood as FAT16. With the initial implementation of FAT16 not actually providing for larger partition sizes than FAT12, the early benefit of FAT16 was to enable the use of smaller clusters, making disk usage more efficient, particularly for files several hundred bytes in size, which were far more common at the time. MS-DOS 2.x hard disks larger than 15 MB are incompatible with later versions of MS-DOS.

A 20 MB hard disk formatted under MS-DOS 3.0 was not accessible by the older MS-DOS 2.0 because MS-DOS 2.0 did not support version 3.0's FAT-16. MS-DOS 3.0 could still access MS-DOS 2.0 style partitions under 15 MB. MS-DOS 3.0 also introduced support for high-density 1.2 MB 5.25" diskettes, which notably had 15 sectors per track, hence more space for the FATs.

Partitioning and logical drives

Apart from improving the structure of the FAT file system itself, a parallel development allowing an increase in the maximum possible FAT size was the introduction of multiple FAT partitions on a hard disk. To allow the use of more FAT partitions in a compatible way, a new partition type was introduced (in MS-DOS 3.2, January 1986), the extended partition, which is a container for an additional partition called logical drive and optionally another extended partition containing the next logical drive, and so on. The MBR
Master boot record
A master boot record is a type of boot sector popularized by the IBM Personal Computer. It consists of a sequence of 512 bytes located at the first sector of a data storage device such as a hard disk...

 of a hard disk can either define up to four primary partitions, or an extended partition in addition to up to three primary partitions.

Final FAT16

Finally in November 1987, Compaq
Compaq
Compaq Computer Corporation is a personal computer company founded in 1982. Once the largest supplier of personal computing systems in the world, Compaq existed as an independent corporation until 2002, when it was acquired for US$25 billion by Hewlett-Packard....

 DOS 3.31 (an OEM version of MS-DOS 3.3 released by Compaq with their machines) introduced what today is simply known as the FAT16 format, with the expansion of the 16-bit disk sector count to 32 bits. The result was initially called the DOS 3.31 Large File System. Although the on-disk changes were minor, the entire DOS disk driver had to be converted to use 32-bit sector numbers, a task complicated by the fact that it was written in 16-bit assembly language
X86 assembly language
x86 assembly language is a family of backward-compatible assembly languages, which provide some level of compatibility all the way back to the Intel 8008. x86 assembly languages are used to produce object code for the x86 class of processors, which includes Intel's Core series and AMD's Phenom and...

. FAT16 partition type
Partition type
This is not an exhaustive list, notably ambiguous or obscure partition types are not covered....

 hex. 04 indicates less than 65536 sectors (less than 32 MB for sector size 512), type 06 indicates 65536 or more sectors, and hex. 0E indicates LBA
Logical block addressing
Logical block addressing is a common scheme used for specifying the location of blocks of data stored on computer storage devices, generally secondary storage systems such as hard disks....

 instead of CHS
Cylinder-head-sector
Cylinder-head-sector, also known as CHS, was an early method for giving addresses to each physical block of data on a hard disk drive. In the case of floppy drives, for which the same exact diskette medium can be truly low-level formatted to different capacities, this is still true.Though CHS...

 addressing. Microsoft
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...

's dskprobe tool refers to type 06 as BigFAT, whereas some older versions of FDISK described it as BIGDOS. It is also known as FAT16B.

In 1988 this improvement became more generally available through DR DOS 3.31, MS-DOS 4.0 and OS/2
OS/2
OS/2 is a computer operating system, initially created by Microsoft and IBM, then later developed by IBM exclusively. The name stands for "Operating System/2," because it was introduced as part of the same generation change release as IBM's "Personal System/2 " line of second-generation personal...

 1.1. The limit on partition size was dictated by the 8-bit signed
Signedness
In computing, signedness is a property of data types representing numbers in computer programs. A numeric variable is signed if it can represent both positive and negative numbers, and unsigned if it can only represent non-negative numbers .As signed numbers can represent negative numbers, they...

 count of sectors per cluster, which had a maximum power-of-two value of 64. With the standard hard disk sector size of 512 bytes, this gives a maximum of clusters, thereby fixing the "definitive" limit for the FAT16 partition size at 2 GB for sector size 512. On magneto-optical media, which can have 1 or sectors instead of , this size limit is proportionally larger.

Much later, Windows NT
Windows NT
Windows NT is a family of operating systems produced by Microsoft, the first version of which was released in July 1993. It was a powerful high-level-language-based, processor-independent, multiprocessing, multiuser operating system with features comparable to Unix. It was intended to complement...

 increased the maximum cluster size to 64 KB 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
Windows 98
Windows 98 is a graphical operating system by Microsoft. It is the second major release in the Windows 9x line of operating systems. It was released to manufacturing on 15 May 1998 and to retail on 25 June 1998. Windows 98 is the successor to Windows 95. Like its predecessor, it is a hybrid...

  also supported reading and writing this variant, but its disk utilities did not work with it. This contributes to a confusing compatibility situation.

The number of root directory entries available for FAT12 and FAT16 is determined when the volume is formatted, and is stored in a 16-bit field. For a given number RDE and sector size SS the number RDS of root directory sectors is RDS=ceil((RDE×32)/SS), and RDE is normally chosen to fill these sectors, i.e., RDE*32=RDS*SS. FAT12 and FAT16 media typically use 512 root directory entries on non-floppy media. Some third-party tools like mkdosfs
Mkdosfs
mkdosfs is one of the applications that are included in the dosfstools package, and it is used to create a DOS file system under Linux on a data storage device .- Usage : mkdosfs [options] device...

 allow the user to set this parameter.

Long file names

One of the user experience
User experience
User experience is the way a person feels about using a product, system or service. User experience highlights the experiential, affective, meaningful and valuable aspects of human-computer interaction and product ownership, but it also includes a person’s perceptions of the practical aspects such...

 goals for the designers of Windows 95
Windows 95
Windows 95 is a consumer-oriented graphical user interface-based operating system. It was released on August 24, 1995 by Microsoft, and was a significant progression from the company's previous Windows products...

 was the ability to use long filename
Long filename
Long filenames , are Microsoft's way of implementing filenames longer than the 8.3 filename, or short-filename, naming scheme used in Microsoft DOS in their modern FAT and NTFS filesystems. Because these filenames can be longer than an 8.3 filename, they can be more descriptive...

s (LFNs—up to 255 UTF-16 code point
Code point
In character encoding terminology, a code point or code position is any of the numerical values that make up the code space . For example, ASCII comprises 128 code points in the range 0hex to 7Fhex, Extended ASCII comprises 256 code points in the range 0hex to FFhex, and Unicode comprises 1,114,112...

s long), in addition to classic 8.3 filenames. LFNs were implemented using a workaround
Workaround
A workaround is a bypass of a recognized problem in a system. A workaround is typically a temporary fix that implies that a genuine solution to the problem is needed...

 in the way directory entries are laid out (see below).

The version of the file system with this extension is usually known as VFAT after the Windows 95 virtual device driver
VxD
VxD is the device driver model used in Microsoft Windows/386, the 386 enhanced mode of Windows 3.x, Windows 9x, and to some extend also by the Novell DOS 7, OpenDOS 7.01, and DR-DOS 7.02 multitasker...

, also known as "Virtual FAT" in Microsoft's documentation. The VFAT driver appeared before Windows 95, in Windows for Workgroups 3.11, but was only used for implementing 32-bit file access
32-bit File Access
32-bit file access refers to the higher performance, protected mode disk caching method introduced in Windows for Workgroups 3.11, which replaced SmartDrive . It bypassed MS-DOS and directly accessed the disk, either via the BIOS or 32-bit disk access...

 and did not support long file names.

In Windows NT, support for long filenames on FAT started from version 3.5
Windows NT 3.5
Windows NT 3.5 is the second release of the Microsoft Windows NT operating system. It was released on 21 September 1994.One of the primary goals during Windows NT 3.5's development was to increase the speed of the operating system; as a result, the project was given the codename "Daytona" in...

. OS/2
OS/2
OS/2 is a computer operating system, initially created by Microsoft and IBM, then later developed by IBM exclusively. The name stands for "Operating System/2," because it was introduced as part of the same generation change release as IBM's "Personal System/2 " line of second-generation personal...

 added long filename support to FAT using extended attributes (EA) before the introduction of VFAT; thus, VFAT long filenames are invisible to OS/2, and EA long filenames are invisible to Windows.

FAT32

In order to overcome the size limit of FAT16, while at the same time allowing DOS (disk operating system) real mode
Real mode
Real mode, also called real address mode, is an operating mode of 80286 and later x86-compatible CPUs. Real mode is characterized by a 20 bit segmented memory address space and unlimited direct software access to all memory, I/O addresses and peripheral hardware...

 code to handle the format, and without reducing available conventional memory
Conventional memory
In DOS memory management, conventional memory, also called base memory, is the first 640 kilobytes of the memory on IBM PC or compatible systems. It is the read-write memory usable by the operating system and application programs...

 unnecessarily, Microsoft expanded the cluster size yet again, calling the new revision FAT32. Cluster values are represented by 32-bit numbers, of which 28 bits are used to hold the cluster number. The boot sector uses a 32-bit field for the sector count, limiting the FAT32 volume size to 2 TB for sector size 512 and 16 TB for sector size 4096; compare the size limits given below.

FAT32 was introduced with Windows 95 OSR2, although reformatting was needed to use it, and DriveSpace 3 (the version that came with Windows 95 OSR2 and Windows 98) never supported it. Windows 98 introduced a utility to convert existing hard disks from FAT16 to FAT32 without loss of data. In the NT line, native support for FAT32 arrived in Windows 2000
Windows 2000
Windows 2000 is a line of operating systems produced by Microsoft for use on personal computers, business desktops, laptops, and servers. Windows 2000 was released to manufacturing on 15 December 1999 and launched to retail on 17 February 2000. It is the successor to Windows NT 4.0, and is the...

. A free FAT32 driver for Windows NT 4.0
Windows NT 4.0
Windows NT 4.0 is a preemptive, graphical and business-oriented operating system designed to work with either uniprocessor or symmetric multi-processor computers. It was the next release of Microsoft's Windows NT line of operating systems and was released to manufacturing on 31 July 1996...

 was available from Winternals, a company later acquired by Microsoft. Since the acquisition the driver is no longer officially available.

The maximum possible size for a file on a FAT32 volume is 4 GB minus or (232−1) bytes. This limit is a consequence of the file length entry in the directory table and would also affect huge FAT16 partitions with a sufficient sector size. Video applications, large databases, and some other software easily exceed this limit. Larger files require another filesystem.

Fragmentation

The FAT file system does not contain mechanisms which prevent newly written files from becoming scattered across the partition. Other file systems, e.g., HPFS
HPFS
HPFS or High Performance File System is a file system created specifically for the OS/2 operating system to improve upon the limitations of the FAT file system...

, use free space bitmap
Free space bitmap
Free space bitmaps are one method used to track allocated sectors by some file systems. While the most simplistic design is highly inefficient, advanced or hybrid implementations of free space bitmaps are used by some modern file systems.-Example:...

s that indicate used and available clusters, which could then be quickly looked up in order to find free contiguous areas. Another solution is the linkage of all free clusters into one or more lists (as is done in Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 file systems). Instead, the FAT has to be scanned as an array to find free clusters, which can lead to performance penalties with large disks.

In fact, computing free disk space on FAT is one of the most resource intensive operations, as it requires reading the entire FAT linearly. A possible justification suggested by Microsoft's Raymond Chen for limiting the maximum size of FAT32 partitions created on Windows was the time required to perform a "DIR" operation, which always displays the free disk space as the last line. Displaying this line took longer and longer as the number of clusters increased.

Some of the perceived problems with fragmentation
Fragmentation (computer)
In computer storage, fragmentation is a phenomenon in which storage space is used inefficiently, reducing storage capacity and in most cases reducing the performance. The term is also used to denote the wasted space itself....

 of FAT file systems result from limitations of the device driver
Device driver
In computing, a device driver or software driver is a computer program allowing higher-level computer programs to interact with a hardware device....

s.

The single-tasking DOS and the traditionally single-tasking PC hard disk architecture (only 1 outstanding input/output request at a time
Native Command Queuing
Native Command Queuing is a technology designed to increase performance of SATA hard disks under certain conditions by allowing the individual hard disk to internally optimize the order in which received read and write commands are executed...

, no DMA transfers
Programmed input/output
Programmed input/output is a method of transferring data between the CPU and a peripheral such as a network adapter or an ATA storage device....

) did not contain mechanisms which could alleviate fragmentation by asynchronously prefetching next data while the application was processing the previous chunks.

Similarly, write-behind caching was often not enabled by default with Microsoft software (if present) given the problem of data loss in case of a crash, made easier by the lack of hardware protection between applications and the system.

Modern operating systems have introduced these optimizations to FAT partitions, but optimizations can still produce unwanted artifacts in case of a system crash. A Windows NT system will allocate space to files on FAT in advance, selecting large contiguous areas, but in case of a crash, files which were being appended will appear larger than they were ever written into, with dozens of random kilobytes at the end.

With the large cluster sizes, 4 or 8K, forced by larger FAT32 partitions, the external fragmentation becomes somewhat less significant, and internal fragmentation, i.e. disk space waste (since files are rarely exact multiples of cluster size), starts to be a problem as well, especially when there are a great many small files.

Third-party support

Due to the widespread use of FAT formatted media since its introduction many operating systems have provided support for FAT and subsequently VFAT and FAT32 through official or third-party file system handlers. For example, Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

, FreeBSD
FreeBSD
FreeBSD is a free Unix-like operating system descended from AT&T UNIX via BSD UNIX. Although for legal reasons FreeBSD cannot be called “UNIX”, as the direct descendant of BSD UNIX , FreeBSD’s internals and system APIs are UNIX-compliant...

, BeOS
BeOS
BeOS is an operating system for personal computers which began development by Be Inc. in 1991. It was first written to run on BeBox hardware. BeOS was optimized for digital media work and was written to take advantage of modern hardware facilities such as symmetric multiprocessing by utilizing...

 and JNode
JNode
JNode is a free software project to create a Java platform operating system. The project has taken the unique direction of creating all the software in Java itself, with the exception of some assembly language to boot and load the system...

 provide inbuilt support for FAT. Early Linux distributions also supported a format known as UMSDOS
UMSDOS
Linux has several filesystem drivers for the File Allocation Table filesystem format. These are commonly known by the names used in the mount command to invoke particular drivers in the kernel: msdos, vfat, and umsdos....

, a FAT variant with Unix file attributes (such as long file name and access permissions) stored in a separate file called “--linux-.---”. UMSDOS fell into disuse after VFAT was released and it is not enabled by default in Linux kernel
Linux kernel
The Linux kernel is an operating system kernel used by the Linux family of Unix-like operating systems. It is one of the most prominent examples of free and open source software....

s from version 2.5.7 onwards. Mac OS 9 and Mac OS X
Mac OS X
Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...

 also support FAT file systems on volumes other than the boot disk
Boot disk
A boot disk is a removable digital data storage medium from which a computer can load and run an operating system or utility program. The computer must have a built-in program which will load and execute a program from a boot disk meeting certain standards.Boot disks are used for:* Operating...

. AmigaOS
AmigaOS
AmigaOS is the default native operating system of the Amiga personal computer. It was developed first by Commodore International, and initially introduced in 1985 with the Amiga 1000...

 supports FAT through the CrossDOS
CrossDOS
CrossDOS is file system for AmigaDOS. It was bundled with AmigaOS 2.1 and later, though it did work under Amiga OS 2.04. Its function was to allow working with floppy disks formatted for PCs...

 file system.

A free Windows-based FAT32 formatter is available that overcomes many of the arbitrary limitations imposed by Microsoft
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...

.

FAT and Alternate Data Streams

The FAT file system itself is not designed for supporting Alternate Data Streams (ADS
Fork (filesystem)
In a computer file system, a fork is byte stream associated with a file system object. Every non-empty file must have at least one fork, and depending on the file system, a file may have one or more other associated forks, which in turn may contain primary data integral to the file, or just metadata...

), but some operating systems that heavily depend on them have devised various methods for handling them in FAT drives. Such methods either store the additional information in extra files and directories (Mac OS), or give new semantics to previously unused fields of the FAT on-disk data structures (OS/2 and Windows NT).

Mac OS
Mac OS
Mac OS is a series of graphical user interface-based operating systems developed by Apple Inc. for their Macintosh line of computer systems. The Macintosh user experience is credited with popularizing the graphical user interface...

 using PC Exchange
PC Exchange
PC Exchange was a utility program for Apple Macintosh computers. It was a control panel for the Mac OS that lets the operating system mount FAT file systems and mapped file extensions to the user-defined type and creator codes....

 stores its various dates, file attributes and long filenames in a hidden file called FINDER.DAT, and resource fork
Resource fork
The resource fork is a construct of the Mac OS operating system used to store structured data in a file, alongside unstructured data stored within the data fork. A resource fork stores information in a specific form, such as icons, the shapes of windows, definitions of menus and their contents, and...

s (a common Mac OS ADS) in a subdirectory called RESOURCE.FRK, in every directory where they are used. From PC Exchange 2.1 onwards, they store the Mac OS long filenames as standard FAT long filenames and convert FAT filenames longer than 31 characters to unique 31-character filenames, which can then be made visible to Macintosh applications.

Mac OS X stores resource forks and metadata (file attributes, other ADS) in a hidden file with a name constructed from the owner filename prefixed with "._", and Finder stores some folder and file metadata in a hidden file called ".DS Store
.DS Store
.DS_Store is a hidden file created by Apple Inc.'s Mac OS X operating system to store custom attributes of a folder such as the position of icons or the choice of a background image.- Purpose :...

".

OS/2
OS/2
OS/2 is a computer operating system, initially created by Microsoft and IBM, then later developed by IBM exclusively. The name stands for "Operating System/2," because it was introduced as part of the same generation change release as IBM's "Personal System/2 " line of second-generation personal...

 heavily depends on extended attributes (EAs) and stores them in a hidden file called "EA DATA. SF" in the root directory of the FAT12 or FAT16 volume. This file is indexed by 2 previously reserved bytes in the file's (or directory's) directory entry. In the FAT32 format, these bytes hold the upper 16 bits of the starting cluster number of the file or directory, hence making it difficult to store EAs on FAT32. Extended attributes are accessible via the Workplace Shell
Workplace Shell
The Workplace Shell is a object-oriented desktop shell produced by IBM's Boca Raton development lab for OS/2 2.0. It is based on Common User Access and made a radical shift away from the Program Manager type interface that earlier versions of OS/2 shared with Windows 3.x or the...

 desktop, through REXX
REXX
REXX is an interpreted programming language that was developed at IBM. It is a structured high-level programming language that was designed to be both easy to learn and easy to read...

 scripts, and many system GUI
Graphical user interface
In computing, a graphical user interface is a type of user interface that allows users to interact with electronic devices with images rather than text commands. GUIs can be used in computers, hand-held devices such as MP3 players, portable media players or gaming devices, household appliances and...

 and command-line utilities (such as 4OS2
4DOS
4DOS is a command line interpreter by JP Software, designed to replace the default command interpreter COMMAND.COM in DOS and Windows 95/98/Me. The 4DOS family of programs are meant to replace the default command processor. 4OS2 and 4NT replace CMD.EXE in OS/2 and Windows NT respectively...

).

To accommodate its OS/2
OS/2
OS/2 is a computer operating system, initially created by Microsoft and IBM, then later developed by IBM exclusively. The name stands for "Operating System/2," because it was introduced as part of the same generation change release as IBM's "Personal System/2 " line of second-generation personal...

 subsystem, Windows NT
Windows NT
Windows NT is a family of operating systems produced by Microsoft, the first version of which was released in July 1993. It was a powerful high-level-language-based, processor-independent, multiprocessing, multiuser operating system with features comparable to Unix. It was intended to complement...

 supports the handling of extended attributes in HPFS, NTFS
NTFS
NTFS is the standard file system of Windows NT, including its later versions Windows 2000, Windows XP, Windows Server 2003, Windows Server 2008, Windows Vista, and Windows 7....

, and FAT. It stores EAs on FAT and HPFS using exactly the same scheme as OS/2, but does not support any other kind of ADS as held on NTFS volumes. Trying to copy a file with any ADS other than EAs from an NTFS volume to a FAT or HPFS volume gives a warning message with the names of the ADSs that will be lost.

Windows 2000 onward acts exactly as Windows NT, except that it ignores EAs when copying to FAT32 without any warning (but shows the warning for other ADSs, like "Macintosh Finder Info" and "Macintosh Resource Fork").

Future

For most purposes, the NTFS
NTFS
NTFS is the standard file system of Windows NT, including its later versions Windows 2000, Windows XP, Windows Server 2003, Windows Server 2008, Windows Vista, and Windows 7....

 file system is superior to FAT in terms of features and reliability; its main drawbacks are the size overhead for small volumes and the very limited support by anything other than the NT-based versions of Windows, since the exact specification is a trade secret
Trade secret
A trade secret is a formula, practice, process, design, instrument, pattern, or compilation of information which is not generally known or reasonably ascertainable, by which a business can obtain an economic advantage over competitors or customers...

 of Microsoft. The availability of NTFS-3G
NTFS-3G
NTFS-3G is an open source cross-platform implementation of the Microsoft Windows NTFS file system with read-write support. NTFS-3G often uses the FUSE file system interface, so it can run unmodified on many different operating systems. It is runnable on Linux, FreeBSD, NetBSD, OpenSolaris, BeOS,...

 since mid 2006 has led to much improved NTFS support in Unix-like
Unix-like
A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....

 operating systems, considerably alleviating this concern. It is still not possible to use NTFS in DOS-like operating systems without third-party drivers, which in turn makes it difficult to use a DOS floppy for recovery purposes. Microsoft provided a recovery console
Recovery Console
The Recovery Console is a feature of the Windows 2000, Windows XP and Windows Server 2003 operating systems. It provides the means for administrators to perform a limited range of tasks using a command line interface. Its primary function is to enable administrators to recover from situations...

 to work around this issue, but for security reasons it severely limited what could be done through the Recovery Console by default. The movement of recovery utilities to boot CDs based on BartPE
BartPE
BartPE is a lightweight variant of the 32-bit version of Microsoft Windows XP or Windows Server 2003, similar to Windows Preinstallation Environment, which can be run from a Live CD or Live USB drive....

 or Linux (with NTFS-3G) is finally eroding this drawback.

FAT is still the normal file system for removable media (with the exception of CDs and DVDs), with FAT12 used on floppies, and FAT16 or FAT32 on most other removable media (such as flash memory
Flash memory
Flash memory is a non-volatile computer storage chip that can be electrically erased and reprogrammed. It was developed from EEPROM and must be erased in fairly large blocks before these can be rewritten with new data...

 cards for digital camera
Digital camera
A digital camera is a camera that takes video or still photographs, or both, digitally by recording images via an electronic image sensor. It is the main device used in the field of digital photography...

s and USB flash drives).

FATX

FATX is a slightly modified version of the FAT filesystem, and is designed for Microsoft
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...

's Xbox
Xbox
The Xbox is a sixth-generation video game console manufactured by Microsoft. It was released on November 15, 2001 in North America, February 22, 2002 in Japan, and March 14, 2002 in Australia and Europe and is the predecessor to the Xbox 360. It was Microsoft's first foray into the gaming console...

 video game console
Video game console
A video game console is an interactive entertainment computer or customized computer system that produces a video display signal which can be used with a display device to display a video game...

 hard disk
Hard disk
A hard disk drive is a non-volatile, random access digital magnetic data storage device. It features rotating rigid platters on a motor-driven spindle within a protective enclosure. Data is magnetically read from and written to the platter by read/write heads that float on a film of air above the...

 drive and memory cards. On‑disk datestamps differ slightly between FAT and FATX: in FAT, the epoch is 1980; in FATX, the epoch is 2000. On the Xbox 360, the epoch is 1980.

exFAT

exFAT (also sometimes incorrectly and inappropriately known as FAT64) is an incompatible replacement for FAT file systems that was introduced with Windows Embedded CE 6.0. MBR partition type is 0x7 (the same as NTFS
NTFS
NTFS is the standard file system of Windows NT, including its later versions Windows 2000, Windows XP, Windows Server 2003, Windows Server 2008, Windows Vista, and Windows 7....

). exFAT is intended to be used on SDXC and flash drives
USB flash drive
A flash drive is a data storage device that consists of flash memory with an integrated Universal Serial Bus interface. flash drives are typically removable and rewritable, and physically much smaller than a floppy disk. Most weigh less than 30 g...

, where FAT is used today.

Design

The following is an overview of the order of structures in a FAT partition or disk:
Contents Boot
Sector
FS Information
Sector
(FAT32 only)
More reserved
sectors
(optional)
File
Allocation
Table #1
File
Allocation
Table #2
Root
Directory
(FAT12/16 only)
Data Region (for files and directories) ...
(To end of partition or disk)
Size in sectors (number of reserved sectors) (number of FATs)*(sectors per FAT) (number of root entries*32)/Bytes per sector NumberOfClusters*SectorsPerCluster


A FAT file system is composed of four different sections.
  1. The Reserved sectors, located at the very beginning. The first reserved sector (sector 0) is the Boot Sector
    Boot sector
    A boot sector or boot block is a region of a hard disk, floppy disk, optical disc, or other data storage device that contains machine code to be loaded into random-access memory by a computer system's built-in firmware...

     (aka Partition Boot Record). It includes an area called the BIOS Parameter Block
    BIOS parameter block
    In computing, the BIOS parameter block, often shortened to BPB, is a data structure in the Volume Boot Record describing the physical layout of a data storage volume. On partitioned devices, such as hard disks, the BPB describes the volume partition, whereas, on unpartitioned devices, such as...

    (with some basic file system information, in particular its type, and pointers to the location of the other sections) and usually contains the operating system's boot loader code. The total count of reserved sectors is indicated by a field inside the Boot Sector. Important information from the Boot Sector is accessible through an operating system structure called the Drive Parameter Block in DOS and OS/2. For FAT32 file systems, the reserved sectors include a File System Information Sector at sector 1 and a Backup Boot Sector at Sector 6.
  2. The FAT Region. This typically contains two copies (may vary) of the File Allocation Table for the sake of redundancy checking, although the extra copy is rarely used, even by disk repair utilities. These are maps of the Data Region, indicating which clusters are used by files and directories. In FAT16 and FAT12 they immediately follow the reserved sectors.
  3. The Root Directory Region. This is a Directory Table that stores information about the files and directories located in the root directory. It is only used with FAT12 and FAT16, and imposes on the root directory a fixed maximum size which is pre-allocated at creation of this volume. FAT32 stores the root directory in the Data Region, along with files and other directories, allowing it to grow without such a constraint. Thus, for FAT32, the Data Region starts here.
  4. The Data Region. This is where the actual file and directory data is stored and takes up most of the partition. The size of files and subdirectories can be increased arbitrarily (as long as there are free clusters) by simply adding more links to the file's chain in the FAT. Note however, that files are allocated in units of clusters, so if a file resides in a cluster, are wasted. FAT32 typically commences the Root Directory Table in cluster number 2: the first cluster of the Data Region.


FAT uses little endian
Endianness
In computing, the term endian or endianness refers to the ordering of individually addressable sub-components within the representation of a larger data item as stored in external memory . Each sub-component in the representation has a unique degree of significance, like the place value of digits...

 format for entries in the header and the FAT(s). It is possible to allocate more FAT sectors than necessary for the number of clusters. The end of the last FAT sector can be unused if there are no corresponding clusters. The total number of sectors (as noted in the boot record) can be larger than the number of sectors used by data (clusters × sectors per cluster), FATs (number of FATs × sectors per FAT), and hidden sectors including the boot sector — this would result in unused sectors at the end of the volume. If a partition contains more sectors than the total number of sectors occupied by the file system it would also result in unused sectors at the end of the volume.

Boot Sector

On non-partitioned devices, e.g., floppy disk
Floppy disk
A floppy disk is a disk storage medium composed of a disk of thin and flexible magnetic storage medium, sealed in a rectangular plastic carrier lined with fabric that removes dust particles...

s, the boot sector is the first sector. For partitioned devices such as hard drives, the first sector is the Master Boot Record
Master boot record
A master boot record is a type of boot sector popularized by the IBM Personal Computer. It consists of a sequence of 512 bytes located at the first sector of a data storage device such as a hard disk...

 defining partitions, while the first sector of partitions formatted with a FAT file system is again the FAT boot sector.

Common structure of the first 36 bytes used by all FAT versions are:
Byte Offset Length (bytes) Description
0x00 3 Jump instruction. This instruction will be executed and will skip past the rest of the (non-executable) header if the partition is booted from. See Volume Boot Record
Volume Boot Record
A volume boot record is a type of boot sector introduced by the IBM Personal Computer...

. If the jump is two-byte near jmp it is followed by a NOP instruction (hex. EB??90)
0x03 8 OEM Name (padded with spaces 0x20). This value determines in which system disk was formatted. MS-DOS checks this field to determine which other parts of the boot record can be relied on. Common examples are IBM␠␠3.3, MSDOS5.0, MSWIN4.1, mkdosfs␠
Mkdosfs
mkdosfs is one of the applications that are included in the dosfstools package, and it is used to create a DOS file system under Linux on a data storage device .- Usage : mkdosfs [options] device...

, and FreeDOS␠
FreeDOS
FreeDOS is an operating system for IBM PC compatible computers. FreeDOS is made up of many different, separate programs that act as "packages" to the overall FreeDOS Project...

.
0x0B 2 Bytes per sector; the most common value is 512. The BIOS Parameter Block
BIOS parameter block
In computing, the BIOS parameter block, often shortened to BPB, is a data structure in the Volume Boot Record describing the physical layout of a data storage volume. On partitioned devices, such as hard disks, the BPB describes the volume partition, whereas, on unpartitioned devices, such as...

 starts here.
0x0D 1 Sectors per cluster. Allowed values are powers of two from 1 to 128.
0x0E 2 Reserved sector count. The number of sectors before the first FAT in the file system image. At least 1 for this sector, usually 32 for FAT32.
0x10 1 Number of file allocation tables. Almost always 2; RAM disk
RAM disk
A RAM disk or RAM drive is a block of RAM that a computer's software is treating as if the memory were a disk drive...

s might use 1.
0x11 2 Maximum number of FAT12 or FAT16 root directory entries. 0 for FAT32, where the root directory is stored in ordinary data clusters.
0x13 2 Total sectors (if zero, use 4 byte value at offset 0x20)
0x15 1 Media descriptor
0xF0 3.5" Double Sided, 80 tracks per side, 18 or 36 sectors per track (1.44MB or 2.88MB)
Used also for other media types such as tapes.
0xF8 Fixed disk (i.e., typically a partition on a Hard disk).
0xF9 3.5" Double sided, 80 tracks per side, 9 sectors per track (720K)
5.25" Double sided, 80 tracks per side, 15 sectors per track (1.2MB)
0xFA 5.25" Single sided, 80 tracks per side, 8 sectors per track (320K)
0xFB 3.5" Double sided, 80 tracks per side, 8 sectors per track (640K)
0xFC 5.25" Single sided, 40 tracks per side, 9 sectors per track (180K)
0xFD 5.25" Double sided, 40 tracks per side, 9 sectors per track (360K)
8" Double sided, 77 tracks per side, 26 sectors per track, 128 bytes per sector (500.5K)
0xFE 5.25" Single sided, 40 tracks per side, 8 sectors per track (160K)
8" Single sided, 77 tracks per side, 26 sectors per track, 128 bytes per sector (250.25K)
8" Double sided, 77 tracks per side, 8 sectors per track, 1024 bytes per sector (1232K)
0xFF 5.25" Double sided, 40 tracks per side, 8 sectors per track (320K)

Same value of media descriptor should be repeated as first byte of each copy of FAT.
Certain operating systems (MSX-DOS
MSX-DOS
MSX-DOS is a Disk operating system developed by Microsoft for the 8-bit home computer standard MSX, and is a cross between MS-DOS rev 1.0 and CP/M.-MSX-DOS:...

 version 1.0) ignore boot sector parameters altogether and use media descriptor value from the first byte of FAT to determine file system parameters.
0x16 2 Sectors per File Allocation Table for FAT12/FAT16, 0 for FAT32 (cf. offset 0x24 below)
0x18 2 Sectors per track for disks with geometry, e.g., 18 for a 1.44MB floppy
0x1A 2 Number of heads for disks with geometry, e.g., 2 for a double sided floppy
0x1C 4 Count of hidden sectors preceding the partition that contains this FAT volume. This field should always be zero on media that are not partitioned.
0x20 4 Total sectors (if greater than 65535; otherwise, see offset 0x13)


A simple formula translates a given cluster number CN to a logical sector number LSN:
  1. Determine (once) SSA=RSC+FN×SF+ceil((32×RDE)/SS), where the reserved sector count RSC is stored at offset 0x0E, the FAT number FN at offset 0x10, the sectors per FAT SF at offset 0x16 (FAT12/16) or 0x24 (FAT32), the root directory entries RDE at offset 0x11, the sector size SS at offset 0x0B, and ceil(x) rounds up to a whole number.
  2. Determine LSN=SSA+(CN-2)×SC, where the sectors per cluster SC are stored at offset 0x0D.


A translation of CHS
Cylinder-head-sector
Cylinder-head-sector, also known as CHS, was an early method for giving addresses to each physical block of data on a hard disk drive. In the case of floppy drives, for which the same exact diskette medium can be truly low-level formatted to different capacities, this is still true.Though CHS...

 to LSN is also simple: LSN=SPT×(HN+(NOS×TN))+SN-1, where the sectors per track SPT are stored at offset 0x18, and the number of sides NOS at offset 0x1A. Track number TN, head number HN, and sector number SN correspond to Cylinder-head-sector
Cylinder-head-sector
Cylinder-head-sector, also known as CHS, was an early method for giving addresses to each physical block of data on a hard disk drive. In the case of floppy drives, for which the same exact diskette medium can be truly low-level formatted to different capacities, this is still true.Though CHS...

 — the formula gives the known CHS to LBA
Logical block addressing
Logical block addressing is a common scheme used for specifying the location of blocks of data stored on computer storage devices, generally secondary storage systems such as hard disks....

 translation.

Extended BIOS Parameter Block

Further structure used by FAT12 and FAT16, also known as Extended BIOS Parameter Block:
Byte Offset Length (bytes) Description
0x24 1 Physical drive number (0x00 for removable media, 0x80 for hard disks)
0x25 1 Reserved; in boot code used as INT 13h head high byte for the 16-bits word at 0x24, in Windows NT used as CHKDSK
CHKDSK
CHKDSK is a command on computers running DOS, OS/2 and Microsoft Windows operating systems that displays the file system integrity status of hard disks and floppy disk and can fix logical file system errors. It is similar to the fsck command in Unix.The command is implemented as an executable...

 flags (1: dirty, 2 bad sectors).
0x26 1 Extended boot signature. (Should be 0x29 to indicate that an EBPB with the following 3 entries exists. Can be 0x28 on some OS/2 1.x and DOS disks indicating an earlier form of the EBPB format with only the serial number following.)
0x27 4 Volume ID (serial number)
0x2B 11 Volume Label, padded with blanks (0x20), e.g., "NO␠NAME␠␠␠␠"
0x36 8 File system type, padded with blanks (0x20), e.g., "FAT12␠␠␠"
0x3E 448 Operating system boot code; does not belong to the Extended BIOS Parameter Block
0x1FE 2 Boot sector signature 0x55 0xAA


The boot sector is portrayed here as found on e.g. an OS/2 1.3 boot diskette. Earlier versions used a shorter BIOS Parameter Block and their boot code would start earlier (for example at offset 0x2b in OS/2 1.1).

In essence FAT32 inserts 28 bytes, followed by the remaining 26 EBPB bytes as shown above for FAT12 and FAT16:
Byte Offset Length (bytes) Description
0x24 4 Sectors per file allocation table
0x28 2 Mirroring flags (4 low bits = active FAT number minus 1, if high bit set)
0x2A 2 Version (defined as 0)
0x2C 4 Cluster number of root directory start, typically 2 (first cluster) if it contains no bad sector.
0x30 2 Sector number of FS Information Sector, typically 1, i.e., the second of the three FAT32 boot sectors.
0x32 2 First sector number of a copy of the three FAT32 boot sectors, typically 6.
0x34 12 Reserved (must be 0)
0x40 1 Cf. 0x24 for FAT12/16 (Physical Drive Number)
0x41 1 Cf. 0x25 for FAT12/16
0x42 1 Cf. 0x26 for FAT12/16 (Extended boot signature)
0x43 4 Cf. 0x27 for FAT12/16 (Volume ID)
0x47 11 Cf. 0x2B for FAT12/16 (Volume Label)
0x52 8 Cf. 0x36 for FAT12/16 (File system type)
0x5A 420 Operating system boot code; does not belong to the Extended BIOS Parameter Block
0x1FE 2 Boot sector signature 0x55 0xAA

Exceptions

The implementation of FAT used in MS-DOS
MS-DOS
MS-DOS is an operating system for x86-based personal computers. It was the most commonly used member of the DOS family of operating systems, and was the main operating system for IBM PC compatible personal computers during the 1980s to the mid 1990s, until it was gradually superseded by operating...

 for the Apricot PC
Apricot PC
The Apricot PC was Apricot Computers' first personal computer made for business use. The press received it well, especially for the high resolution of its time and its trackball cable . It is the first non-Japanese computer using 3.5" Sony floppy disc units.It uses a Intel 8086 processor running...

 had a different boot sector layout, to accommodate that computer's non-IBM compatible BIOS. The jump instruction and OEM name were omitted, and the MS-DOS file system parameters (offsets 0x0B - 0x17 in the standard sector) were located at offset 0x50. Later versions of Apricot MS-DOS gained the ability to read and write disks with the standard boot sector in addition to those with the Apricot one.

DOS Plus
DOS Plus
DOS Plus is an operating system written by Digital Research, first released in 1985. It can be seen as an intermediate step between CP/M-86 and DR-DOS....

 on the BBC Master
BBC Master
The BBC Master was a home computer released by Acorn Computers in early 1986. It was designed and built for the British Broadcasting Corporation and was the successor to the BBC Micro Model B. The Master 128 remained in production until 1993....

 512 did not use conventional boot sectors at all. Data disks omitted the boot sector and began with a single copy of the FAT (the first byte of the FAT was used to determine disk capacity) while boot disks began with a miniature ADFS
Advanced Disc Filing System
The Advanced Disc Filing System is a computing file system particular to the Acorn computer range and RISC OS based successors. Initially based on the rare Acorn Winchester Filing System, it was renamed to the Advanced Disc Filing System when support for floppy discs was added and on later 32 bit...

 file system containing the boot loader, followed by a single FAT. It could also access standard PC disks formatted to or , again using the first byte of the FAT to determine the capacity.

FS Information Sector

The "FS Information Sector" was introduced in FAT32 for speeding up access times of certain operations (in particular, getting the amount of free space). It is located at a sector number specified in the boot record at position 0x30 (usually sector 1, immediately after the boot record).
Byte Offset Length (bytes) Description
0x00 4 FS information sector signature (0x52 0x52 0x61 0x41 = "RRaA")
0x04 480 Reserved (byte values are 0x00)
0x1E4 4 FS information sector signature (0x72 0x72 0x41 0x61 = "rrAa")
0x1E8 4 Number of free clusters on the drive, or -1 if unknown
0x1EC 4 Number of the most recently allocated cluster
0x1F0 12 Reserved (byte values are 0x00)
0x1FC 4 FS information sector signature (0x00 0x00 0x55 0xAA)

File Allocation Table

A partition is divided up into identically sized clusters, small blocks of contiguous space. Cluster sizes vary depending on the type of FAT file system being used and the size of the partition, typically cluster sizes lie somewhere between and . Each file may occupy one or more of these clusters depending on its size; thus, a file is represented by a chain of these clusters (referred to as a singly linked list). However these clusters are not necessarily stored adjacent to one another on the disk's surface but are often instead fragmented throughout the Data Region.

The File Allocation Table (FAT) is a list of entries that map to each cluster on the partition. Each entry records one of five things:
  • the cluster number of the next cluster in a chain
  • a special end of clusterchain (EOC) entry that indicates the end of a chain
  • a special entry to mark a bad cluster
  • a zero to note that the cluster is unused


The first two entries in a FAT store special values: The first entry contains a copy of the media descriptor (from boot sector, offset 0x15). The remaining 4 bits (if FAT12), 8 bits (if FAT16) or 20 bits (if FAT32) of this entry are 1.

The second entry stores the end-of-cluster-chain marker. The high order two bits of this entry are sometimes, in the case of FAT16 and FAT32, used for dirty volume management: high order bit 1: last shutdown was clean; next highest bit 1: during the previous mount no disk I/O errors were detected.

Because the first two FAT entries store special values, there is no cluster 0 or 1. The first cluster (after the root directory if FAT 12/16) is cluster 2.

FAT entry values:
FAT12 FAT16 FAT32 Description
0x000 0x0000 0x00000000 Free Cluster — also used as parent directory starting cluster in ".." entries for subdirectories of the root directory (FAT12/16)
0x001 0x0001 0x00000001 Reserved, do not use
0x002‑0xFEF 0x0002‑0xFFEF 0x00000002‑0x0FFFFFEF Used cluster; value points to next cluster
0xFF0‑0xFF5 0xFFF0‑0xFFF5 0x0FFFFFF0‑0x0FFFFFF5 Reserved in some contexts or also used
0xFF6 0xFFF6 0x0FFFFFF6 Reserved; do not use
0xFF7 0xFFF7 0x0FFFFFF7 Bad sector in cluster or reserved cluster
0xFF8‑0xFFF 0xFFF8‑0xFFFF 0x0FFFFFF8‑0x0FFFFFFF Last cluster in file (EOC)

Note that FAT32 uses only 28 bits of the 32 possible bits. The upper 4 bits are usually zero (as indicated in the table above) but are reserved and should be left untouched.

Each version of the FAT file system uses a different size for FAT entries. Smaller numbers result in a smaller FAT, but waste space in large partitions by needing to allocate in large clusters. The FAT12 file system uses 12 bits per FAT entry, thus two entries span 3 bytes. It is consistently little-endian: if you consider the 3 bytes as one little-endian 24-bit number, the 12 least significant bits are the first entry and the 12 most significant bits are the second.

Directory table

A directory table is a special type of file that represents a directory (also known as a folder). Each file or directory stored within it is represented by a 32-byte entry in the table. Each entry records the name, extension, attributes (archive
Archive bit
The archive bit is a file attribute used by Microsoft operating systems and by OS/2. Typically it's state indicates whether or not the file has been backed up....

, directory, hidden, read-only, system and volume), the date and time of creation, the address of the first cluster of the file/directory's data and finally the size of the file/directory.
Aside from the Root Directory Table in FAT12 and FAT16 file systems, which occupies the special Root Directory Region location, all Directory Tables are stored in the Data Region. The actual number of entries in a directory stored in the Data Region can grow by adding another cluster to the chain in the FAT.

Note that before each entry there can be "fake entries" to support the Long File Name. (See further down the article).

Legal characters for DOS file names include the following:
  • Upper case letters AZ
  • Numbers 09
  • Space (though trailing spaces in either the base name or the extension are considered to be padding and not a part of the file name, also filenames with space in them could not be used on the DOS command line prior to Windows 95 because of the lack of a suitable escaping system
    Escape character
    In computing and telecommunication, an escape character is a character which invokes an alternative interpretation on subsequent characters in a character sequence. An escape character is a particular case of metacharacters...

    )
  • ! # $ % & ' - @ ^ _ ` { } ~
  • Values 128–255


This excludes the following ASCII
ASCII
The American Standard Code for Information Interchange is a character-encoding scheme based on the ordering of the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text...

 characters:
  • " * / : < > ? \ |
    Windows/MSDOS has no shell escape character
    Escape character
    In computing and telecommunication, an escape character is a character which invokes an alternative interpretation on subsequent characters in a character sequence. An escape character is a particular case of metacharacters...

  • + , . ; = [ ]
    They are allowed in long file names only.
  • Lower case letters az
    Stored as AZ. Allowed in long file names.
  • Control characters 0–31
  • Value 127 (DEL)


The DOS file names are in the current OEM character set
Code page
Code page is another term for character encoding. It consists of a table of values that describes the character set for a particular language. The term code page originated from IBM's EBCDIC-based mainframe systems, but many vendors use this term including Microsoft, SAP, and Oracle Corporation...

 — this can have surprising effects if characters handled in one way for a given code page are interpreted differently for another code page (DOS command CHCP) with respect to lower and upper case, sorting, or validity as file name character.

Directory entries, both in the Root Directory Region and in subdirectories, are of the following format (see also 8.3 filename):
Byte Offset Length (bytes) Description
0x00 8 DOS file name (padded with spaces)

The first byte can have the following special values:
0x00 Entry is available and no subsequent entry is in use
0x05 Initial character is actually 0xE5.
0x2E 'Dot' entry; either '.' or '..'
0xE5 Entry has been previously erased and is available. File undelete utilities must replace this character with a regular character as part of the undeletion process.
0x08 3 DOS file extension (padded with spaces)
0x0B 1 File Attributes
Bit Mask Description
0 0x01 Read Only
1 0x02 Hidden
2 0x04 System
3 0x08 Volume Label
4 0x10 Subdirectory
5 0x20 Archive
Archive bit
The archive bit is a file attribute used by Microsoft operating systems and by OS/2. Typically it's state indicates whether or not the file has been backed up....

6 0x40 Device (internal use only, never found on disk)
7 0x80 Unused

An attribute value of 0x0F is used to designate a long file name entry.
0x0C 1 Reserved; two bits are used by NT and later versions to encode case information (see below); otherwise 0
0x0D 1 Create time, fine resolution: 10ms units, values from 0 to 199.
0x0E 2 Create time. The hour, minute and second are encoded according to the following bitmap:
Bits Description
15‑11 Hours (0-23)
10‑5 Minutes (0-59)
4‑0 Seconds/2 (0-29)

Note that the seconds is recorded only to a 2 second resolution. Finer resolution for file creation is found at offset 0x0d.
0x10 2 Create date. The year, month and day are encoded according to the following bitmap:
Bits Description
15‑9 Year (0 = 1980, 127 = 2107)
8‑5 Month (1 - 12)
4‑0 Day (1 - 31)
0x12 2 Last access date; see offset 0x10 for description.
0x14 2 EA-Index (used by OS/2
OS/2
OS/2 is a computer operating system, initially created by Microsoft and IBM, then later developed by IBM exclusively. The name stands for "Operating System/2," because it was introduced as part of the same generation change release as IBM's "Personal System/2 " line of second-generation personal...

 and NT) in FAT12 and FAT16, high 2 bytes of first cluster number in FAT32
0x16 2 Last modified time; see offset 0x0e for description.
0x18 2 Last modified date; see offset 0x10 for description.
0x1A 2 Start of file in clusters in FAT12 and FAT16. Low 2 bytes of first cluster in FAT32. Entries with the Volume Label flag, subdirectory ".." pointing to FAT12/16 root, and empty files with size 0 should have first cluster 0.
0x1C 4 File size in bytes. Entries with the Volume Label or Subdirectory flag set should have a size of 0.

Long file names

Long File Names (LFN) are stored on a FAT file system using a trick—adding (possibly multiple) additional entries into the directory before the normal file entry. The additional entries are marked with the Volume Label, System, Hidden, and Read Only attributes (yielding 0x0F), which is a combination that is not expected in the MS-DOS environment, and therefore ignored by MS-DOS programs and third-party utilities. Notably, a directory containing only volume labels is considered as empty and is allowed to be deleted; such a situation appears if files created with long names are deleted from plain DOS.

Older versions of PC-DOS mistake LFN names in the root directory for the volume label, and are likely to display an incorrect label.

Each phony entry can contain up to 13 UTF-16 characters (26 bytes) by using fields in the record which contain file size or time stamps (but not the starting cluster field, for compatibility with disk utilities, the starting cluster field is set to a value of 0. See 8.3 filename for additional explanations). Up to 20 of these 13-character entries may be chained, supporting a maximum length of 255 UTF-16 characters.

After the last UTF-16 character, a 0x00 0x00 is added. The remaining unused characters are filled with 0xFF 0xFF.

LFN entries use the following format:
Byte Offset Length (bytes) Description
0x00 1 Sequence Number
0x01 10 Name characters (five UTF-16 characters)
0x0B 1 Attributes (always 0x0F)
0x0C 1 Reserved (always 0x00)
0x0D 1 Checksum of DOS file name
0x0E 12 Name characters (six UTF-16 characters)
0x1A 2 First cluster (always 0x0000)
0x1C 4 Name characters (two UTF-16 characters)


If there are multiple LFN entries, required to represent a file name, firstly comes the last LFN entry (the last part of the filename). The sequence number also has bit 6 (0x40) set (this means the last LFN entry, however it's the first entry seen when reading the directory file). The last LFN entry has the largest sequence number which decreases in following entries. The first LFN entry has sequence number 1. Bit 7 (0x80) of the sequence number is used to indicate that the entry is deleted.

For example if we have filename "File with very long filename.ext" it would be formatted like this:
Sequence number Entry data
0x43 "me.ext"
0x02 "y long filena"
0x01 "File with ver"
??? Normal 8.3 entry


A checksum
Checksum
A checksum or hash sum is a fixed-size datum computed from an arbitrary block of digital data for the purpose of detecting accidental errors that may have been introduced during its transmission or storage. The integrity of the data can be checked at any later time by recomputing the checksum and...

 also allows verification of whether a long file name matches the 8.3 name; such a mismatch could occur if a file was deleted and re-created using DOS in the same directory position. The checksum is calculated using the algorithm below. (Note that pFcbName is a pointer to the name as it appears in a regular directory entry, i.e. the first eight characters are the filename, and the last three are the extension. The dot is implicit. Any unused space in the filename is padded with space characters (ASCII 0x20). For example, "Readme.txt" would be "README␠␠TXT".)

unsigned char lfn_checksum(const unsigned char *pFcbName)
{
int i;
unsigned char sum=0;

for (i=11; i; i--)
sum = ((sum & 1) << 7) + (sum >> 1) + *pFcbName++;
return sum;
}


If a filename contains only lowercase letters, or is a combination of a lowercase basename with an uppercase extension, or vice-versa; and has no special characters, and fits within the 8.3 limits, a VFAT entry is not created on Windows NT and later versions of Windows such as XP. Instead, two bits in byte 0x0c of the directory entry are used to indicate that the filename should be considered as entirely or partially lowercase. Specifically, bit 4 means lowercase extension and bit 3 lowercase basename, which allows for combinations such as "example.TXT" or "HELLO.txt" but not "Mixed.txt". Few other operating systems support it. This creates a backwards-compatibility problem with older Windows versions (95, 98, ME) that see all-uppercase filenames if this extension has been used, and therefore can change the name of a file when it is transported between OSes, such as on a USB flash drive. Current 2.6.x versions of Linux will recognize this extension when reading (source: kernel 2.6.18 /fs/fat/dir.c and fs/vfat/namei.c); the mount option shortname determines whether this feature is used when writing.

Third-party extensions

Before Microsoft added support for long filenames and creation/access time stamps, bytes 0x0C–0x15 of the directory entry were used by alternative operating systems to store additional metadata. These included:
Byte Offset Length (bytes) System Description
0x0C 2 RISC OS
RISC OS
RISC OS is a computer operating system originally developed by Acorn Computers Ltd in Cambridge, England for their range of desktop computers, based on their own ARM architecture. First released in 1987, under the name Arthur, the subsequent iteration was renamed as in 1988...

File type, 0x000 - 0xFFF
0x0C 4 Petrov DOSFS File load address
0x10 4 Petrov DOSFS File execution address
0x0C 1 DOS Plus
DOS Plus
DOS Plus is an operating system written by Digital Research, first released in 1985. It can be seen as an intermediate step between CP/M-86 and DR-DOS....

User-defined file attributes F1-F4
Bit Mask Description
7 0x80 F1
6 0x40 F2
5 0x20 F3
4 0x10 F4
0x0C 1 MSX‑DOS
MSX-DOS
MSX-DOS is a Disk operating system developed by Microsoft for the 8-bit home computer standard MSX, and is a cross between MS-DOS rev 1.0 and CP/M.-MSX-DOS:...

 2
For a deleted file, the original first character of the filename.
0x0D 1 DR-DOS
DR-DOS
DR-DOS is an MS-DOS-compatible operating system for IBM PC-compatible personal computers, originally developed by Gary Kildall's Digital Research and derived from Concurrent PC DOS 6.0, which was an advanced successor of CP/M-86...

For a deleted file, the original first character of the filename.
0x0E 2 DR-DOS and FlexOS
FlexOS
FlexOS was a modular real-time multi-user multi-tasking operating system designed for computer-integrated manufacturing, laboratory, retail and financial markets...

Encrypted file password
0x0E 2 ANDOS
ANDOS
ANDOS is a Russian operating system for Electronika BK-0010, Electronika BK-0011 and Electronika BK-0011M series computers. It was created in 1990 and first released in 1992. Initially it was developed by Alexey Nadezhin and later also by Sergey Kamnev, who joined the project...

File address in the memory
0x10 4 DR‑DOS 7 For a deleted file, its original file time and date; deleted files have their normal time and date fields set to the time of deletion
0x12 2 DR‑DOS 6 and FlexOS File owner ID
0x14 2 DR-DOS and FlexOS File permissions bitmap (execute permissions are only used by FlexOS):
Bit Mask Description
0 0x0001 Owner delete requires password
1 0x0002 Owner execute requires password
2 0x0004 Owner write requires password
3 0x0008 Owner read requires password
4 0x0010 Group delete requires password
5 0x0020 Group execute requires password
6 0x0040 Group write requires password
7 0x0080 Group read requires password
8 0x0100 World delete requires password
9 0x0200 World execute requires password
10 0x0400 World write requires password
11 0x0800 World read requires password

Size limits

The FAT12, FAT16 (incl. BigFAT), and FAT32 variants of the FAT file systems have clear limits based on the number of clusters and the number of sectors per cluster (1, 2, 4, ..., 128). For the typical value of 512 bytes per sector:

FAT12 1 .. 4084 clusters: 1 .. 12 FAT sectors
FAT16 4085 .. 65524 clusters: 16 .. 256 FAT sectors
FAT32 65525 .. 268435444 clusters: 512 .. 2097152 FAT sectors
FAT12 min.: 1 * 1 512 ( 0.5 KB) 
FAT16 min.: 1 * 4085 2,091,520 ( 2043 KB) 
FAT32 min.: 1 * 65525 33,548,800 (32763 KB) 
FAT12 max.: 64 * 4084 133,824,512 (~ 127 MB) 
[FAT12 max.: 128 * 4084 267,694,024 (~ 255 MB)]
FAT16 max.: 64 * 65524 2,147,090,432 (~2047 MB) 
[FAT16 max.: 128 * 65524 4,294,180,864 (~4095 MB)]
FAT32 max.: 8 * 268435444 1,099,511,578,624 (~1024 GB) 
FAT32 max.: 16 * 268173557 2,196,877,778,944 (~2046 GB) 
[FAT32 max.: 32 * 134152181 2,197,949,333,504 (~2047 GB)]
[FAT32 max.: 64 * 67092469 2,198,486,024,192 (~2047 GB)]
[FAT32 max.: 128 * 33550325 2,198,754,099,200 (~2047 GB)]


Legend: 268435444+3 is hex. 0FFF FFF7, because FAT32 version 0 uses only 28 bits in the 32bit cluster numbers, cluster numbers hex. 0FFF FFF7 up to 0FFF FFFF flag bad clusters or the end of a file, cluster number 0 flags a free cluster, and cluster number 1 is not used. Likewise 65524+3 is hex. FFF7 for FAT16, and 4084+3 is hex. FF7 for FAT12. The number of sectors per cluster is a power of 2 fitting in a single byte, the smallest value is 1 (hex. 01), the biggest value is 128 (hex. 80). Lines in square brackets indicate the unusual cluster size 128, and for FAT32 the bigger than necessary cluster sizes 32 or 64.

Because each FAT32 entry occupies 32bits (4 bytes) the maximal number of clusters (268435444) requires 2097152 FAT sectors for a sector size of 512 bytes. 2097152 is hex. 200000, and storing this value needs more than two bytes. Therefore FAT32 introduced a new 32bit value in the FAT32 boot sector immediately following the 32bit value for the total number of sectors introduced in the "BigFAT" variant of FAT16.

The boot record extensions introduced with DOS 4.0 start with a magic 40 (hex. 28) or 41 (hex. 29). Typically FAT drivers look only at the number of clusters to distinguish FAT12, FAT16, and FAT32 — the human readable strings identifying the FAT variant in the boot record are ignored, because they exist only for media formatted with DOS 4.0 or later.

Determining the number of directory entries per cluster is straight forward, each entry occupies 32 bytes, this results in 16 entries per sector for a sector size of 512 bytes. The DOS 5 rd command removes the initial "." (this directory) and ".." (parent directory) entries in subdirectories directly, therefore sector size 32 on a RAM disk is possible for FAT12, but requires 2 or more sectors per cluster. A FAT12 boot sector without the DOS 4 extensions needs 29 bytes before the first unnecessary "BigFAT" 32bit number of hidden sectors, this leaves three bytes for the (on a RAM disk unused) boot code and the magic hex. 55AA at the end of all boot sectors. On Windows NT
Windows NT
Windows NT is a family of operating systems produced by Microsoft, the first version of which was released in July 1993. It was a powerful high-level-language-based, processor-independent, multiprocessing, multiuser operating system with features comparable to Unix. It was intended to complement...

 the smallest supported sector size is 128.

On Windows NT
Windows NT
Windows NT is a family of operating systems produced by Microsoft, the first version of which was released in July 1993. It was a powerful high-level-language-based, processor-independent, multiprocessing, multiuser operating system with features comparable to Unix. It was intended to complement...

 operating systems the format
Format (command)
Format is a command-line utility included in Microsoft DOS, IBM OS/2 and Microsoft Windows operating systems to produce disk formatting.The command will perform the following actions by default on a floppy drive, hard drive, solid-states , or other magnetic medium...

 command options /A:128K and /A:256K correspond to the maximal cluster size hex. 80 (128) with a sector size 1024 and 2048, respectively. For the common sector size 512 /A:64K yields 128 sectors per cluster.

FAT licensing

Microsoft applied for, and was granted, a series of patents for key parts of the FAT file system in the mid-1990s. Being almost universally compatible and well-understood, FAT is frequently chosen as an interchange format for flash media used in digital cameras and PDAs
Personal digital assistant
A personal digital assistant , also known as a palmtop computer, or personal data assistant, is a mobile device that functions as a personal information manager. Current PDAs often have the ability to connect to the Internet...

.

On December 3, 2003 Microsoft announced it would be offering licenses for use of its FAT specification and "associated intellectual property", at the cost of a US$0.25 royalty per unit sold, with a $250,000 maximum royalty per license agreement.

To this end, Microsoft cited four patents on the FAT file system as the basis of its intellectual property claims. All four pertain to long-filename extensions to FAT first seen in Windows 95
Windows 95
Windows 95 is a consumer-oriented graphical user interface-based operating system. It was released on August 24, 1995 by Microsoft, and was a significant progression from the company's previous Windows products...

: - Method and system for accessing a file using file names having different file name formats. Filed July 6, 1992. This covered a means of generating and associating a short, 8.3 filename with long one (for example, "Microsoft.txt" with "MICROS~1.TXT") and a means of enumerating conflicting short filenames (for example, "MICROS~2.TXT" and "MICROS~3.TXT"). It is unclear whether this patent would cover an implementation of FAT without explicit long filename capabilities. Hard link
Hard link
In computing, a hard link is a directory entry that associates a name with a file on a file system. . The term is used in file systems which allow multiple hard links to be created for the same file. This has the effect of creating multiple names for the same file, causing an aliasing effect: e.g...

s in Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 file systems do not appear to be prior art
Prior art
Prior art , in most systems of patent law, constitutes all information that has been made available to the public in any form before a given date that might be relevant to a patent's claims of originality...

: deleting a FAT file via its long name will also remove its short name. Renaming a file to a "short" name also updates the long file name for coherency; similarly, renaming a file to a "long" name will allocate a new "short" name. In NTFS, hard links and dual names are separate concepts and each hard link has two names. Finally, at the API level, both names are always provided together when a directory lookup is requested from the system; they do not appear as two separate files and do not have to be "matched" to determine unique files. - Common name space for long and short filenames. Filed for on 1995-04-24. This covers the method of chaining together multiple consecutive 8.3 named directory entries to hold long filenames, with some of the entries specially marked to prevent their confusing older, long filename-unaware FAT implementations.
    • The Public Patent Foundation
      Public Patent Foundation
      Public Patent Foundation, or PUBPAT, is a nonprofit organization that seeks to limit perceived abuse of the United States patent system. It was founded in 2003 by Dan Ravicher. , there was growing concern by many technology professionals over the number of patents granted that are either too...

       successfully challenged this patent; the claims were rejected on 2004-09-14, due to prior disclosure of the claimed techniques in patents and . This decision was later overturned by the Patent Office on 2006-01-10. - Common name space for long and short filenames. Filed on 1996-09-05. This is very similar to 5,579,517.
    • The Public Patent Foundation successfully challenged this patent (USPTO); The USPTO rejected this patent on 2005-10-05, on the grounds that "the six assignees names were incorrect". This decision was also later overturned by the Patent Office on 2006-01-10. - Method and system for providing a common name space for long and short file names in an operating system. Filed on 1997-01-28. This makes claims on the methods used when Windows 95
      Windows 95
      Windows 95 is a consumer-oriented graphical user interface-based operating system. It was released on August 24, 1995 by Microsoft, and was a significant progression from the company's previous Windows products...

      , Windows 98
      Windows 98
      Windows 98 is a graphical operating system by Microsoft. It is the second major release in the Windows 9x line of operating systems. It was released to manufacturing on 15 May 1998 and to retail on 25 June 1998. Windows 98 is the successor to Windows 95. Like its predecessor, it is a hybrid...

       and Windows Me expose long filenames to their MS-DOS
      MS-DOS
      MS-DOS is an operating system for x86-based personal computers. It was the most commonly used member of the DOS family of operating systems, and was the main operating system for IBM PC compatible personal computers during the 1980s to the mid 1990s, until it was gradually superseded by operating...

       compatibility layer. It does not appear to affect any non-Microsoft FAT implementations.


Many technical commentators have concluded that these patents only cover FAT implementations that include support for long filenames, and that removable solid-state media and consumer devices only using short names would be unaffected.

Additionally, in the EFI FAT32 specification Microsoft specifically grants a number of rights, which many readers have interpreted as permitting operating system vendors to implement FAT.

Microsoft is not the only company to have applied for patents for parts of the FAT file system. Other patents affecting FAT include: - System for accessing extended object attribute (EA) data through file name or EA handle linkages in path tables. Filed on 1990-09-25 by Barry A. Feigenbaum and Felix Miro of IBM, this makes claims on the methods used by OS/2
OS/2
OS/2 is a computer operating system, initially created by Microsoft and IBM, then later developed by IBM exclusively. The name stands for "Operating System/2," because it was introduced as part of the same generation change release as IBM's "Personal System/2 " line of second-generation personal...

, Windows NT
Windows NT
Windows NT is a family of operating systems produced by Microsoft, the first version of which was released in July 1993. It was a powerful high-level-language-based, processor-independent, multiprocessing, multiuser operating system with features comparable to Unix. It was intended to complement...

, and Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

 for storing extended attribute data in the "EA DATA. SF" file.

Appeal

As there was widespread call for these patents to be re-examined, the Public Patent Foundation (PUBPAT) submitted evidence to the US Patent and Trade Office (USPTO) disputing the validity of these patents, including prior art references from Xerox
Xerox
Xerox Corporation is an American multinational document management corporation that produced and sells a range of color and black-and-white printers, multifunction systems, photo copiers, digital production printing presses, and related consulting services and supplies...

 and IBM. The USPTO acknowledged that the evidence raised "substantial new question[s] of patentability," and opened an investigation into the validity of Microsoft's FAT patents.

On 2004-09-30 the USPTO rejected all claims of , based primarily on evidence provided by PUBPAT. Dan Ravicher, the foundation's executive director, said, "The Patent Office has simply confirmed what we already knew for some time now, Microsoft's FAT patent is bogus."

According to the PUBPAT press release, "Microsoft still has the opportunity to respond to the Patent Office's rejection. Typically, third-party requests for re-examination, like the one filed by PUBPAT, are successful in having the subject patent either narrowed or completely revoked roughly 70% of the time."

On 2005-10-05 the Patent Office announced that, following the re-examination process, it had again rejected all claims of patent 5,579,517, and it additionally found invalid on the grounds that the patent had incorrect assignees.

Finally, on 2006-01-10 the Patent Office ruled that features of Microsoft's implementation of the FAT system were "novel and non-obvious", reversing both earlier non-final decisions.

Patent infringement lawsuits

In February 2009, Microsoft
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...

 filed a patent infringement
Patent infringement
Patent infringement is the commission of a prohibited act with respect to a patented invention without permission from the patent holder. Permission may typically be granted in the form of a license. The definition of patent infringement may vary by jurisdiction, but it typically includes using or...

 lawsuit against TomTom
TomTom
TomTom NV is a Dutch manufacturer of automotive navigation systems, including both stand-alone units and software for personal digital assistants and mobile telephones. It is the leading manufacturer of navigation systems in Europe. TomTom's customer service is located in Amsterdam, Netherlands...

 alleging that the device maker's products infringe on patents related to FAT32 filesystem. As some TomTom products are based on Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

, this marked the first time that Microsoft tried to enforce its patents against the Linux platform. The lawsuit was settled out of court the following month with an agreement that Microsoft be given access to four of TomTom's patents, that TomTom will drop support for the FAT32 filesystem from its products, and that in return Microsoft not seek legal action against TomTom for the five year duration of the settlement agreement.

In October 2010, Microsoft filed a patent infringement lawsuit against Motorola
Motorola
Motorola, Inc. was an American multinational telecommunications company based in Schaumburg, Illinois, which was eventually divided into two independent public companies, Motorola Mobility and Motorola Solutions on January 4, 2011, after losing $4.3 billion from 2007 to 2009...

 alleging several patents (including two of the FAT32 filesystem patents) were not licensed for use in the Android operating system. They also submitted a complaint to the ITC
United States International Trade Commission
The United States International Trade Commission is an independent, bi-partisan, quasi-judicial, federal agency of the United States that provides trade expertise to both the legislative and executive branches. Further, the agency determines the impact of imports on U.S...

.

Workarounds

Developers of open source software have designed methods intended to circumvent Microsoft's patents.

See also

  • FAT filesystem and Linux
  • Comparison of file systems
    Comparison of file systems
    -General information:-Limits:-Metadata:-Features:-Allocation and layout policies:-Supporting operating systems:-See also:* Comparison of archive formats* Comparison of file archivers* List of archive formats* List of file archivers...

  • Drive letter assignment
    Drive letter assignment
    Drive letter assignment is the process of assigning alphabetical identifiers to physical or logical disk drives or partitions in the root filesystem namespace; this usage is now mostly found in Microsoft operating systems...

  • List of file systems
  • Transaction-Safe FAT File System
    Transaction-Safe FAT File System
    Transaction-Safe FAT File System refers to two file systems used in Microsoft products to provide transaction-safety for data stored on a disk. The goal is to reduce the risk of data loss in cases of power loss or unexpected removal of the drive...

     (TFAT)

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK