I'm trying to setup a simple back-up script using rsync and ssh that is supposed to back up my stuff to a server.
To save space in the server drive, I use the --link-dest option with the latest backup so that repeated files are just hardlinked to previous ones, so the actual rsync command will look like
rsync -av -e ssh --link-dest=user@server:/home/user/backups/previous /home/user/tobackup/ user@server:/home/user/backups/current
This is just 'paraphrased' since the script takes care of what files to backup and how to deal with what the 'current' and 'previous' directories are.
My question is, since the comparison of a given file is made against the one backed in the server, I guess rsync needs to actually send it first, then compare it, and then either save it if it's new or changed, or delete it and save a hardlink if it's unchanged? Or is the comparison somehow made without sending the file?
The reason for my question is that if the backup is big, I'd like for big unchanged files to not have to be sent, only to find they're unchanged. I don't know how rsync does this and haven't been able to find it in its documentation, so it'd be great to know if it does it and I can expect all files to be sent over the network for every single backup, or if rsync is only going to send the unchanged ones.
Obviously alternative methods are welcome if my initial idea is for some reason flawed from the start.
man rsync
as it's actually a versatile application. I often cheat and use luckyBackup to craft advanced rsync commands. Set it up, click validate, and it gives you the command. I'm just not comfortable trying to explain the algorithm as I've never really studied it.