Differences in size and file count after Synchronizing
Posted by Sven Koester on 16 July 2010 15:47
Often we are asked why after a synchronization the sizes and file counts differ on the two folders, namely on Unix systems. |
This article lists some reasons why that is the case.
Differences in sums of sizes, e..g comparing disk space or file sizes
The disk space consumed by a subtree can be read with the utility du, see man du. The disk usage of a subtree is usually bigger than its actual size and may differ because of the following reasons:
The file sizes of the data in a subtree can be read with the ls command per file, there is no standard Unix mechanism to sum up the file sizes. However the "Get info" function of the Mac finder does something similar. However the file size is usually the pure size of the data, the sizes of file attributes, rights or resource forks are not counted by ls.
- Each filesystem stores files in chains of blocks that have a fix size, blocksizes today vary between 4 KB and 64 KB depending on the file system size. Each file requires at least one block to be stored. So a file that contains "Hello World" and nothing else will require 4 KB on a small file system like a USB stick and 64 KB on a big disk.
- Different file structures (i.e. when there are differences in the file count) may enhance that difference.
- Different file systems may be able or unable to save some specific attributes or parts of a file, e.g. a Linux file system cannot save additional data streams like Mac resource forks. Care must be taken that information is not lost this way.
- There are some further special cases of "invisible" sizes, e.g. folders itself require different amounts of space after copying.
The file size, i.e. the size of the data in the file, should not differ on source and target.
Care must be taken when summing up blindly: When counting on a filesystem with apple double formats, the size of the resource fork is included, otherwise it is not. Namely for afp file server volumes is is not helpful to attempt to sum up the file sizes for an overview.
Differences in the number of files
When comparing the number of files on source and target after a synchronize job is finished, the following effect may lead to different output
- Specially in Mac environments, the apple double format of files causes differences when counting files.