Creating live backups


This article shall serve as a guide on creating backups of your Enterprise Recon Master Server using our live backup tool.

Note that it is not necessary to stop the 'er2-master' service when creating a backup, but necessary when restoring from a backup.


Creating the backup

  1. Login to your ER Master Server terminal console as root
  2. Run the script for the backup tool using the command; /var/lib/er2/scripts/backup-start.rb /tmp/backup.bak

    This would create a backup file (.bak) in the /tmp directory of your Master Server.
    If you wish to create the backup in another directory, enter the following commands;
    ii) chown erecon:erecon <BACKUP OUTPUT DIRECTORY>
    iii) /var/lib/er2/scripts/backup-start.rb <BACKUP OUTPUT DIRECTORY>/backup.bak

    * It is possible to mount a remote partition and set that as the output directory.
    ** It is good practice to include the version of ER in the name of the backup file at the time of the backup.
  3. To view the backup progress, enter the command; /var/lib/er2/scripts/backup-jobs.rb

    To stop the backup process, enter the command; /var/lib/er2/scripts/backup-stop.rb <JOB ID>


Restore from backup

Ensure that the backup file is in your Master Server, then login to the terminal console as root and enter the following commands;

  1. er2-recovery -b <BACKUP FILE DIRECTORY>/backup.bak -w <SAME DIRECTORY>/root.kct
    (eg. er2-recovery -b /tmp/backup.bak -w /tmp/root.kct)
  2. /etc/init.d/er2-master stop
  3. mv /var/lib/er2/db/root.kct /var/lib/er2/db/root.orig
  4. cp <BACKUP FILE DIRECTORY>/root.kct /var/lib/er2/db/root.kct
  5. cd /var/lib/er2/db
  6. chown erecon:erecon root.kct
  7. chmod go-r root.kct
  8. /etc/init.d/er2-master start


Scheduling Backups using Cron Tab

Crontab utilizes the cron daemon (crond) to execute repetitive or 'chronic' scheduled tasks.

Login to the terminal as root (or a user that has permissions to run scripts) on your ER2 Master host and enter the following commands:
1. crontab -e  (To edit the existing crontab or create a new one if it doesn't exist)
2. Select an editor if prompted to do so (nano is the easiest)
3. Use the following field structure to configure your cron table:

1 2 3 4 5 command/shell-script

1= minute (0-59)
2= hour (24 hour format, 0-23)
3= day of month (1-31)
4= month of year (1-12)
5= day of week (0-6, 0/7 is Sunday, 1-6 is Mon-Sat)
*= wildcard to exclude options not needed

Example: To schedule '' to run at 10:30am every Wednesday of each week:
30 10 * * 3 /home/[username]/

To create a cron table to schedule your Enterprise Recon backups you could use the following structure:

0 23 1 * * /var/lib/er2/scripts/backup-start.rb </BACKUP OUTPUT DIRECTORY>/ER2backupAPR1.bak

The above will enable the Enterprise Recon Backup script to run at 11:00pm (23:00) on the 1st day of every month and backup to your specified directory, creating a backup file called 'ER2backupAPR1.bak'.

Useful switches to use with Crontab:
crontab -l lists user cron table.
crontab -e creates a new cron table or edits the existing cron table.
crontab -r removes a cron table and all scheduled jobs.


Mount & backup to Windows Share

The following is a guide on temporarily mounting a Windows Share server in order to directly create ER backups within.

This guide is meant to be followed from your ER Master Server Terminal console (logged in as 'root').
For the purposes of this guide, we shall assume the full Windows Share path we want to create backups in is; \\mywinserver\myshare\subdir\er2_backups

  1. Ensure cifs-utils is installed, run command; yum info cifs-utils
    If not installed, install using command; yum install cifs-utils
  2. Define a variable for your Windows Share server; SERVER_NAME=mywinserver
    Test connectivity; ping -c1 $SERVER_NAME
    If test is unsuccessful, try using your server's IP address instead; IP=
    Test connectivity; ping -c1 $IP

    To fix any DNS resolution issues, try manually inserting $SERVER_NAME into /etc/hosts, use commands;
    cp /etc/hosts /etc/hosts.bak
    echo $IP $SERVER_NAME >> /etc/hosts
    cat /etc/hosts
  3. Define another variable for your Share name as well, use command; SHARE_NAME=myshare
  4. If mounting the whole share rather than a sub-directory, define the mounts like so;

  5. Check the mount paths to verify all variables have been set up correctly;

    Correct output should look something like this:
  6. Create a directory to be the local mount point of the remote share using the command; mkdir -p $LOCAL_MOUNT
  7. Define your Share's username & password;

    Verify using command; echo -e "\nUsername=$USER\nPassword=$PASS\n"
  8. Do a final verification;
    echo -e "\nmount -t cifs $REMOTE_MOUNT -o username=$USER,password=$PASS,uid=erecon,gid=erecon $LOCAL_MOUNT\n"
  9. Now execute the mount command;
    mount -t cifs $REMOTE_MOUNT -o username=$USER,password=$PASS,uid=erecon,gid=erecon $LOCAL_MOUNT

    To avoid having to enter the username & password on the command line, insert the credentials into a file and set it to read-only. You may use the following commands;
    echo -e "username=$USER\npassword=$PASS" > $CRED_FILE
    chmod 0600 $CRED_FILE
    Then mount using; mount -t cifs $REMOTE_MOUNT -o credentials=$CRED_FILE,uid=erecon,gid=erecon $LOCAL_MOUNT
  10. Initiate the backup; /var/lib/er2/scripts/backup-start.rb $LOCAL_MOUNT/backup.bak
    Check progress with; /var/lib/er2/scripts/backup-jobs.rb
  11. Un-mount when backup is complete;
    cd /
    umount $LOCAL_MOUNT


Backup using Web Console

From ERv2.0.21 scheduled backups can be created in the web console.  Goto Monitoring and Alerts>Server Information> Backup Section.



Note: If creating a backup from within the web console backing up to a windows share, after you mount the windows share in the master server following the steps above, the location you need to enter in the web console is /mnt/$remote_share$


All information in this article is accurate and true as of the last edited date.

Have more questions? Submit a request


Please sign in to leave a comment.