Rsync Preserve / Copy Hard Links ( Backup Rsnapshot Directory Tree )

I‘m using rsnapshot filesystem snapshot utility to make incremental snapshots of local and remote filesystems for 10 production servers running on RHEL 5.x system. The rsnapshot commands makes extensive use of hard links, so if the file doesn’t change, the next snapshot is simply a hard link to the exact same file. How do I use the rsync command to copy my the entire snapshot directory /raid6/rsnapshot/ (around 4TB) to a remote server for mirroring purpose?

Tutorial details
DifficultyEasy (rss)
Root privilegesYes
[/donotprint]The rsync command can preserve hard links and make the exact copy of /raid6/rsnapshot/ directory to a remote server using the following syntax. This is useful for making offsite backups or copy existing backups to a usb hard disk:


rsync -az -H --delete --numeric-ids /path/to/source server2:/path/to/dest/


rsync -az -H --delete --numeric-ids /path/to/source


rsync -az -H --delete --progress --numeric-ids /path/to/source


  1. -a : Archive mode (i.e. recurse into directories, and preserve symlinks, file permissions, file modification times, file group, file owner, device files & special files)
  2. -z : Compress file data during the transfer
  3. -H : Preserve hard links (i.e. copy hard links as hard links)
  4. --delete : Delete extraneous files from the receiving side (ones that aren't on the sending side), but only for the directories that are being synchronized i.e. keep exact replica of your /raid6/rsnapshot directory.
  5. --numeric-ids : Transfer numeric group and user IDs rather than using user and group names and mapping them at both ends.
  6. --progress : Show progress during transfer.

Rsync copy hard links

In short type the following command as root user to copy /raid6/rsanpshot to another backup server named backupserver2:
# rsync -az -H --delete --numeric-ids /raid6/rsanpshot backupserver2:/backups/
You can pull backups too from backupsrver2 as follows:
# rsync -az -H --delete --numeric-ids backupserver1:/raid6/rsanpshot /backups/
Smaller size directories can be dumped to usb 2.0/3.0 or eSata external hard drives using the same syntax. First, mount usb hard drive:
# mount /dev/sdXY /mnt/usbdisk
Next, use the rsync command as follows:
# rsync -az -H --delete --numeric-ids /raid6/rsanpshot /mnt/usbdisk/
rsync copy hard link on linux unix

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
Network Utilitiesdig host ip nmap
Package Managerapk apt
Processes Managementbg chroot disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w

8 comments… add one
  • Nimusiima Apr 18, 2012 @ 15:33

    I see. I think I would also opt for time machine, but I cnnaot get it to work on NFS. As I don’t want to push Time Machine into doing things it’s not supposed, I think it will be better to make my own aolution. Putting in cleanup of old snapshots shouldn’t be to hard either I think.

  • Paul Feb 5, 2014 @ 18:01

    Thank you very much for your article, it helped me a lot. I have a question because of your rsync options. When I compare the two directory trees with rsync -rvnc –delete local remote, I get several “Skipping non-regular file: ….” errors, should I add also the –links option to rsync?

    • me Jul 18, 2014 @ 23:39

      I ‘m thinking you might want to look at the ‘-D’ option.

      Here is a reference:

      You might also want to look at excluding directories. /proc/ for example.


      • Paul Aug 18, 2014 @ 14:55

        thank you for your reply, as far as I understand from the referenced article -D is in included in -a (-rlptgoD) so it is already used, /proc/ is not included in the backup.

  • me Jul 18, 2014 @ 23:31

    This helped me.

    Thank you :)

  • Jon Wilson Jan 27, 2015 @ 11:18

    I’m copying my rsync backups from a single drive to a new RAID array, and this was exactly what I needed. Thanks for the information!

  • James Watt Mar 20, 2017 @ 4:57

    Is this affected at all by going from one file system to another? I plan on using this to transfer data from ext4 to zfs

  • Jiri Sep 23, 2017 @ 1:48


Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.