I was searching the net to find a way to do a complete backup of my linux machine (not a server) and restore everything anytime.

I started with the most linked guide on every thread, http://www.mikerubel.org/computers/rsync_snapshots/index.html and I thought that this type of backup was an incremental backup, after another day of research I found What's the differernce between differential and incremental backup in terms of rsync command? and other discussion, but I am not sure what I am really doing.

Following the guide and the posts I decided to try with a single folder (before backup the entire system) called source

rsync -av --delete /home/user/source /home/user/backup/backup0/

then I added and removed some files and did the backup three more times

rsync -avH --delete --link-dest=/home/user/backup/backup0 /home/user/source /home/user/backup/backup1 

rsync -avH --delete --link-dest=/home/user/backup/backup1 /home/user/source /home/user/backup/backup2

rsync -avH --delete --link-dest=/home/user/backup/backup2 /home/user/source /home/user/backup/backup3

I thought that with this type of backup I was going to have something like:


So if I wanted to restore the content of "backup3" the #1 e #2 were needed, but I deleted them and then restored the backup3, and everything was back in place. So I ran

user@user:/backup$ du -sh *
450M    backup0
620K    backup1
624K    backup2
628K    backup3

It looks like a differential backup, not an incremental, but I thought that to be differential I would had to set for every backup --link-dest=/home/user/backup/backup0

My question is: Am I mistaking something? Is there a better way to backup a complete system using rsync?

P.S: the destination device is going to be an external drive with the same filesystem.

  • Rather than rolling your own, use an existing tool such as rsnapshot. Sep 26, 2016 at 23:43
  • @Gilles, I search over all of the most famous backup methods, and I think that is best to use the essential commands and prepare the scripts yourself. It's a personal habit, I want to know exactly what I am doing, so because rsnapshot is based on rsync as other software are, I opted for the core (rsync) of these software. Sep 27, 2016 at 13:39

2 Answers 2


With hardlinks, one can store several copies of a file and it only takes up the disk space of one copy. What you are seeing that du is careful not to double-count the space taken up by multiple hard links to the same file.

If you were to run:

du -sh backup3

you would find that backup3 takes up 450M or so. If you run:

du -sh backup2 backup3

you would find that backup2 takes up about 450M while backup3 takes up very little. That is because du looked through backup2 first and counted its space. When it looked through backup3, it only counted new disk space used and not the hardlinks to files that had already been counted in backup2.

Each backup is complete and has everything you need to do a complete restore. Because the files are hard-linked, however, the total disk space used is much less.


I put a 1.2MB file in directory src/. Let's create two backups:

$ rsync -a src backup1
$ rsync -a --link-dest=../backup1 src backup2

Let's see how big backup2 is:

$ du -sh backup2
1.2M    backup2

backup2 has 1.2 megabytes. Now let's see how big both backup1 and backup2 are:

$ du -sh backup1 backup2
1.2M    backup1
8.0K    backup2

Now, backup2 would appear to be only 8k. That is because the hard links are not double counted.

  • Thank you, I was confused, so many post and so many times the terms get used in another way. I was worried about corruption/losing the middle backups and then being unable to restore the system. So, now that I am settings things up with cron, I could simply set a weekly/monthly full backup and use the backup1,2 ecc. to save space, am I right? Sep 26, 2016 at 22:20
  • @NeverGetDown As long as your backup disk is not corrupt, what you get with --link-dest is as good as a full backup. If "full backup" means not using --link-dest, then the only "full backup" I make is the first one. For later backups, whether daily, weekly, monthly, yearly, I always make them with --link-dest to save space. To be safe in case of disk corruption/failure, though, I do swap in and out multiple backup disks.
    – John1024
    Sep 26, 2016 at 22:33
  • 1
    Yes, I was referring to the first backup when I said "full backup". As soon as i can get my hands on a second disk I am going to do the same, multiple backups. Sep 27, 2016 at 13:35

Hard links are the best way to save disk space. Instead of scripting with rsync, I use a wrapper that does this job: Butterfly Backup.

This wrapper uses pure rsync and transforms rsync into a real backup/restore tool (it also has archive/export modes).

Also, in its options, it has the --mode/-m flag which allows you to select the backup mode between Incremental or Differential.

The differential mode will keep the first full and then all the following backups will be connected to it saving a lot of space thanks to hard links.

An example:

$ bb backup --computer mypc --destination /backup --data User --type Unix
 --mode Differential

You must log in to answer this question.

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