lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Feb 20, 2017 at 11:31 PM Derek Bailey <dbaileychess@gmail.com> wrote:
The 'true.lua' file still takes a non-zero and non-trivial size on disk due to the inode structure.

Not necessarily. On my Windows 10 machine, I created an empty text file, right-clicked on it, and selected Properties. Windows reported that the file size was "0 bytes" and that the file's size on disk (the actual space taken up by whatever NTFS uses in place of inodes) was also "0 bytes". I gradually added small chunks of text to the file, 10 and 20 bytes at a time, and was able to get the raw file size up into the three digits of bytes before the size on disk jumped to "4.00 KB". (Multiple trials, both with the same file and newly created files, produced substantially different thresholds where this happened, but generally it was between 300 and 700 bytes.)

So the NTFS filesystem apparently does not use an inode-equivalent at all for sufficiently small files, but finds another way to store the data instead. Strictly speaking, the total space taken up by an empty file is still non-zero, because the file has to be recorded in the directory, but I would say that that is trivial, as the amount of free space on the drive will generally be the same both before and after the creation of said file. (I don't know a lot about filesystems, but I would assume the creation of the file could consume free space if the addition of that file to the directory's record pushed the size of the directory over the size of an inode, or in the case of NTFS, whatever its equivalent is, which appears to be 4KB. But I assume this is unlikely.)