Subj : Nightly Backups To : All From : Sean Dennis Date : Sun Nov 22 2015 01:51 pm Hello All, I thought I posted this file in here, but I didn't. Here it is: === Cut === How To Make Nightly Backups Easy By Sean Dennis 16 November 2015 ================================ MBSE BBS should be backed up nightly as part of a good disaster recovery program. This is part of my "hot" part of my personal disaster recovery program.[1] I am running, as of this writing, MBSE BBS 1.0.6 under Slackware Linux 14.1. These particular examples involve using crond (Dillon's cron) and run-parts. Your system may vary from this, so adjust accordingly. The first thing I did was install rdiff-backup. This is available for many distros. rdiff-backup is a Python script that uses rsync to perform backups both locally and via SSH to other systems. rdiff-backup's website[2] explains how to do all of that and much more. From rdiff-backup's website: "rdiff-backup backs up one directory to another, possibly over a network. The target directory ends up a copy of the source directory, but extra reverse diffs are stored in a special subdirectory of that target directory, so you can still recover files lost some time ago. The idea is to combine the best features of a mirror and an incremental backup. rdiff-backup also preserves subdirectories, hard links, dev files, permissions, uid/gid ownership, modification times, extended attributes, acls, and resource forks. Also, rdiff-backup can operate in a bandwidth efficient manner over a pipe, like rsync. Thus you can use rdiff-backup and ssh to securely back a hard drive up to a remote location, and only the differences will be transmitted. Finally, rdiff-backup is easy to use and settings have sensical defaults." I started doing research about creating a script to do the nightly backups. As I read, I learned a few quirks about run-parts: a) run-parts will not run a script that has an extension and b) the script's permissions should be set to 755. This script runs as root, so as root, I created the following script in /etc/cron.daily (which runs at 0440 local time): #!/bin/bash mount /dev/sdb1 /mnt/backup rdiff-backup /opt/mbse /mnt/backup/nightly umount /mnt/backup echo "Nightly Backup Successful: $(date)" >> /opt/mbse/log/backup.log Let me explain what this does if you're not familiar: * Line 1: Opens a command shell. * Line 2: I have an external USB 500GB hard drive that I'm using for the nightly backups. I created the /mnt/backup mounting point just for this drive. * Line 3: This is the line that does the work. It calls rdiff-backup to backup all the files in /opt/mbse over to my USB drive into the nightly directory. * Line 4: Unmounts the drive (in case of problems, the drive is not affected). * Line 5: This just writes that line to the specified log file for my own personal information. MBSE has ntohing to do with this. The best thing about rdiff-backup is that it copies the files as they are. No compression (unless you want it), nothing fancy. Lose a file? Just copy it directly over from the backup directory. I'd highly recommend reading up on rdiff-backup as it contains many features I have no need for but you might find indispensable. If you have any questions about this, please contact me in Fidonet's MBSE echo, via netmail at 1:18/200@Fidonet or 618:618/1@Micronet, or email at sysop@outpostbbs.net (the first two methods preferred). You can also find me on my BBS, Outpost BBS, at telnet://bbs.outpostbbs.net. -- Sean Dennis Outpost BBS SysOp Footnotes: [1] = While you may not be running your BBS as a business, it makes sense to treat it like one when it comes to backing up your data. A good place to start learning about a disaster recovery plan is here: http://www.ready.gov/business/implementation/IT A Google search using "basic disaster recovery plan" provides a lot of information also if you're not familiar with this concept. [2] = http://www.nongnu.org/rdiff-backup/ === Cut === Later, Sean --- GoldED+/LNX 1.1.5-b20150715 * Origin: Outpost BBS * Limestone, TN, USA (1:18/200) .