Tags: how-to, administrator, backup

LinkAhead Backups#

Single Backup#

Create a backup of LinkAhead via

linkahead -p path/to/profile.yml backup -d path/to/backup/directory

in order to save the SQL dump of your data (the *.dump.sql file) and a backup of LinkAhead’s internal file system (the *.tar.gz).

Regular Backups#

Of course, it is recommended to do regular backups. One way to do this is to use cronjob. This can be nicely combined with rsnapshot to prevent the backups from growing too much. With rsnapshot, rotating backups can be created that are kept for predefined intervals. To combine this with LinkAhead backups, do the following.

  1. Create a specific LinkAhead backup script that will be executed by rsnapshot and that stores the backups in its current working directory. For example, create a /usr/local/bin/backup_linkahead_rsnapshot.sh which contains the following lines (may have to be adapted to your LinkAhead installation, see above).

    #!/bin/sh
    
    linkahead backup -d ./
    
  2. Adjust the rsnapshot configuration in /etc/rsnapshot.conf (see its documentation):

    • Create reasonable intervals that correspond to the frequency with which backups are rotated, e.g., daily, weekly, and monthly of which 14, 8, and 12 copies are kept, respectively. I.e., you’ll be keeping daily backups for two weeks, weekly for the following two months, and monthly for a year.

    • Choose a meaningful snapshot_root in which the backups will be stored.

    • Add the script created above to the backup scripts in /etc/rsnapshot.conf. In the above example, the line looks like

      backup_script   /usr/local/bin/backup_linkahead_rsnapshot.sh    linkahead/
      
    • Possibly remove standard backup directories like /etc/ and /home/ from the /etc/rsnapshot.conf

  3. Test the config with rsnapshot configtest for correctness.

  4. Make a test run. For example rsnapshot -t daily or rsnapshot daily. The former performs a dry run, the latter actually creates a backup.

  5. Add the rsnapshot commands to execute the backup intervals defined above to your crontab. In the above example, daily could be executed each day at 2 am, weekly on every Sunday at 1:30, and monthly on each first day of the month at 1 am with the following lines.

    0 2 * * *  /usr/bin/rsnapshot daily
    30 1 * * 1 /usr/bin/rsnapshot weekly
    0 1 1 * *  /usr/bin/rsnapshot monthly
    
  6. Check (after some time) logs in /var/log/syslog (default log location)