Backup - rsync or tar [closed]
Definitely rsync
.
The advantage of rsync is that it will copy only the files which have changed.
If you have 100GB+ of relatively small files, you don't want to copy them all each time.
Note: the first backup with rsync
will be slow because all files are copied. Subsequently only the changed files are copied, and they can be compressed during the copy.
Be sure to familiarise yourself with all the options of rsync
... there are many.
Tar is an archive utility. You could conceivably create a tar file for the entire 100GB+, but you don't want to transfer it all, each time.
I would like to add that, although in general I agree with pavium's reply and I would choose rsync
, there are options in tar
for incremental backups. From man:
-g, --listed-incremental F create/list/extract new GNU-format incremental backup
-G, --incremental
create/list/extract old GNU-format incremental backup
EDIT: Following a recent comment, I will further expand on how both backups work:
tar
initially creates a large file, possibly compressed (-g
gzip flag) with all backed up files. Then each incremental backup creates a new file only with the modified files, in which it also specifies which of them have been deleted.
rsync
on the other hand initially keeps a second mirror directory with the exact tree and files of the source directory, uncompressed. Then with every incremental backup (-B
flag), it continues to have a mirror copy of the source, keeping in another directory by date all changed files (both modified and deleted).
Therefore, one can understand that each method has its plus and minus. A tar
backup is more difficult to be maintained in a medium with limited capacity, as it happens with the classic incremental method. rsync
is not considered a classic backup solution. It requires more disk space for the mirror, since it is uncompressed. It requires more time to reconstruct a full backup of a previous date.
UPDATE: Since Mar 2016 a newer alternative came up: borg backup. I very strongly recommend it. It uses the 'deduplicating' method. More information on the link provided above.
rsync can be somewhat painful if you have a very large number of files - especially if your rsync version is lower than 3. On the other hand: if you use tar, you would generate a very big resulting tar-file (unless the data may be compressed a lot). Personally, I would look at rdiff-backup, but make sure that you test your restore situation: rdiff-backup can be very memory demanding when restoring.