User Tools

Site Tools


build:backups

This is an old revision of the document!


Backups

Like any system admins, we need to ensure that we have good backups. Our systems do not have tape backup devices, and it's easy to rebuild the OS, so we're just backing up our data and config files across the network.

Backup Dirs

Create directories to store our backup files, and make sure they're not readable by anyone:

mkdir -p /var/backups
mkdir -p /var/backups/etc
mkdir -p /var/backups/home
mkdir -p /var/backups/usr_local
mkdir -p /var/backups/email
chmod -R 600 /var/backups

Backup of /etc

Create the backup script in /etc/cron.daily/backup-etc:

#!/bin/sh
 
SRCDIR=/etc
BACKUPDIR=/var/backups/etc
DATE=`date +'%Y%m%d'`
 
tar cfz $BACKUPDIR/etc-$DATE.tgz -P $SRCDIR

Make the script executable:

chmod 755 /etc/cron.daily/backup-etc

Run the script to test that it works, and saves a file with the correct name in /var/backups/etc/. Run 'tar tfz' on the resulting backup file to make sure it contains the expected files.

Backup of /home

Note that we only do weekly backups of home, because it's a lot bigger than the other directories that we back up.

Create the backup script in /etc/cron.weekly/backup-home:

#!/bin/sh
 
SRCDIR=/home
BACKUPDIR=/var/backups/home
DATE=`date +'%Y%m%d'`
 
tar cfz $BACKUPDIR/home-$DATE.tgz -P $SRCDIR

Make the script executable:

chmod 755 /etc/cron.weekly/backup-home

Run the script to test that it works, and saves a file with the correct name in /var/backups/home/. Run 'tar tfz' on the resulting backup file to make sure it contains the expected files.

Backup of /usr/local

Create the backup script in /etc/cron.daily/backup-user_local:

#!/bin/sh
 
SRCDIR=/usr/local
BACKUPDIR=/var/backups/user_local
DATE=`date +'%Y%m%d'`
 
tar cfz $BACKUPDIR/user_local-$DATE.tgz -P $SRCDIR

Make the script executable:

chmod 755 /etc/cron.daily/backup-user_local

Run the script to test that it works, and saves a file with the correct name in /var/backups/user_local/. Run 'tar tfz' on the resulting backup file to make sure it contains the expected files.

Backup of Email

NOTE: We currently store users' email folders in their home directories. So we do not need to back up anything separately at this point.

TODO

Copy the files in /var/backups off the server to another server.

Delete older backup files. There should be some schedule for this, so that we keep 1 backup per month or something.

Exclude some items in backup of home directories.

Back up email folders separately, if/when they're no longer held in home directories.

build/backups.1180544965.txt.gz · Last modified: 2007/05/30 12:09 by 71.10.176.218