Is a command line tool written by Mario Viara which works very similar to the rsync tool but with better options than rsync. This small tool really helps the administrator to synchronize both the directories with exact data copy on both dirs. This tool uses the source and destination directory as arguments and recursively ensures that the two directories are identical. It can be used to
create incremental copies of large chunks of data. For example, if your file server’s contents are in the directory /datafiles, you
can make a copy in a directory called /backup with the command “dirsync /datafiles /backup“; The first time you run it, all data will be copied. On subsequent runs, only the changed files are copied.

Installing DirSync

Dirsync  rpm is not available so you have to download and install it via the source.

  • @server1:/# mkdir -p /usr/src/dirsync
  • @server1:/# cd /usr/src/dirsync
  • @server1:/# wget http://www.viara.cn/download/dirsync-1_11.tar.gz
  • @server1:/# tar zxvf dirsync-1_11.tar.gz
  • @server1:/# make install
  • @server1:/# which dirsync
  • @server1:/#

To sync the directories say for example /opt with /opt2 (make sure both the directories exists)

  • # dirsync /opt /opt2


To run quit without verbose logs

  • # dirsync -q /opt /opt2

To verify both the datas are synced correctly, try

  • #  dirsync -V /opt /opt2

To use the verbose options

  • # dirsync -v lvl  set verbose level (default 2,min 0,max 9)

For more help just use dirsync -h to display the help menu
You can write up your own shell script and use the cron to sync both the dirs at a time period, say for example to sync /home with /home2

vi /etc/dirsync.sh

  • #!/bin/bash
    #Dirsync-script to sync /home with /home2 in same server….
    /usr/bin/dirsync -qV /home /home2