10

I found there are some files on my disk, which
1) the real size is not zero, but it is small, around 500 bytes
2) the "size on disk" shows zero when you check its properties
3) if I make the file smaller, the "size on disk" is still 0
4) if I make the file bigger, even 1 bytes bigger, the size on disk will change to 4096
5) the disk is not compressed

How it is possible? My os is windows 8.1: Is this a new feature in windows 8?
Is windows 8 so smart that it can merge those small files into one disk sector?

Can anybody confirm this?

And if it is a new feature, how to disable it?

2 Answers 2

21

Files in NTFS consist of (at least one) file record in the master file record table (called MFT - each file record consists of attributes like name, file information, etc.) Data are usually located in one or more clusters on disk. The file record in the MFT contains references to those clusters (called a non-resident attribute). When the data size is really small, even its data are within the MFT record - the data attribute is resident. Thus NTFS doesn't have to allocate any clusters. Size on disk is the number of allocated clusters * size of a cluster, so if the data attribute is resident, size on disk is zero. If you reach the maximum size for the file record, the data attribute is made non-resident and NTFS allocates the first cluster, thus size on disk is 1 cluster - 4096 bytes.

1
  • 2
    Correct. The available space in an MFT record depends on the length of filename, the security attributes present, and other (usually rare) factors. In testing, the largest possible resident data is around 700–800 bytes with normal security and filename lengths.
    – wallyk
    Apr 10, 2014 at 17:31
0

This is not specific to Windows 8 (so I modified your question). It is true of all NTFS managed by Microsoft's filesystem driver.

I can't imagine why you would want to disable this type of efficiency: it is a particularly excellent feature since many computer files tend to be small.

I have confirmed that NT versions up to XP NT do not move the data to the MFT record (and release the cluster(s)) if the file shrinks. So you could append some data to such files to make them at least 1024 bytes, and then truncate them back to the original size.

2
  • I want to disable it because sometimes, I need to compare 2 directory, and make sure them exactly same. but this feature make that impossible. I can't control the size on disk for a file. a file is just 1 byte, but it use 4096 bytes on disk, but another file is 500 bytes, but size on disk is zero. it seems there is not a strict rule for size on disk property.
    – Ming Dong
    Apr 11, 2014 at 1:49
  • 5
    @MingDong How does the knowledge of file size on disk help you compare directories? It seems like actual file length would be more useful and more readily available information that you could use before resorting to binary comparisons. Jan 29, 2015 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.