Monday, January 25, 2016

How can a file's "size on disk" be zero when it contains some data?

I recently wrote an answer to this Super User question that asked why a certain file's "size on disk" value (in the Properties window) was zero despite there being data in the file.

That phenomenon can be caused by several things, but only one of the causes will be commonly encountered by people who aren't server operators, and that cause is NTFS "resident storage." Every file record in NTFS is exactly 1KB, but not all of that space is always used up for file system bookkeeping. Therefore, to save disk space, NTFS keeps the data of small files right inside the file record. That is, no clusters - 4KB chunks in which file data is stored outside of the bookkeeping records - are allocated. Microsoft's "Ask the Core Team" blog did a piece on the growth of NTFS files, which is a great read.

Another possible cause of zero size-on-disk is Windows data deduplication, a relatively new file system feature that moves identical chunks of files out of the file data and into a special store. When a file is an exact duplicate of another, no new clusters have to be allocated.

No comments:

Post a Comment