rsync strange behaviour

Ryan Schmidt ryandesign at macports.org
Thu Oct 26 09:01:18 UTC 2017


On Oct 26, 2017, at 03:10, pagani laurent wrote:

> I use the Macports rsync to make a carbon copy of my internal drive onto an external one.
> 
> I find that the external one takes more room than the internal one : 470 Gb against 455 Gb.
> Both drives are declared in the Mac OS extended Journalized (whatever it is called in English). The external is HD, internall SSD.
> Looking in detail at the files, I find that the /Users is using the same size almost : 347 and 348 Gb (no yet rsynced today), but
> the /Applications use 22 Gb internal and 27 Gb external, e.g. /Library use the same 6.8 Gb, etc… So some directories occupy the same volumes, others don’t.
> In particular, I found that Xcode is 7.8 Gb internal and 12 Gb external, among which Xcode.app/Contents/Developper was the main difference (7.1 and 11 Gb) but other dirs are either identical or twice the same size : Frameworks are 58 and 128 Mb, Resources are 109 and 111 Mb.
> To be sure, I erased the Xcode.app/Contents/Developper in my external disk and launched rsync which rebuilt it back to 12 Gb of space!
> 
> So it is not a question of granularity I would say but why rsync is making some files bigger when copied outside ? I don’t think it is a bug so no track ticket but if someone knows the explanation, I am eager to hear it.

My first guess would be that some items on your internal drive are hardlinked, and that when you rsync, those items are being created on the external drive as separate files with each copy taking up space. And I can confirm by inspection that there are many hardlinked items inside the Xcode 9 app, for example. There's a flag you can supply to rsync ("--hard-links") to tell it to detect and recreate hard links on the destination drive, which should eliminate this reason for the size difference.

I also thought of different block sizes, but ever since HFS+ in Mac OS 8.1 block sizes are probably the same on all drives so that's unlikely to be relevant.




More information about the macports-users mailing list