Verify Hardlink Integrity of RSnapshot Copy

I use fusecompress as a backing file system for rsnapshot. Unfortunately I’ve been having crashes with the 2.0 C++ fork, so I’ve tried converting back to the 0.9.x C implementation. That’s been a tricky process because my disks are only just a bit too small for two concurrent copies of the rsnapshot tree. I’ve been using rsync to duplicate the tree, but because of the disk overfill it’s failed a few times. RSnapshot uses hard links to deduplicate files between snapshots (daily.0, daily.1, etc). Since rsync had failed a few times I wasn’t sure that it would maintain hard links consistently between the yet to sync’ed portion and the previously sync’ed portion after being restarted.  This script compares the hardlink structure between the two disk stores and generates a script to remedy any inconsistencies.  That said, rsync seems to behave properly because the script found no inconsistencies.

find . -type f | while read file
  do if (test "$file" -ef "../daily.2/$file");
    then
      if ! (test "/home/backup.new.fusecompress.backing/snapshot/daily.1/$file" -ef "/home/backup.new.fusecompress.backing/snapshot/daily.2/$file")
      then
        echo rm -f "/home/backup.new.fusecompress.backing/snapshot/daily.2/$file" >> /root/linked.daily.1
        echo ln "/home/backup.new.fusecompress.backing/snapshot/daily.1/$file" "/home/backup.new.fusecompress.backing/snapshot/daily.2/$file" >> /root/linked.daily.1
    fi
  fi
done

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>