Install and use reoback for making backups to external usb drive
From OpenFSG
Reoback is a small perl script which can create full and incremental backups of your data. It requires at least perl and tar and will not run with microperl nor the preinstalled version of tar. Thus, these two packages need to be installed first using ipkg.
Contents |
Install perl
- Make sure you have installed the custom ipkg installer
- Login as root to your fsg
- Type vi /opt/etc/ipkg/cross-feed.conf
- Type i and to edit the file
- Add the line
src/gz unstable http://ipkg.nslu2-linux.org/feeds/optware/fsg3/cross/unstable/
- Save by pressing esc and enter :wq!
- Type ipkg update
- Type ipkg install perl
Install tar
- Type ipkg install tar (this will also install bzip)
Downloading Reoback
- Download Reoback: http://prdownloads.sourceforge.net/reoback/reoback-1.0_r3.tar.gz
- Unpack the tar file and place it in a folder e.g. /root/reoback (of course you can place it somewhere else if you prefer)
- You should now have 4 folders and 2 files in /root/reoback (i.e. the folders conf, data, CVS, docs and the files reoback.pl and run_reoback.sh
- Create an additional folder called tmp.
mkdir /root/reoback/tmp
Modifying Reoback to use new tar version
- You need to edit the reoback.pl and change the path to tar and remove the gzip option from the command line as it slows down the backup process much too much
- Enter vi /root/reoback/reoback.pl
- Enter i and change
my $TARCMD = "tar -cpzf"; tomy $TARCMD = "/opt/bin/tar -cpf"; # Command to use to create tar files
- Also change
my $EXT = "\.tgz"; tomy $EXT = "\.tar"; # Tar file extension
- Press esc and type :wq! to save.
- Chmod reoback.pl to 755 by typing
chmod 0755 reoback.pl
Configuring Reoback (settings.conf)
- You need to edit the settings.conf of reoback
- Enter vi /root/reoback/conf/settings.conf
- Enter i and make the changes necessary for your system
- Save your changes by pressing esc and typing :wq!
Here a sample of my settings.conf file
host = fsg backupdays = 7 files = /root/reoback/conf/files.conf tmpdir = /root/reoback/tmp/ datadir = /root/reoback/data/ localbackup = /home/USB_2_0_IDE_Bridge-0000/ keeplocalcopy = 1 remotebackup = 0 ####### below can be ignored, but must be in settings to avoid error messages ###### rbackuptype = FTP localmount = /mnt/server/ remotehost = HOSTNAMEHERE remotepath = /path here/
Configuring Reoback (files.conf)
- In this file you enter what folders and files you want to reoback to backup
- Enter vi /root/reoback/conf/files.conf
- Enter i to begin editing
- Save your changes by pressing esc and typing :wq!
Here a sample of my files.conf
File: work /home/work File: downloads /home/downloads Skip: /home/downloads/Software
This will create two backup files. One called work and one called downloads. The downloads file will backup all files in /home/download but will skip the subfolder Software. Read the files.conf comments for further configuration possibilities.
Configuring Reoback (run_reoback.sh)
- You need to change the paths in run_reoback.sh
- Enter vi /root/reoback/run_reoback.sh
- Enter i to begin editing
- Save your changes by pressing esc and typing :wq!
- Chmod run_reoback.sh to 755 by typing chmod 0755 run_reoback.sh
Here a sample of my run_reoback.sh
# Location of the configuration file. config="/root/reoback/conf/settings.conf" # Change to reflect where REOBack is installed reoback="/root/reoback/reoback.pl"
Running reoback
- To run reoback type
sh /root/reoback/run_reoback.sh
The output should be similar to:
REOBack version 1.0 Release 3; distributed under the GNU GPL.
Running backup on fsg.
Backup number 1 of 14 (backup days x 2)
Performing full backup on local system
Last full backup: Sun Nov 12 15:11:20 2006
Archiving in progress...
Working on work...
Archiving work...
Working on downloads...
Archiving downloads...
All local archives were saved in /home/USB_2_0_IDE_Bridge-0000/2006-11-12/
Total transfer time: 0.00 seconds(s).
Overall backup time: 49.13 minute(s).
Note:
- Don't interrupt the script while its running. It can take a long time depending on the amount of files you are backing up. When finished the script will output a result message on your screen. On my fsg it takes about 10 minutes to backup 5 GB onto my external USB drive formatted with ext3.
- The first time you run the script a full backup will be made. Thereafter the backup will be incremental (e.g. only files that have changed will be backed up). Every 7 days a full backup will be made again and for the following 6 days incremental backups are made. The script will delete any backups older than 14 days. So basically you have 2 weeks worth of backups. For each day a new folder with the date of the backup is created on your usb disk.
Using a cronjob to run reoback
The best thing would of course be to create a cronjob to run the script for you every day at a certain time. Do this at night when you are not using your fsg, since the creation of the tar files during backup does take quite a long time and resources depending on how many GBits you are backing up.
Here is what you need to do to setup the cronjob:
- You need to edit the croninit file.
- Enter vi /etc/init.d/croninit
- Edit the file as show below
- Press esc and type :wq! to save your changes
- Now reboot the fsg
Editing /etc/init.d/croninit
look for
echo "$PERIOD" >> /etc/crontab
fi
Under this add a new line:
echo "15 23 * * * root /root/reoback/run_reoback.sh" >> /etc/crontab
Reoback will now run automatically every night at 23:15
