- Interface Properties
- Case-sensitive (like Unix).
- But the Win32 wrapper on top is not.
- Names in Unicode.
- Files are collections of several attributes.
- Each attribute value is a stream of bytes.
- An unnamed attribute is the file contents.
- Any number of additional streams, usually small, but may be any size.
- Allow recording of metadata and support information, such as
image thumbs.
- Many aps are careless with alternate streams, and lose them.
- Hard links and soft links.
- Hard links only exposed in the Posix subsystem.
- Soft links only for administrators.
I believe Windows shortcuts are above the FS.
- Note that Windows has a Posix mode in which more Unix-like features
of NTFS are exposed.
- Volume layout
MFT = Master File Table.
- Each volume is a series of blocks. Sizes vary with the size of
the partition, but 4K is common.
- Blocks identified by offset from the start.
- Boot block contains pointer to the MFT, which may be anywhere.
- The Master File Table (MFT).
- MFT is a series of 1K records.
- Each record describes one file, analogous to a Unix i-node.
- The first 16 entries are special-use files.
- MFT itself.
- Mirror copy of MFT, for reliability.
- The log file (journal).
- Volume information: size, label, version, etc.
- Attributes definitions.
- Root directory.
- Bitmap of used blocks.
- Bootstrap loader (first code to run?).
- Bad block list. These should not be used in a file.
- Security descriptors.
- Case mapping (not trivial for some languages).
- Directory containing extensions.
12-15. Reserved for future use.
- MFT Entries (fixed 1K each)
- Starts with a header, followed by a series of attribute records,
- Each attribute has an identifying code and some content.
- Attributes appear in a fixed order; some may repeat. All need not
be present.
- Attribute records are of variable length.
- Depending on size, the attribute value may be recorded
- Directly in the attribute record.
- In the the data section, with the location given in the attribute
record.
Nonresident attribute
Attribute types
- Security information used to be in an attribute, was moved to the
single security file to save space.
- The Data attribute is a file contents. More than one may appear;
any additional data streams must have a name.
- Directories are files
- Like other systems, directories are essentially files, but there are
special attributes used just for them.
- Small directories are simple lists, but large directories are
B+ trees.
- Storage Allocation
- Basic block size typically 4K.
- Blocks are allocated in contiguous groups when possible, called extents.
- Attribute values are stored in one of three ways:
- Inside the attribute record, if very small.
- If larger, the attribute contains a list of extents where the data
resides. Each extent is given as a
start location and size.
- If still larger, the attribute record refers to a different MFT
record containing only the attribute, giving much more room for
extent records. Any number of these may be used.
- Reparse points
- Associate a path with arbitrary code that executes when the
link is used.
- Applications may use this to build FS extensions.
- Microsoft uses it to create several additional features, including
- Symbolic links.
- Volume mount points, like Unix mount points.
- Management is essentially an indexed system where the storage blocks
can vary in size.
- If an MFT record cannot hold enough runs, MFTs can be chained.
[source].
- The starting MFT holds the usual metadata.
- Gives the location of a second MFT dedicated to runs.
- This can be generalized both by adding indirect MFTs to the first,
or adding double (or more?) indirect MFT indexes. Forms a tree
similar to Unix's, but without a pre-determined shape.
- Files can be marked for compression.
- NTFS attempts to compress each 16-block group.
- If it get smaller, store compressed.
- If it doesn't, store uncompressed.
- Directories can be marked for encryption.
- All files placed there are encrypted.
- NTFS doesn't perform the encryption, but uses call-backs.
- A registers the callbacks.
Refs: Textbook,
http://www.dewassoc.com/kbase/windows_nt/ntfs_directories_and_files.htm,
http://kcall.co.uk/ntfs/index.html,
https://support.microsoft.com/en-us/help/140365/default-cluster-size-for-ntfs-fat-and-exfat