rsync strange behaviour

pagani laurent laurent.pagani at laposte.net
Thu Oct 26 13:17:31 UTC 2017


I am not sure to know which flag did the trick, but indeed now my Application Folder is 22 Gb like in the internal drive.
Thanks a lot


> Le 26 oct. 2017 à 14:19, Jim Jagielski <jimjag at gmail.com> a écrit :
> 
> When using rsync on HFS+, I tend to always use the following options:
> 
>     rsync --archive --crtimes --hard-links --acls --xattrs --fileflags --force-change --protect-decmpfs
> 
> On Thu, Oct 26, 2017 at 6:22 AM, Ryan Schmidt <ryandesign at macports.org <mailto:ryandesign at macports.org>> wrote:
> 
> On Oct 26, 2017, at 04:28, pagani laurent wrote:
> 
> >> 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.
> >
> > Did not work. I erased Xcode again and rsync’ed it with —hard-links. Size remains the same. 12 Gb instead of 7.8 local.
> 
> I can only confirm your observation. My original Xcode.app is "10,581,631,771 bytes (5.76 GB on disk)" according to the Finder's Get Info window, while an rsync'd copy with --hard-links is "10,511,782,504 bytes (11.12 GB on disk)". As a result, I now question whether it's possible to create an accurate copy of a macOS disk using rsync.
> 
> The rsync manpage mentions --hard-links not being a default because finding hard links is expensive. Maybe there is an upper limit to the number or size of files rsync is willing to analyze to find hard links; if so, maybe what we're doing exceeds that limit.
> 
> Maybe Xcode and other things on your original disk are making use of directory hard links, a feature Apple implemented so that Time Machine could be more efficient, but which rsync doesn't know about. I read about this here:
> 
> https://arstechnica.com/civis/viewtopic.php?f=20&t=1108222 <https://arstechnica.com/civis/viewtopic.php?f=20&t=1108222>
> 
> It's also mentioned there that you can use "cpio -pdl" somehow to reunite inadvertently duplicated files with one another as hard links, though I'm not sure what it will do if you have any identical files that are supposed to remain unlinked.
> 
> 
> 

"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème" (devise Shadok)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20171026/65f0252d/attachment.html>


More information about the macports-users mailing list