User Rating: 4 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Inactive

A lot of time people ask how the rsync backup type works and how hardlinks are used. Following article describes what happens when files are created and deleted on the file system in the backup process and how hardlinks are used.


Hardlinks is a filsystem feature of Linux etx3 and ext4 filesystem. They are pointer which connect a filename with a file contents. That way hardlinks can be used to point to the same file contents with different filenames from different locations in the file tree. Linux command  ln can be used to create hardlinks.

During the first rsync backup run all files are copied and created on the backup space. All following backup runs will copy only updated and new files and delete deleted files. Therefore most of the time these backup runs are relatively short compared to the first full backup. For all other files hardlinks are created in the backup filesystem which point to the previously saved file version.When files were deleted there will be no hardlinks created to the previously saved file and that way the files are no longer available in the new backup. This allows to have full access to all files and files are copied and saved only once. This saves backup time and -space. The following picture shows when F2 will be deleted on the filesystem. Keep in mind this only will happen if all backups which include F2 were deleted, which is BD1 - BD5. 


Following picture shows again how files and hardlinks are created and deleted. There exists also a Youtube video where hardlinks and rsync are explained in detail including a demo on a live system.

raspiBackup rsync

In raspiBackup FAQ17 you find a description how to check how much diskspace is used when hardlinks are used.



Everything you ever wanted to know about inodes on Linux - How-To Geek

du counting harldinks towards filesize

Add comment

*** Note ***

Comments are welcome. But in order to reject spam posts please consider following rules:
  1. Comments with string http are rejected with message You have no rights to use this tag
  2. All comments are reviewed by hand and thus it usually takes one day until a comment will be published.