The NTFS file system views each file (or folder) as a set of file attributes. Elements such as the file's name, its security information, and even its data, are all file attributes. Each attribute is identified by an attribute type code and, optionally, an attribute name.
When a file's attributes can fit within the MFT file record, they are called resident attributes. For example, information such as filename and time stamp are always included in the MFT file record. When all of the information for a file is too large to fit in the MFT file record, some of its attributes are non-resident. The non-resident attributes are allocated one or more clusters of disk space elsewhere in the volume. NTFS creates the Attribute List attribute to describe the location of all of the attribute records.
Next table lists all of the file attributes currently defined by the NTFS file system. This list is extensible, meaning that other file attributes can be defined in the future.
|Standard Information||Includes information such as timestamp and link count.|
|Attribute List||Lists the location of all attribute records that do not fit in the MFT record.|
|File Name||A repeatable attribute for both long and short file names. The long name of the file can be up to 255 Unicode characters. The short name is the 8.3, case-insensitive name for the file. Additional names, or hard links, required by POSIX can be included as additional file name attributes.|
|Security Descriptor||Describes who owns the file and who can access it.|
|Data||Contains file data. NTFS allows multiple data attributes per file. Each file typically has one unnamed data attribute. A file can also have one or more named data attributes, each using a particular syntax.|
|Object ID||A volume-unique file identifier. Used by the distributed link tracking service. Not all files have object identifiers.|
|Logged Tool Stream||Similar to a data stream, but operations are logged to the NTFS log file just like NTFS metadata changes. This is used by EFS.|
|Reparse Point||Used for volume mount points. They are also used by Installable File System (IFS) filter drivers to mark certain files as special to that driver.|
|Index Root||Used to implement folders and other indexes.|
|Index Allocation||Used to implement folders and other indexes.|
|Bitmap||Used to implement folders and other indexes.|
|Volume Information||Used only in the $Volume system file. Contains the volume version.|
|Volume Name||Used only in the $Volume system file. Contains the volume label.|
NTFS includes several system files, all of which are hidden from view on the NTFS volume. A system file is one used by the file system to store its metadata and to implement the file system. System files are placed on the volume by the Format utility.
|System File||File Name||MFT Record||Purpose of the File|
|Master file table||$Mft||0||Contains one base file record for each file and folder on an NTFS volume. If the allocation information for a file or folder is too large to fit within a single record, other file records are allocated as well.|
|Master file table 2||$MftMirr||1||A duplicate image of the first four records of the MFT. This file guarantees access to the MFT in case of a single-sector failure.|
|Log file||$LogFile||2||Contains a list of transaction steps used for NTFS recoverability. Log file size depends on the volume size and can be as large as 4 MB. It is used by Windows NT/2000 to restore consistency to NTFS after a system failure.|
|Volume||$Volume||3||Contains information about the volume, such as the volume label and the volume version.|
|Attribute definitions||$AttrDef||4||A table of attribute names, numbers, and descriptions.|
|Root file name index||$||5||The root folder.|
|Cluster bitmap||$Bitmap||6||A representation of the volume showing which clusters are in use.|
|Boot sector||$Boot||7||Includes the BPB used to mount the volume and additional bootstrap loader code used if the volume is bootable.|
|Bad cluster file||$BadClus||8||Contains bad clusters for the volume.|
|Security file||$Secure||9||Contains unique security descriptors for all files within a volume.|
|Upcase table||$Upcase||10||Converts lowercase characters to matching Unicode uppercase characters.|
|NTFS extension file||$Extend||11||Used for various optional extensions such as quotas, reparse point data, and object identifiers.|
|12–15||Reserved for future use.|
NTFS supports multiple data streams, where the stream name identifies a new data attribute on the file. A handle can be opened to each data stream. A data stream, then, is a unique set of file attributes. Streams have separate opportunistic locks, file locks, and sizes, but common permissions.
This feature enables you to manage data as a single unit. The following is an example of an alternate stream:
A library of files might exist where the files are defined as alternate streams, as in the following example:
A file can be associated with more than one application at a time, such as Microsoft ® Word and Microsoft © WordPad. For instance, a file structure like the following illustrates file association, but not multiple files:
To create an alternate data stream, at the command prompt, you can type commands such as:
When you copy an NTFS file to a FAT volume, such as a floppy disk, data streams and other attributes not supported by FAT are lost.
Windows NT/2000 supports compression on individual files, folders, and entire NTFS volumes. Files compressed on an NTFS volume can be read and written by any Windows-based application without first being decompressed by another program. Decompression occurs automatically when the file is read. The file is compressed again when it is closed or saved. Compressed files and folders have an attribute of C when viewed in Windows Explorer.
Only NTFS can read the compressed form of the data. When an application such as Microsoft® Word or an operating system command such as copy requests access to the file, the compression filter driver decompresses the file before making it available. For example, if you copy a compressed file from another Windows NT/2000–based computer to a compressed folder on your hard disk, the file is decompressed when read, copied, and then recompressed when saved.
This compression algorithm is similar to that used by the Windows 98 application DriveSpace 3, with one important difference — the limited functionality compresses the entire primary volume or logical volume. NTFS allows for the compression of an entire volume, of one or more folders within a volume, or even one or more files within a folder of an NTFS volume.
The compression algorithms in NTFS are designed to support cluster sizes of up to 4 KB. When the cluster size is greater than 4 KB on an NTFS volume, none of the NTFS compression functions are available.
Each NTFS data stream contains information that indicates whether any part of the stream is compressed. Individual compressed buffers are identified by “holes” following them in the information stored for that stream. If there is a hole, NTFS automatically decompresses the preceding buffer to fill the hole.
NTFS provides real-time access to a compressed file, decompressing the file when it is opened and compressing it when it is closed. When writing a compressed file, the system reserves disk space for the uncompressed size. The system gets back unused space as each individual compression buffer is compressed.
The Encrypting File System (EFS) provides the core file encryption technology used to store encrypted files on NTFS volumes. EFS keeps files safe from intruders who might gain unauthorized physical access to sensitive, stored data (for example, by stealing a portable computer or external disk drive).
EFS uses symmetric key encryption in conjunction with public key technology to protect files and ensure that only the owner of a file can access it. Users of EFS are issued a digital certificate with a public key and a private key pair. EFS uses the key set for the user who is logged on to the local computer where the private key is stored.
Users work with encrypted files and folders just as they do with any other files and folders. Encryption is transparent to the user who encrypted the file; the system automatically decrypts the file or folder when the user accesses. When the file is saved, encryption is reapplied. However, intruders who try to access the encrypted files or folders receive an "Access denied" message if they try to open, copy, move, or rename the encrypted file or folder.
To encrypt or decrypt a folder or file, set the encryption attribute for folders and files just as you set any other attribute. If you encrypt a folder, all files and subfolders created in the encrypted folder are automatically encrypted. It is recommended that you encrypt at the folder level.
A sparse file has an attribute that causes the I/O subsystem to allocate only meaningful (nonzero) data. Nonzero data is allocated on disk, and non-meaningful data (large strings of data composed of zeros) is not. When a sparse file is read, allocated data is returned as it was stored; non-allocated data is returned, by default, as zeros.
NTFS deallocates sparse data streams and only maintains other data as allocated. When a program accesses a sparse file, the file system yields allocated data as actual data and deallocated data as zeros.
NTFS includes full sparse file support for both compressed and uncompressed files.NTFS handles read operations on sparse files by returning allocated data and sparse data.It is possible to read a sparse file as allocated data and a range of data without retrieving the entire data set,although NTFS returns the entire data set by default.
With the sparse file attribute set, the file system can deallocate data from anywhere in the file and, when an application calls, yield the zero data by range instead of storing and returning the actual data. File system application programming interfaces (APIs) allow for the file to be copied or backed as actual bits and sparse stream ranges.The net result is efficient file system storage and access. Next figure shows how data is stored with and without the sparse file attribute set.
If you copy or move a sparse file to a FAT or a non-Windows 2000 NTFS volume, the file is built to its originally specified size. If the required space is not available, the operation does not complete.
For more detailed information see resource kits on Microsoft Developers Network (MSDN) http://msdn.microsoft.com