Linux How to zip/archive your rsync backups



This tutorial will show you how to zip files before backing them up through rsync.  Scripting rsync to backup your zipped data as opposed to unzipped files will make little difference on the speed of synchronization, on rsync’s end anyway.  Zipping files could take a while, because there is no (as far as I know) way to incrementally zip files.
So, if you have 100 GB of files, and want to zip them up before using rsync to back them up, you’d need to re-zip that 100 GB every time you run your script.  rsync can perform incremental backups even with zip files, only transferring the changed data, so the only speed hindrance you may experience is in the zipping process itself.
I’m going to show you the command that can be used to zip your backups before rsync, working with three directories: MyFiles, MyBackups, MyZips.
zip ~/MyZips/files.zip ~/MyFiles/ && rsync -av –delete ~/MyZips/ ~/MyBackups/
Dissecting the command above, the zip command puts the files within MyFiles inside ~/MyZips/files.zip and then passes it to rsync, which syncs the data between MyZipsand MyBackups.
The -av –delete parts of the above command are just switches that I choose to use for my personal preference, more can be found out about them via man rsync.

Post a Comment

Previous Post Next Post