NTFS-specific allocation features

Resident files.

On NTFS, every file has its associated MFT (Master File Table) entry. The MFT entry occupies 1024 bytes of disk space. This entry holds file name, certain file properties like modification date and access permissions. This data typically occupies less than 1024 bytes, so there is some unused space left in the MFT entry. If the file itself is small enough to fit into that unused space, NTFS stores the actual file data inside the MFT entry as well. Such files are called resident.

Now taking this into account, we know that on NTFS

  • Empty files occupy exactly 1024 bytes, regardless of a cluster size.
  • Small (resident) files, for which the size of the file name, file data, and the file properties combined is less than 1024 bytes, also occupy 1024 bytes, regardless of a cluster size.
  • Files which are too large to be stored inside the MFT entry (non-resident files) occupy disk space for their own size, rounded up to the next cluster boundary, plus 1024 bytes for the MFT entry.

NTFS built-in compression. Sparse files.

NTFS file system, used almost exclusively in Windows for any volume larger than 32GB (that is, for anything except flash cards), has a built-in compression feature.

This means the file data is compressed, similar to what ZIP program does, before it gets written to the disk, thus saving disk space. You can save up to 30% by applying the compression, unless the data is already compressed. Video files, MP3, and ZIP archives do not compress at all, and nothing can be gained. The processor effort required to perform compression and decompression is negligible in most applications, especially considering today's vast amounts of processing power.

Files containing large contiguous runs of zeros in them are stored on disk as sparse. In sparse files, zero data is not actually written to the disks. If a program writes a stream of zeros to the file, these are discarded and a reference is stored instead. When this reference is encountered during the read operation, the system generates the stream of zeros of the required size and sends it back to the application.

The use of compression is controlled by user. You can turn the compression on for an entire volume, for a specific folder with subfolders, or even for an individual file. In Windows Explorer, right click the desired object, select "Properties", pick "Advanced", and set "Compress contents to save disk space" checkbox as required. This setting controls both methods described above at the same time. Compressed files are listed in blue color in Windows Explorer.

Continue to Disk space visualization software.