NTFS File Attributes

NTFS views each file (or directory) 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 be written 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 a file is too large to fit all of its attributes in the MFT file record, some of its attributes are nonresident. The nonresident attributes are allocated one or more runs of disk space elsewhere in the volume. (A run of disk space is a contiguous linear area on the disk.)

In general, all attributes can be referenced as a stream of bytes whether they are resident or nonresident.

Table 5.1 lists all of the file attributes currently defined by NTFS. This list is extensible, meaning that other file attributes can be defined in the future.

Table 5.1 NTFS File Attribute Types

Attribute type

Description

Standard Information

Includes time stamps, link count, and so on.

Attribute List

Lists all other attributes in large files only.

Filename

A repeatable attribute for both long and short filenames. The long name of the file can be up to 255 Unicode characters. The short name is the MS-DOS-readable, eight-plus-three, case-insensitive name for this file. Additional names, or hard links, required by POSIX may also be included as additional Filename attributes.

Security Descriptor

Shows information about who can access the file, who owns the file, and so on.

Data

Contains file data. NTFS allows for multiple data attributes per file. Each file typically has one unnamed data attribute. In addition, a file can have one or more named data attributes, using a particular syntax.

Index Root

Used to implement directories.

Index Allocation

Used to implement directories.

Volume Information

Used only in the volume system file and includes, among other things, the version and name of the volume.

Bitmap

Provides a map representing records in use on the MFT or directory.

Extended Attribute Information

Used by file servers that are linked with OS/2 systems. This attribute type isn't useful to Windows NT.

Extended Attributes

Used by file servers that are linked with OS/2 systems. This attribute type isn't useful to Windows NT.


Long and Short Filenames

One of the improvements HPFS implemented on the MS-DOS design was the ability to use long filenames of up to 255 characters. Unfortunately, files with long names on an HPFS volume couldn't be accessed from an MS-DOS operating system, which has an eight-plus-three filename limitation.

Like HPFS, NTFS allows filenames of up to 255 characters. NTFS filenames use the 16-bit Unicode character set but solve the problem of access from MS-DOS. NTFS automatically generates an MS-DOS – readable (eight-plus-three) name for each file. This way, NTFS files are accessible over a network by the MS-DOS and OS/2 operating systems. This is a particularly important feature for file servers, especially in an office using personal computers with two or all three of these operating systems.

By creating eight-plus-three filenames for files, NTFS also allows MS-DOS – based and Windows-based 3.x applications to recognize and load files that have NTFS long filenames. In addition, when an MS-DOS-based or Windows-based 3.x application saves a file on an NTFS volume, both the eight-plus-three filename and NTFS long filename are retained.

Note When saving a file from an MS-DOS – based or Windows-based 3.x application on an NTFS volume, if that application saves to a temporary file, deletes the original file, and renames the temporary file to the original filename, the long filename is lost. Any unique permissions set on that file are also lost. Permissions are propagated again from the parent directory.

If the long name of a file or directory on an NTFS volume contains spaces, be sure to surround the path name with quotation marks. This is true when specifying a path in Program Manager for the application's icon. For example, suppose Word for Windows is installed in D:\Word for Windows. The Program Item Properties Command Line should be set to d:\Word for Windows\winword.exe. If the quotation marks were omitted, an error message would display, saying "The path D:\Word is invalid."

This is also true when a path typed at the command line includes spaces, as in the following example:


move "c:\This month's reports\*.*" "c:\Last month's reports"„

Note

Remember to use wildcards such as * and ? carefully in conjunction with the del and copy commands. NTFS searches both long and short filenames for matches to the wildcard combination you specify, which may cause extra files to be deleted or copied.

To copy or move files with case-sensitive long filenames, it is safest to select the files using a mouse in File Manager. That way, you can clearly identify which files you want to copy or move.

Beginning with Windows NT 3.5, files created or renamed on FAT partitions can also have associated long filenames. The rules governing long filenames on NTFS volumes also apply to long filenames on FAT partitions except that filenames on FAT can contain extended characters. For more information about long-filename support on FAT partitions, see "FAT File System" earlier in this chapter.

Generating Short Filenames

Because NTFS uses the Unicode character set for its names, there are potentially several "illegal" characters that MS-DOS cannot read in any filename. To generate a short MS-DOS – readable filename for a file, NTFS deletes all of these characters from the long filename and removes any spaces. Since an MS-DOS – readable filename can have only one period, NTFS also removes all extra periods from the filename. Next, NTFS truncates the filename, if necessary, to six characters and appends a tilde (~) and a number. For example, each nonduplicate filename is appended with ~1. Duplicate filenames end with ~2, ~3, and so on. Filename extensions are truncated to three or fewer characters. Finally, when displaying filenames at the command line, NTFS translates all characters in the filename and extension to uppercase. (File Manager displays these filenames as lowercase.)

Windows NT 3.5 uses a slightly different method for creating short filenames when there are five or more files that would result in duplicate short filenames. For the fifth and subsequent files, Windows NT uses only the first two letters of the long filename and then generates the next four letters of the short filename by mathematically manipulating the remaining letters of the long filename, appending ~5 (or another number if necessary to avoid a duplicate filename) to the result. This method provides substantially improved performance when Windows NT must create short filenames for a large number of files with similar long filenames. Windows NT uses this method to create short filenames for both FAT and NTFS volumes.

By default, Windows NT 3.5 supports MS-DOS–readable filenames on all NTFS volumes. To improve performance on volumes with many long, similar names, you can disable this feature on all volumes. To disable short filename support on all NTFS volumes, set the NtfsDisable8dot3NameCreation parameter of the following Registry entry to 1:


HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem

Windows NT does not generate short (eight-plus-three) filenames for files created by POSIX applications on an NTFS partition. This means that MS-DOS – based and Windows-based applications cannot view these filenames if they are not valid eight-plus-three filenames. If you want to use files that are created by a POSIX application with MS-DOS – based or Windows-based applications, be sure to use standard MS-DOS eight-plus-three naming conventions.

Viewing Short Filenames

Both File Manager and the dir command are able to display either the long NTFS filenames or the short MS-DOS – readable filenames, so you can look up and manipulate files using either long or short filenames.

To see short filenames from File Manager, choose Full File Details.

From the command line, to see both the long and short filenames for each file in the directory, type the following command:


dir /x

Tip To display both long and short filenames automatically, use the System application in Control Panel to set the dircmd variable to the value /x.

Multiple Data Streams

NTFS supports multiple data streams. The stream name identifies a new data attribute on the file. Streams have separate opportunistic locks, file locks, allocation sizes, and file sizes, but sharing is per file.

The following is an example of an alternate stream:


myfile.dat:stream2

This feature permits related data to be managed as a single unit. For example, Macintosh computers use this type of structure to manage resource and data forks. Or, a company might create a program to keep a list of changes to the file in an alternate stream, thus keeping archive information with the current version of the file.

As another example, a library of files might exist where the files are defined as alternate streams, as in the following example:


library:file1
       :file2
       :file3

Suppose a "smart" compiler creates a file structure like the following example:


program:source_file
       :doc_file
       :object_file
       :executable_file

Note Because NTFS is not supported on floppy disks, when you copy an NTFS file to a floppy disk, data streams and other attributes not supported by FAT are lost.

POSIX Compliance

POSIX compliance permits UNIX applications to be ported to Windows NT. Windows NT is fully compliant with the Institute of Electrical and Electronic Engineers (IEEE) standard 1003.1, which is a standard for file naming and identification.

The following POSIX-compliant features are included in NTFS:

Caution

POSIX applications create case-sensitive filenames where two or more filenames can differ only in case (for example, annm.doc and AnnM.Doc).

While NTFS supports both case-preservation and case-sensitivity, you cannot use standard commands with NTFS to manage filenames that differ only in case. (Standard commands include those used at the command-line — such as copy, del, and move — and their File Manager equivalents.) For example, both annm.doc and AnnM.Doc are deleted if you type the following at the command prompt:

del AnnM.Doc

You must use POSIX applications to manage filenames that differ only in case.

For related information, see the section on the POSIX subsystem in Chapter 1, "Windows NT Architecture" and Chapter 17, "POSIX Compatibility."

NTFS Features Used by Macintosh Services Clients

Services for Macintosh is included with Windows NT Server. These services give Macintosh users access to files residing on a Windows NT Server, and since these files are available to Windows NT network users, the file server can be easily used for sharing files across platforms.

You must make an NTFS partition available when you enable Services for Macintosh if you want to automatically create the User Authentication Module volumes for Macintosh clients. (The Network Control Panel uses the first NTFS partition to create these default volumes.)

Macintosh clients can use only files on NTFS volumes. Macintosh resource forks and the Finder information for each Macintosh file are stored as NTFS streams. Because NTFS also supports long names, most Macintosh filenames are preserved.

Services for Macintosh stores File Sharing folder privileges as Windows NT permissions, meaning that there is only one set of permissions on a folder or file, which is enforced both for Windows NT users and Macintosh users. However, Macintosh users cannot see file permissions, since AppleShare® supports only folder permissions.

For more information about Services for Macintosh, see Windows NT Server Services for Macintosh.