Search code examples
fileoperating-systemfilesystemsfilesize

Can the file size differ between two file systems within the same OS?


I know that the same file will have a different size in Linux and Windows because of how the two OS define kilobyte. I wanted to know whether a file within the same OS(say Windows) will have different sizes on two drives with a different file system (say NTFS vs FAT).


Solution

  • Files generally have two file sizes.

    1. The size of the data in the file. This will be the same on most file systems.

    2. The amount of disk space required to store the file.

    The latter includes space required for overhead and unused allocations. In the case of overhead, you can have things like links to file extents and some file systems include indices and record counts. That overhead can vary on file system.

    In the latter, disk space is allocated in clusters (which are multiples of the block size). The sized file can have different numbers of clusters if the cluster size is different or something in the overhead (e.g. file fragmentation) causes the file to require more clusters.