[CentOS-mirror] Reposync or rsync - What's the best for creating a local mirror

Wed May 23 06:16:57 UTC 2018
Anssi Johansson <avij at centosproject.org>

Jörg Kastning kirjoitti 23.5.2018 klo 8.59:
> Hi all,
> 
> I'm going to create a local mirror using information found on: 
> https://wiki.centos.org/HowTos/CreateLocalMirror
> 
>  From the I know that I could use reposync or an rsync script to sync my 
> mirror. But I'm not sure what the pros and cons of either method are.
> 
> As far as I know I have to choose one specific mirror nearby when using 
> rsync. If this mirror is not available I have to change my script to use 
> another one.
> 
> Using reposync I guess it would choose the fastest mirror from the 
> configured yum repos of my installation.
> 
> Please correct me, if I'm wrong in my assumptions.
> 
> Maybe in the future I would like to provide a public mirror. Is there 
> any preferred sync method for this scenario?

For public mirrors you should use rsync. reposync will not sync non-rpm 
files, such as .iso images. Using reposync would also break the signed 
metadata (repomd.xml.asc), and arranging the mirror layout would be 
unnecessarily difficult with reposync. Reposync doesn't know about hard 
links either. So the tool to use for public mirrors is rsync.

For a private mirror either one will work, but I prefer using rsync for 
my own private mirror due to the layout matching what is on other 
mirrors. The upstream mirrors won't change that often, so I don't think 
you would need to change that URL that often. And if you're planning to 
provide a public mirror at some point, I'd suggest going straight to 
rsync and skipping reposync.

If you don't need all the files from the mirrors, you can --exclude 
them, like --exclude '*/cloud/*'

You may want to use -v --dry-run first to see which files would get 
transferred.