“size on disk” is zero for non-zero file in windows 8?

风流意气都作罢 提交于 2019-12-01 15:19:05

问题


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?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/22994017/size-on-disk-is-zero-for-non-zero-file-in-windows-8

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!