billw2 / rpi-clone

A shell script to clone a booted disk.
BSD 3-Clause "New" or "Revised" License
2.56k stars 333 forks source link

"Clone" without overwriting newer files on destination #43

Closed thediveo closed 7 years ago

thediveo commented 7 years ago

rpi-clone does exactly what it says: it clones. But as it in fact does a delta update when possible, I like to use it because it allows me to quickly create clones without having to wait for a full clone. I'm using rpi-clone in two different scenarios: first, for creating bootable backups; second, for creating cloned cards so I can have multiple Pi's running the same configuration.

Unfortunately, that needs manual intervention after each clone cycle, in order to adjust the hostname. It would be helpful if rpi-clone could run rsync in a way that it updates files that are newer on the source, but doesn't touch files that have been changed in the clone afterwards. If I'm not mistaken, this would allow me to create the initial cloned copy, then change the hostname in the clone, and on every subsequent clone update the hostname would not be copied over from the source anymore.

Is this feasible? (using the -u option to rsync?)

billw2 commented 7 years ago

The new version runs a setup script for setting hostname and using -u could lead to unpredictable other issues so I don't think it's a good idea.