Martin Pool's blog

rsync trick of the day

I have all the ISOs for a previous release of software, and I want to get the next release from a remote machine. Since some packages probably have not changed, I want to use rsync to find the common parts and avoid transferring them.

mkchdir rhel4b1
cat ../rhel4a4/*.iso > nahant-ia64-AS-disc1.iso
cp nahant-ia64-AS-disc1.iso nahant-ia64-disc2.iso
cp nahant-ia64-AS-disc1.iso nahant-ia64-disc3.iso
cp nahant-ia64-AS-disc1.iso nahant-ia64-disc4.iso
cp nahant-ia64-AS-disc1.iso nahant-ia64-disc5.iso
rsync -avP remote::iso/rhel4b1/ ./

This uses a lot of disk while making the big temporary files but allows rsync to find matches even for data that has moved between disks.

If you do this, try not to interrupt rsync in the middle of the transfer. It will recover, but it will throw away all of the basis data for the iso that was in flight.

On reflection I think we can be even more clever by making hardlinks rather than copies for each disk. rsync will use the concatenated version for a basis version, and then break the link for the updated version.

Archives 2008: Apr Feb 2007: Jul May Feb Jan 2006: Dec Nov Oct Sep Aug Jul Jun Jan 2005: Sep Aug Jul Jun May Apr Mar Feb Jan 2004: Dec Nov Oct Sep Aug Jul Jun May Apr Mar Feb Jan 2003: Dec Nov Oct Sep Aug Jul Jun May