16

I have an xml file that windows explorer says is 8.00KB on disk, and the size is 25.5 KB.

How is this possible?

I thought the size on disk is in many cases larger than the actual size (because of the block sizes)?

1

4 Answers 4

20

This would happen if you use NTFS compression to compress the file.

9

You are correct that the size on disk is normally larger. However, sometimes, due to built in compression, the file is actually smaller on the disk.

Source

3

A file can also appear to be smaller on disk if the file is a sparse file. In that scenario, file size refers to the logical size of the file, whereas size on disk refers to the physical size of the sparse file.

5
  • How large is a symbolic link? Is it like on Linux, where it's the same number of bytes as the target filename?
    – wjandrea
    Jul 4, 2018 at 23:26
  • Normally, file size is the size of the file the link is pointing to. That said, NTFS also supports sparse files, which have a larger logical size than physical size.
    – Brian
    Jul 5, 2018 at 13:01
  • sorry, I meant the size on disk
    – wjandrea
    Jul 5, 2018 at 14:30
  • @wjandrea: Everything in my original answer was wrong. Actually, soft symbolic links display 0 bytes for both values (as is usually the case, filesystem data doesn't count towards these values) and hard links use the same numbers as the underlying file for both numbers. I wrote my response after encountering a file that had a smaller size on disk being used to store deltas, but it turned out this file was storing deltas and using a sparse file to avoid using space for data that was unchanged, rather than using a symbolic link (which can't work).
    – Brian
    Jul 5, 2018 at 19:58
  • @wjandrea: On windows vista and higher, you can prove my original answer wrong by using mklink at the command prompt. Make sure your test files are larger than 1K to avoid seeing a zero byte file for other reasons. See also Windows Confidential: Just What Is ‘Size on Disk’?
    – Brian
    Jul 5, 2018 at 20:00
1

If you're using Microsoft OneDrive and some of your files are 'not synced' to disk, then the size of the file on disk will be smaller since the actual information is in the 'cloud' on OneDrive with only a pointer.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .