|
My mate Mark Ryan was recently burgled and the thieves made off with all his computer equipment, however in a stroke of pure luck he had brought his backup drive into work that morning so he didn't lose his family photos. This got me thinking - my incremental backups are a great idea, but since the primary drive and backup drive are both attached to the same machine I risk losing everything I am the victim of a robbery/house fire/whatever. It might seem like macabre paranoia but if anything like that happens its not the equipment you'll miss - its the photos of your wedding day and your kids growing up etc. etc. For most people an online backup would be the ideal option here, but my wife is a keen amateur photographer so at time of writing we have 29GB of photos (and increasing rapidly) and a crappy 128kb uplink so this is not feasible. Happily we do have a log cabin down the end of the garden with electricity and network connectivity in it, so I set up a second backup machine down there using an old HP desktop from 2001 (who says computers are obsolete after 5 years?). The network connection to the cabin is Powerline Ethernet over an 84m stretch of cable so the data rate isn't amazing, hence doing an rsync of the 3-months worth of incremental backups would likely take forever. Instead I did the following: - Use rsync to mirror the shared directories on the main server to the secondary server in the cabin
- Run rsnapshot locally on the 2nd machine to get the incremental backups
This has the advantage of allowing me to export the shared directories using samba, so the secondary machine is ready to step into the breach immediately should anything happen to the primary one.
The first synchronisation was going to take forever to complete I did it in the house before moving it down to the cabin (vetinari is the main server, detritus is the new secondary backup).
root@detritus:/media/shared# rsync -ai --delete vetinari:/media/1TBMyBook/shared/ . | tee ~/rsync.log root@vetinari's password: .d..tp..... ./ .d..t...... Ainey/Dogs Aid/Adoptable dogs/ >f+++++++++ Ainey/Dogs Aid/Adoptable dogs/Akita.jpg >f+++++++++ Ainey/Dogs Aid/Adoptable dogs/Minnie.jpg >f+++++++++ Ainey/Dogs Aid/Adoptable dogs/PeggySue.jpg >f+++++++++ Ainey/Dogs Aid/Adoptable dogs/Shep1.jpg >f+++++++++ Ainey/Dogs Aid/Adoptable dogs/Shep2.jpg <snipped> cd+++++++++ cianer/work/websites/ >f+++++++++ cianer/work/websites/addProduct1.jpg >f+++++++++ cianer/work/websites/addProduct2.jpg >f+++++++++ cianer/work/websites/addProduct3.jpg >f+++++++++ cianer/work/websites/addProduct4.jpg >f+++++++++ cianer/work/websites/addProduct5.jpg >f+++++++++ cianer/work/websites/forcedShutdown.jpg >f+++++++++ cianer/work/websites/grabURL.jpg >f+++++++++ cianer/work/websites/productList.jpg root@detritus:/media/shared#
I wrote a simple script to do the rsync above: root@detritus:~# more backupScript #! /bin/sh
# Stick the date at the top of the log echo "Syncing vetinari's /media/1TBMyBook/shared ..." > backups.log rsync -ai --delete --exclude=.gvfs --exclude=.mozilla root@vetinari:/media/1TBMyBook/shared/ /media/shared >> backups.log
echo "Syncing vetinari's /media/1TBMyBook/backups/daily.0/videos ..." >> backups.log rsync -ai --delete root@vetinari:/media/1TBMyBook/backups/daily.0/videos/ /media/backup_disk/daily.0/videos >> backups.log
root@detritus:~# I set up rsnapshot as before to do incremental backups, but it will also back up the important directories from vetinari in case I ever have to replace that machine. The salient parts of /etc/rsnapshot.conf look like this:
############################### ### BACKUP POINTS / SCRIPTS ### ###############################
# LOCALHOST (shared and videos are rsynced with vetinari already) backup /home/ detritus/ backup /etc/ detritus/ backup /usr/local/ detritus/ backup /media/shared/ detritus/ backup /var/log/rsnapshot detritus/
# Vetinari (we only take selected bits as shared is already rsynced via a different cronjob) backup root@vetinari:/etc/ vetinari backup root@vetinari:/root/ vetinari backup root@vetinari:/usr/local/ vetinari backup root@vetinari:/var/log/rsnapshot vetinari Finally I set up a cronjob to run the rsync script followed by the incremental backups every night: root@detritus:~# crontab -l # DO NOT EDIT THIS FILE - edit the master and reinstall. # (roots.crontab installed on Tue Feb 19 22:28:37 2008) # min hour day/mon month day /week command 0 0 * * * /root/backupScript 0 4 * * * /usr/bin/rsnapshot daily 30 2 * * 1 /usr/bin/rsnapshot weekly 0 1 * 1 * /usr/bin/rsnapshot monthly
root@detritus:~#
Note for me for later when I forget the setup: There is also a videos/ directory on vetinari that I stream using an old xbox and xmbc, but that isn't backed up using rsnapshot because then I end up with two copies on the one machine which is overkill & hoggs diskspace. Instead I simply rsync the videos/ directory from vetinari to detritus along with the shared/ directory. This gives me copies of the videos/ on two disks, which is ample, whereas there more important data in shared/ is stored on three different disks to reduce chance of losing it.
|