5

I use the following rsync command to backup my local folder ~/dir1 to a remote backup server:

rsync -a ~/dir1 username@remote_host:destination_directory

As per my understanding it's incremental backup; please correct if I've misunderstood.

How can we make differential backup using rsync?

1
  • 1
    What are your expectations for differential and incremental backups? Rightly or wrongly, different people use those words to mean different things. Commented Nov 12, 2015 at 12:40

2 Answers 2

9

rsync always transfers the differences between source and destination to make them the same; so it can be viewed as an incremental backup. However, most people will assume that with an incremental backup you can still access the original backup, i.e. the destination as it was before the rsync run. There are wrapper scripts for rsync available that manage this using either hardlinks or filesystem snapshots. I personally use dirvish, rsnapshot is another. You end up with separate trees, each containing the image of the source at the time of making the backup.

A differential backup consists of only the differences between the original and the backup, which may not be what you want. It is possible to tell rsync to write a batch file containing the updates but not actually updating the destination by using --only-write-batch=FILENAME. That file can then later be used in conjunction with the original destination (full backup) to recreate the situation at the time of writing the differential backup.

2
  • rsync has the --compare-dest/--copy-dest/--link-dest triplet of options which do a similar thing, i.e. create hardlinks instead of a new copy. Commented Nov 12, 2015 at 16:10
  • --link-dest is used by dirvish and rsnapshot, although there is a patch for dirvish to also use filesystem snapshots. Filesystem snapshots are a lot faster and may use less space.
    – wurtel
    Commented Nov 13, 2015 at 7:45
6

It is neither incremental nor differential. You use these terms when describing backup methods.

As rsync is a tool to do sync operations it can be used to do backups.

A differential backup takes a complete copy of a source and with the next run, it only copies what differs from the first copy.

An incremental backup takes a complete copy when it's run first also. With the second run it takes what is different or added compared to the first run. And with the third one it copies the stuff that differs from the second run.

So the difference between the two approaches becomes obvious when you want to do a restore. For a differential backup you need only the base backup and the differential one from the date you want to restore, while with a restore from an incremental backup , you need to have the whole chain of incremental backups.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .