You are here

Proposed Enswitch Backup Plan

Enswitch recommends:
1. Copy /var/lib/enswitch to a remote system daily.
2. At the minimum, backup /etc weekly but entire local fs is recommended.

On the server holding the backups:

#!/bin/bash

SHARESDIR='/var/shares/test-pc'

NOW=$(date +%Y-%m-%d-%H)
NEXTHOUR=$(date --date='1 hour' +%Y-%m-%d-%H)

#NOW=`date '+%Y-%m'-%d-%H`

mkdir $SHARESDIR/$NEXTHOUR/ # make a new directory to hold the next backup

cp -al $SHARESDIR/$NOW/* $SHARESDIR/$NEXTHOUR # copy hard links of current directory into new directory

# The -al causes cp to copy only hard-links to the new directory.
# This saves disk space by only using space once for both files
# Expects that the rsync from the client will come along shortly and update any files that have changed since this backup.
# When the files are modified, the hard-link is broken and the file stands on its own (ie takes up it's own disk space).
# If an old backup is removed, the hard-links is broken as well, but the new file doesn't change.

# This ends up keeping incremental copies of data, with only the diffs taking up disk space.

On the client being backed up:

#!/bin/bash

# Define the passwordfile.
# Needs to be only readable by root (chmod 600)
passwordfile='/root/backup-password.txt'

# Define the excludes
excludefrom='/root/backup-excludes.txt'

# Define the restore helpers
restoreinfo='/root/backup-info.txt'

echo "------------------------------------------------------------------------" > $restoreinfo
echo "------------------------------------------------------------------------" >> $restoreinfo
echo "#fdisk -l --------------------------------------------------------------" >> $restoreinfo
fdisk -l >> $restoreinfo
echo "" >> $restoreinfo
echo "------------------------------------------------------------------------" >> $restoreinfo
echo "------------------------------------------------------------------------" >> $restoreinfo
echo "df -h ------------------------------------------------------------------" >> $restoreinfo
df -h >> $restoreinfo
echo "" >> $restoreinfo
echo "------------------------------------------------------------------------" >> $restoreinfo
echo "------------------------------------------------------------------------" >> $restoreinfo
echo "#/etc/fstab ------------------------------------------------------------" >> $restoreinfo
cat /etc/fstab >> $restoreinfo

# Pull everything except what is in the excludefrom file
rsync --password-file $passwordfile -azi --delete --exclude-from $excludefrom / pub@linux-pc::test-pc/latest/

# Pull /
# Exclude /boot with is on a different fs
#rsync --password-file $passwordfile -axi --delete --exclude '/boot' --exclude '/mnt/win' / pub@linux-pc::test-pc

# Backup /boot
#rsync --password-file $passwordfile -axi --delete /boot/ pub@linux-pc::test-pc/boot

# Backup /mnt/win which is on a different fs
#rsync --password-file $passwordfile -axi --delete /mnt/win pub@linux-pc::test-pc/mnt

List of Backup software

Acronis Dissimilar Hardware

Bacula

http://www.faqs.org/docs/gazette/backup.html

http://www.basicallytech.com/blog/index.php?/archives/73-Using-a-USB-external-hard-disk-for-backups-with-Linux.html


mkdir -p /mnt/usb
mount -t ntfs-3g /dev/sdc1 /mnt/usb