Rsync vs TAR Backup CentOS Linux.
*** NOT RESPONSIBLE FOR ANY DATA LOSS,USE AT YOUR OWN RISK!!!! ***
here’s a debate that’s old as time, i figured i would revive it again. There’s Rsync, and TAR (Tape ARchive) While both have strengths and weaknesses, we will demonstrate how to use the both of them for their strengths
TAR: Tar’s Strengths come in Compressing/Archiving, and making long-term backups. Although it has an incremental functionality, we do not recommend to use it, especially if you have a small vg_root. Here’s a basic example as to how it works:
tar -cvpzf /backup/path/ROOT.tar.gz /root
this is the most basic way to use tar to backup /root
cvpzf is for “copy, verbose, perserve-permissions, compress(z)”
this works wonderful, however the downside is that it’s difficult to script (usually it’s /sourcedir /destdir)
additionally TAR uses ALL available CPU when a backup job is running, so it’s best to do off-hours
rsync has many wonderful tools that make it a great candidate for backups. Rsync works WELL for checking incremental changes between source/destination
here’s a look at a basic rsync command/script:
rsync -avzW –delete –force /etc /Backups
the options “archive,verbose,compressed(z), and W for whole files with the addition of –delete –force allow you to sync source/destination and delete files on the destination that were deleted from the original source, so you’re not backing up deleted data.
Rsync also works well for NAS/SANs for onsite and offsite replication because of it’s incremental syncing capabilities.
One of the downsides to RSYNC is this example:
foldera has 500GB file in it, you rename it to “folderb”
RSYNC is going to start a new sync for “folderb” rather than just changing the name of foldera, it will sync 500GB folderb and then remove/delte foldera.
also rsync does not compress close to the same level as TAR
Both TAR and Rsync have great feature sets for different types of backups. Rsync is best used for File Servers, or other areas that there are large data sets with minimal changes. For Long term archiving, and daily backups, TAR is generally the best, and will save you lots of space on your backups to use for other great things.
To get a hosted Linux server visit www.zwiegnet.com/go to get started today