rsync --link-dest, --delete and hard-link count

Andrei_r20 andrei.rakov at
Fri Feb 5 08:20:32 MST 2010

Hello fellas,

Firstly, I would like to apologize for the post being long, but I would
appreciate if someone with a good knowledge of the subject gave his opinion.

I am working on a backup solution for a series of old and very specialized
host computers in aviation industry.

I need to do monthly backups of one or two logical volumes (non-OS) on each
of the computers and keep the last 12 monthly and 5 last yearly backups for

***Initial strategy***
The strategy I have worked out so far is obviously using rsync (over NFS,
since it is the only mean supported by all of the computers I am dealing

First backup is done to and empty destination. Then the destination is
tar'ed and compressed locally on the Linux backup server for storage.

For each following backup, the previous archive is extracted to a temporary
directory, rsync'ed with the source and re-tar'ed and compressed to another
archive. The temp directory is then deleted. The monthly backups of one year
ago and yearly ones of 6 years ago are deleted.

So over a five year period, I will have about 17-18 (let's just say 20)
.tar.gz archives that are rotating.

The particularity of these backups is that a very large amount of hard-links
exists in the filesystems being backed up. So I use -aH flags of rsync.

***What I think of doing***

Now,  I read this other very neat way of doing rotating backups using
--link-dest flag. You can find the whole explanation here:

So what I am thinking of doing now is:

The fist backup is done to an empty destination. Than, each following backup
will be done to a freshly created empty dir with current date as name but
with --link-dest option pointing at the previous (latest) backup directory.

Like this, if I understand right, each new backup will be hard-linked to the
previous backup, and only the new changes will be stored separately.

With this new method, I will save time of compressing, uncompressing
archives and supposedly the disk space used by backups will be one full
backup + deltas of 17 other ones instead of 17 x compressed full backup like
in the method I explained before.

Here are my questions:

1) Now, what happens if I use the --delete option with --link-dest, and some
files are deleted on the source? Are they going to be deleted from all of
the hard-linked previous backups (thus corrupting my previous backups) or
will they be somehow subtracted only in the new backup directory?

2) If I understand right, each new backup will increase the hard link count
of all unchanged files by one. So after a five year period I will have the
hard link count increased by 17. What happens if I now recover the latest
backup back to the source? Will the hard link count go back to what it was
on the source when the backup was done or will it stay the same (incremented
by 17)?

Is this new method better than the one I firstly proposed, or it just
introduces unnecessary risks?

I thank you for having patience to read though all of it and I hope to hear
an expert opinion soon.

View this message in context:
Sent from the Samba - rsync mailing list archive at

More information about the rsync mailing list