java.lang.Object
com.aoindustries.aoserv.daemon.failover.HardLinkVarBackup

public final class HardLinkVarBackup extends Object
Iterates through all files in /var/backup and creates hard links two or more matching files. As follows:
  1. Both are in /var/backup/hostname/####-##-## filenames (no partial or deleted)
  2. Are in different /var/backup/hostname/####-##-## directories
  3. Have the same exact path relative to their /var/backup/hostname/####-##-## directories
  4. Are on the same underlying partition
  5. Are both regular files
  6. Are not already linked together
  7. Have matching length
  8. Have matching modified time
  9. Have matching permissions
  10. Have matching ownership
  11. Have exactly matching file contents

This is accomplished by iterating through all /var/backup/hostname/####-##-## directories concurrently in a sorted manner such that each unique path is examined once. For each unique path, all directories having a file at that path will be compared by the above rules.

During a pass, the /var/backup/hostname/####-##-## may be renamed to .partial or .deleted by the backup server. Should this happen either a FileNotFoundException will be thrown or a directory listing will be null or empty. In any of these cases, the system will continue linking the other directories without interruption.

Through the complete pass, statistics will be kept. The statistics will be displayed every DISPLAY_INTERVAL milliseconds. These will include:

  • Total number of filesystem objects (unique paths from /var/backup)
  • Total number of unique paths
  • Total number of directories
  • Total number of files
  • Total number of symbolic links
  • Total number of new hard links created
  • Total number of bytes in all files
  • Total number of bytes saved by new hard links (not disk blocks, just file bytes)
Author:
AO Industries, Inc.
  • Constructor Details

    • HardLinkVarBackup

      public HardLinkVarBackup()
  • Method Details

    • main

      public static void main(String[] args)