Linux: Server Backup

To backup the server (Gentoo-based), the time-based job scheduler named (vixie) cron will be used.

The following how-to is based on Wedos Disk manual. However, once syncing to a different mount point, the rsync command will remain the same.

Wedos Disk Oriented How-To

Create an executable /etc/cron.daily/syncandencrypt file to rsync (backup) the whole system everyday.

#!/bin/bash
# Mount the Wedos Disk volume into /mnt/wedosdisk as per /etc/fstab
if grep -qs '/mnt/wedosdisk' /proc/mounts;
then
echo "WEDOS disk mounted.";
else
mount /mnt/wedosdisk;
fi

# Mount the encrypted TrueCrypt backup.ts container located in /mnt/wedosdisk/backup.tc (physically at Wedos Disk) into /mnt/zaloha
echo "Mounting TrueCrypt volume...";
truecrypt --text --keyfiles="" --protect-hidden=no --force --password=*************** /mnt/wedosdisk/backup.tc /mnt/backup

# backup copy the selected files and directories into the encrypted volume (/mnt/zaloha)
#rsync -avn /* /mnt/backup --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found,/home/*/.gvfs,/usr/portage/*,/usr/src,/var/log,/var/tmp,/var/db,/var/cache/edb,/var/lib/boinc} > /root/rsync.details.txt
rsync -aq /* /mnt/backup --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found,/home/*/.gvfs,/usr/portage/*,/usr/src,/var/log,/var/tmp,/var/db,/var/cache/edb,/var/lib/boinc}

# Unmount the ecrypted container
echo "Unmounting...";
truecrypt -d /mnt/wedosdisk/backup.tc

echo "Done.";

Source:
Here

Advertisements
This entry was posted in Linux, Security, Server and tagged , , , , . Bookmark the permalink.