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?

The rsync command can preserve hard links and make the exact copy of /raid6/rsnapshot directory to a remote server using the following syntax:

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

Where,

  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.

In short type the following command as root user:
# rsync -az -H --delete --numeric-ids /raid6/rsanpshot backupserver2:/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
Use the rsync as follows:
# rsync -az -H --delete --numeric-ids /raid6/rsanpshot /mnt/usbdisk

Republished by Blog Post Promoter

About author

admin
admin 87 posts

I have been working with Linux based systems since 2002. I hope the article published on this site will be useful to those new to server administration.

You might also like

Linux Basics 0 Comments

How To Install APF Firewall on Cpanel

Advanced Policy Firewall, or APF, is basically an interface to iptables, which is the standard interface to managing network ports on Linux machines. Interacting with iptables can be complex and error-prone,

Server Managment 0 Comments

Nginx Redirect URL With HTTP/1.1 301 Moved Permanently Header

How do I redirect old ugly urls such as http://example.com/store/view.jsp?product=foo with clean url – http://example.com/store/view/product/foo using nginx reverse proxy? You need to use HttpRewriteModule under nginx web server. This module

Linux Basics 1Comments

CentOS and RHEL 7 Restart, Stop, Start Networking Commands

I recently installed CentOS Linux version 7 or Red Hat Enterprise Linux version 7. How can I restart networking service using command line options? How can I start / stop