A simple replication example without the Replication Wizard

Now that you are familiar with the Replication Wizard, this section will deepen your understanding so you can move on to more advanced configurations. If your replication needs are simple and typical, you may not need to read this section.

If you do not run your backups with the option lateLinks at the moment and want to use replication, you have to enable it when using storeBackup.pl. This means in practice, that you have previously been running something like:

# storeBackup.pl -f stbu.config

Now, and in the future, you will set lateLinks=yes in the configuration file and use these two commands (which could be put into one executable script):

# storeBackup.pl -f stbu.config
# storeBackupUpdateBackup.pl -b <dirOfMasterBackup>

Here, storeBackup.pl will create the deltas described above which are stored in your master backup. If you look into this data, you will see that there are e.g., no hard links to already existing files in the previous backup. After running storeBackupUpdateBackup.pl all the ``missing'' steps (like linking, changing permissions) are done. It is nothing else than splitting the work storeBackup.pl does as an all-in-one application into two different steps.

So the result of these two commands will be exactly the same - a full backup like before (when you didn't use option lateLinks and ran one command). The batch above is just a simple example; you can also run storeBackupUpdateBackup.pl e.g., on your server at a later time (see section 7.6 for more information).

Naturally, if you want to use replication, you have to configure it first. The Replication Wizard can do this for you. However, in this section we demonstrate the manual steps.

If we use the simple example above, replication to the backup copy on the external disk works as follows. I assume we have four different directories involved:

  1. /home which you want to save
  2. /masterBackup where your master Backup is located
  3. /extDisk/backupCopy where you want to copy your master backup to (the backup copy)
  4. /deltaCache which is a place to keep the deltas until they are delivered to the backup copy (/extDisk/backupCopy)
I also assume the backup series you want to copy is named homeBackup. You need write permissions for all of these directories (for /home only read permissions are required).
  1. copy the existing backup(s) to get a base for the replication:
    # linkToDirs.pl /masterBackup/homeBackup -t /extDisk/backupCopy
  2. Now you have to create a configuration file in your master backup to tell storeBackup to do the replication:
    # storeBackupUpdateBackup.pl --genBackupBaseTreeConf /masterBackup
  3. edit the generated configuration file /masterBackup/storeBackupBaseTree.conf so it has the following contents:44

    backupTreeName=myMasterBackup
    backupType=master
    seriesToDistribute=homeBackup
    deltaCache=/deltaCache
    

    In the master backup configuration file, a value for backupTreeName is only needed for error messages, warnings and so on. it is mostly there for future enhancements, so all directories will have a unique identifier.

    You can change the unique identifier for the parameter backupTreeName to whatever you want (here, myMasterBackup was chosen). But you have to set backupType to master!

  4. Now you can run your very first backup which will be replicated:
    # storeBackup.pl -s /home -b /masterBackup -S homeBackup --lateLinks 0:homeBackup
    This creates a backup in /masterBackup. If you go there, you can see the delta files plus the command file45 what's to be done to complete the backup. The last parameter (0:homeBackup) makes sure that there are only hard links to older versions of the same backup series. As we only want to replicate this one series it is not possible to have cross links to other series! (This is only necessary if you have multiple backup series in your master backup.)
  5. Next step you can do is to copy the deltas to the place (/deltaCache) where they are kept until you connect the external disk and replicate the deltas. In this step you will also complete the just made backup in the master backup directory. The following command will read the configuration file
    /masterBackup/storeBackupBaseTree.conf:
    # storeBackupUpdateBackup.pl -b /masterBackup
  6. Now you need to generate the configuration file for the delta cache. The just started command has copied the deltas from your master backup to this place (you should explore directory /deltaCache to see what has happened).
    # storeBackupUpdateBackup.pl --genDeltaCacheConf /deltaCache
  7. edit the generated configuration file /deltaCache/deltaCache.conf so it has the following contents:46

    backupCopy0=myBackupCopy homeBackup
    ;backupCopy1=
    ;backupCopy2=
    

    Do not change the other commented keywords backupCopy1 to backupCopy9 because we only one replication. (The delta cache is the central distribution place for all defined replications.) The entry myBackupCopy is just a name (not a path) for the copied backup on your external disk. You can choose any name you want, but it has to be exactly the same as in the configuration file for your backup copy at /extDisk/backupCopy. After ``myBackupCopy'' you have to enter the list of series you want to replicate. It is only the series homeBackup in this example.

  8. Next, you have to tell your backup copy which data it should add to the backup and where this data is located. Generate a configuration file for that:
    # storeBackupUpdateBackup.pl --genBackupBaseTreeConf /extDisk/backupCopy
  9. Edit the generated configuration file /extDisk/backupCopy/storeBackupBaseTree.conf so it has the following content:47

    backupTreeName=myBackupCopy
    backupType=copy
    seriesToDistribute=homeBackup
    deltaCache=/deltaCache
    

    The name of the backup must be the same as specified in the configuration file of the deltaCache which is loated at /deltaCache/deltaCache.conf. The backupType must be 'copy', so the program storeBackupUpdateBackup.pl knows it has to copy the deltas from the deltaCache.48

  10. Now you can finish the replication by completing the backup in the backup copy:
    # storeBackupUpdateBackup.pl -b /extDisk/backupCopy
    Have a look into the backup copy at /extDisk/backupCopy. It is a complete backup now. Also, have a look /deltaCache. The backup was moved to /deltaCache/processedBackups.49

After you set up the environment, simply do the following:

Heinz-Josef Claes 2014-04-20