The size of a file is amount of data (in bytes) that it contains. The size of a folder is the total size of all its files. But the space consumed on disk is nearly always a bit different and can be considerably different.
Some reasons for disk space being larger than file size:
- Small files consume 4K (most obvious in programming project files);
- file extended attributes.
Some reasons for disk space being smaller than file size:
- File compression;
- Sparse files which don't use disk for empty blocks.
Some reasons for disk space being smaller than folder size:
- Duplicates of files within a folder, share the same space on disk;
- Clones where parts of a file may share space with other files in the folder.
Most of the time we should not worry about the difference.
But clones and duplicates become an issue when copying files and folders between file systems as each file will now consume its full disk space on the destination.