💻

Understanding Windows Disk Size Metrics

Jun 2, 2025

Windows Confidential: Size on Disk

Introduction

  • Author: Raymond Chen
  • Date: August 31, 2016
  • Main Topic: Understanding the difference between "Size" and "Size on Disk" for folders in Windows.

Overview of Folder Size Measurement

Size vs. Size on Disk

  • Size: A tally of the file sizes as per WIN32_FIND_DATA.nFileSizeLow and nFileSizeHigh.
    • May not be accurate if the file is being written to and not yet closed.
  • Size on Disk: More complex and considers if the file is compressed or sparse.
    • Uses GetCompressedFileSize for compressed or sparse files.
    • For non-compressed/sparse files, the size is rounded up to the nearest cluster.

Recursive Directory Search

  • Conducts a naive search for files, skipping hard links and inaccessible subdirectories.
  • Reparse points are detected and not recursed into.
  • Symbolic links are counted with zero size.

Historical Background

  • The algorithm initially developed by the Windows 95 team based on MS-DOS and FAT file systems.
  • Assumptions do not directly apply to NTFS, where files can use zero clusters by utilizing slack space in MFT.

Limitations of the Size on Disk Calculation

  • Does not account for file system overhead such as metadata or alternate data streams.
  • Not a precise byte-for-byte measure of disk space impact.
  • Assumes files are of the "boring" variety (no hard links, minimal alternate data streams).
  • Can be inaccurate in directories with numerous hard links (e.g., Windows directory).

Recommendations

  • Use "Size on Disk" for rough estimates only.
  • For precise disk usage tracking, utilize features like Disk Quotas.

Related Content

  • Articles on Windows Restore, Uninstall processes, and directory navigation history.

Author's Information

  • Raymond Chen's website and book: "The Old New Thing"
  • Focus on Windows history, Win32 programming, and light-hearted content.

Conclusion

  • Understanding the limitations and nuances of "Size" and "Size on Disk" can help in better managing disk space and expectations regarding file storage.

Additional Resources

  • Explore previous versions and additional technical content on Microsoft's platform.

These notes summarize the key points discussed in the article on the measurement of file sizes in Windows and the intricacies of how they are reported.