<<

Windows File Systems - FAT and NTFS

The (FAT) is a simple file system originally designed for small disks and simple folder structures. The FAT file system is named for its method of organization, the file allocation table, which resides the beginning of the . To protect the volume, two copies of the table are kept, in case one becomes damaged. In addition, the file allocation tables and the root folder must be stored in a fixed location so that the files needed to the system can be correctly located.

A volume formatted with the FAT file system is allocated in clusters. The default cluster size is determined by the size of the volume. 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 are named after the number of table element bits: 12 (FAT12), 16 (FAT16), and 32 (FAT32). Each is still in use.

FAT12 FAT16 FAT32 Number of bits for 12 16 28 out of 32 (4 reserved) addressing Maximum number 212 – 1 = 4085 216 – 1 = 65,525 228 – 1 = 268,435,445 of clusters addressed Maximum volume 32 MB 2 GB (4 GB with 64 32 GB for all OS (8 TB for some OS) size KB clusters) Cluster Size 8 KB 32 KB 4 KB clusters for drives up to 8 GB in size (32 KB for drives than 32 GB)

A cluster is the minimum amount of space that can be assigned to any file. No file can use part of a cluster under the FAT file system. This means, essentially, that the amount of space a file uses on the disk is "rounded up" to an integer multiple of the cluster size. If you create a file containing exactly one , it will still use an entire cluster's worth of space. Then, you can expand that file in size until it reaches the maximum size of a cluster, and it will take up no additional space. As soon as you make the file larger than what a single cluster can hold, a second cluster will be allocated, and the file's disk usage will double, even though the file only increased in size by one byte. Think of this in terms of collecting rainwater in 1-liter glass bottles. Even if you collect just 25 ml of water, you have to use a whole bottle. Once the bottle is in use, however, you can fill it with 975 ml more, until it is full. Then you'll need another whole bottle to hold the next 25 ml.

Since files are always allocated whole clusters, this means that on average, the larger the cluster size of the volume, the more space that will be wasted. (It's more efficient to use smaller, cup-sized bottles instead of 1 liter-sized ones, if minimizing the amount of storage space is a concern). Therefore, it is better to use smaller cluster sizes whenever possible. This is, unfortunately, often easier said than done. The number of clusters we can use is limited by the nature of the FAT file system, and there are also performance tradeoffs in using smaller cluster sizes (more clusters would mean more work to locate a file). Therefore, it isn't always possible to use the absolute smallest cluster size in order to maximize free space.

NTFS (New Technology File System) is the standard file system of Windows NT, including its later versions , Windows XP, Windows 2003, , , and . NTFS supersedes the FAT file system as the preferred file system for ’s Windows operating systems. NTFS v3.0 includes several new features over its predecessors:

1. Journaling: NTFS is a and uses the NTFS Log ($LogFile) to record metadata changes to the volume. It is a critical functionality of NTFS (a feature that FAT/FAT32 does not provide) for ensuring that its internal complex data structures will remain consistent in case of system crashes, and allow easy rollback of uncommitted changes to these critical data structures when the volume is remounted. 2. Compression: NTFS can compress files in 16-cluster chunks. With 4KB clusters, files are compressed in 64KB chunks. If the compression reduces 64KB of data to 60KB or less, NTFS treats the unneeded 4KB pages like empty clusters - they are not written. However, large compressible files become highly fragmented as then every 64K chunk becomes a fragment. Microsoft does not recommend compression for files exceeding 30MB because of the performance hit. The best use of compression is for files which are repetitive, written seldom, usually accessed sequentially, and not themselves compressed. 3. Encryption: NTFS provides strong and user-transparent encryption of any file or folder. NTFS- provided encryption and NTFS-provided compression are mutually exclusive; however, NTFS can be used for one and a third-party tool for the other. The support of encryption is not available in Basic, Home and MediaCenter versions of Windows, and must be activated after installation of Professional, Ultimate and Server versions of Windows. 4. Quotas: Disk quotas were introduced in NTFS v3. They allow the administrator of a computer that runs a version of Windows that supports NTFS to set a threshold of disk space that users may use. It also allows administrators to keep track of how much disk space each user is using. Applications that query the amount of free space will also see the amount of free space left to the user who has a quota applied to them. The support of disk quotas is not available in Basic, Home and MediaCenter versions of Windows, and must be activated after installation of Professional, Ultimate and Server versions of Windows.

NTFS also manages the drive in terms of clusters, with cluster size typically 4 KB for disks up to 16 TB. Theoretical maximum limit of drives supported with NTFS is 256 TB with 64 KB cluster size.

Other File Systems – and HFS The ext4 or fourth is a journaling file system for , developed as the successor to . Some of its features include:

1. Large file system: The ext4 filesystem can support volumes with sizes up to 1 exabyte (1018) and files with sizes up to 16 terabytes (1015). 2. Extents: Extents the traditional mapping scheme used by /3 filesystems. An is a range of contiguous physical blocks, improving large file performance and reducing fragmentation. A single extent in ext4 can map up to 128 MB of contiguous space with a 4 KB block size. 3. Delayed allocation: Ext4 uses a filesystem performance technique called allocate-on-flush, also known as delayed allocation. It consists of delaying block allocation until the data is going to be written to the disk, unlike some other file systems, which may allocate the necessary blocks before that step. This improves performance and reduces fragmentation by improving block allocation decisions based on the actual . 4. Break 32,000 subdirectory limit: In ext3 the number of subdirectories that a directory can contain is limited to 32,000. This limit has been raised to 64,000 in ext4

HFS Plus or HFS+ is a file system developed by Apple Inc. to replace their (HFS) as the primary file system used in computers (or other systems running Mac OS). It is also one of the formats used by the iPod digital music player. HFS Plus volumes are divided into sectors (called logical blocks in HFS), which are usually 512 in size. These sectors are then grouped together into allocation blocks, which can contain one or more sectors; the number of allocation blocks depends on the total size of the volume. HFS Plus uses a larger value to address allocation blocks than HFS, 32 bits rather than 16 bits; this means it can access 4,294,967,296 (= 232) allocation blocks rather than the 65,536 (= 216) allocation blocks available to HFS.

Resources: http://www.ntfs.com/fat-systems.htm http://www.mrkay.org/zenpc/ref/hdd/file/partSlack-c.html http://en.wikipedia.org/wiki/NTFS http://en.wikipedia.org/wiki/Ext4 http://en.wikipedia.org/wiki/HFS_Plus