Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

diskspace

ntfs

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?

like image 914
Ming Dong Avatar asked Apr 10 '14 16:04

Ming Dong


1 Answers

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.

like image 185
Robert Goldwein Avatar answered Oct 24 '22 11:10

Robert Goldwein