[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cobalt-users] Backup Solution using FTP to Other Server



Here's how we automatically backup our RAQ2 via FTP using the publicly available FTPBACKUP software (ftpbackup-2.1).

Once configured, it runs itself. It creates daily backups of most critical directory paths on our RAQ. The beauty of FTPBACKUP is that it compresses (gzip) the file at the same time it is sending it to another server. No need for a huge amount of empty space on current server (it doesn't gzip whole thing and THEN send it).

Because we are backing up to another hosting service elsewhere we get an added benefit of fire protection. Our backup is in another state!

REQUIRED:
1)ftpbackup-2.1 (find using any good search engine or at:
http://linux.about.com/compute/linux/library/metalab/blmeta_system_backup.htm)
2)an outside hosting provider which allows anonymous incoming FTP (we pay $30/mo for 500M of space)

INSTALL INFO (see readme file and know basics of permissions, cron, etc.):

1) Properly install ftpbackup-2.1 in /usr/local/bin/ftpbackup-2.1
2) Use CRON commands on RAQ such as we do.

CRON ON RAQ (ONE long line after each time/day parameter):
-----------------------
10 5 * * 1-6 /bin/tar cfp - /home | gzip | /usr/local/bin/ftpbackup -h 123.45.678.90 -u anonymous -p anonymousaddress@xxxxxxx -d /incoming -b bkp-home-daily.tar.gz
10 7 * * 1-6 /bin/tar cfp - /etc | gzip | /usr/local/bin/ftpbackup -h 123.45.678.90 -u anonymous -p anonymousaddress@xxxxxxx -d /incoming -b bkp-etc-daily.tar.gz
10 8 * * 1-6 /bin/tar cfp - /var | gzip | /usr/local/bin/ftpbackup -h 123.45.678.90 -u anonymous -p anonymousaddress@xxxxxxx -d /incoming -b bkp-var-daily.tar.gz
10 9 * * 1-6 /bin/tar cfp - /usr/admserv | gzip | /usr/local/bin/ftpbackup -h 123.45.678.90 -u anonymous -p anonymousaddress@xxxxxxx -d /incoming -b bkp-usradmserv-daily.tar.gz
10 10 * * 1-6 /bin/tar cfp - /usr/local | gzip | /usr/local/bin/ftpbackup -h 123.45.678.90 -u anonymous -p anonymousaddress@xxxxxxx -d /incoming -b bkp-usrlocal-daily.tar.gz
10 5 * * 0 /bin/tar cfp - /home | gzip | /usr/local/bin/ftpbackup -h 123.45.678.90 -u anonymous -p anonymousaddress@xxxxxxx -d /incoming -b bkp-home-weekly.tar.gz
10 7 * * 0 /bin/tar cfp - /etc | gzip | /usr/local/bin/ftpbackup -h 123.45.678.90 -u anonymous -p anonymousaddress@xxxxxxx -d /incoming -b bkp-etc-weekly.tar.gz
10 8 * * 0 /bin/tar cfp - /var | gzip | /usr/local/bin/ftpbackup -h 123.45.678.90 -u anonymous -p anonymousaddress@xxxxxxx -d /incoming -b bkp-var-weekly.tar.gz
10 9 * * 0 /bin/tar cfp - /usr/admserv | gzip | /usr/local/bin/ftpbackup -h 123.45.678.90 -u anonymous -p anonymousaddress@xxxxxxx -d /incoming -b bkp-usradmserv-weekly.tar.gz
10 10 * * 0 /bin/tar cfp - /usr/local | gzip | /usr/local/bin/ftpbackup -h 123.45.678.90 -u anonymous -p anonymousaddress@xxxxxxx -d /incoming -b bkp-usrlocal-weekly.tar.gz
--------------------------

***REPLACE: "123.45.678.90" with the IP of the outside machine to accept anonymous FTP
***REPLACE: "anonymousaddress@xxxxxxx" with your email address

Notice that we are backing up:
/home
/etc
/var
/usr/admserv
/usr/local

Using our above CRON, notice that on SUNDAYS the files are named "...weekly.tar.gz" and every MONDAY-SATURDAY they are named "...daily.tar.gz". If you only need a weekly backup adjust accordingly.

PREPARING RECEIVING MACHINE:

Now, on our BACKUP SERVER (from outside hosting provider). We ALLOW ANONYMOUS INCOMING FTP.

Using CRON on our BACKUP SERVER we do a few things. One, we COPY (cp command) everything from our ANONYMOUS INCOMING FTP directory to our /home/bkp directory at 3:09am every morning. We may be overdoing things a bit.. but that gives us full backup files even when the new day's files are coming in. Starting at 5:08am the new files start coming in.

We've timed each file send so that NO TWO BACKUPS OVERLAP EACH OTHER. Choose times when your server use is low (5-10am is lowest for us).

In our example the CRON will REMOVE the files sitting there a few minutes BEFORE new one will start arriving (rm command). *All of these times correspond with the CRON on our RAQ (see above).

CRON ON RECEIVING (outside hosting provider) MACHINE:
------------------------
5 3 * * 0-6 chmod 755 /home/bkp/*
7 3 * * 0-6 rm /home/bkp/*
9 3 * * 0-6 cp /home/anonftp/incoming/* /home/bkp
8 5 * * 1-6 rm /home/anonftp/incoming/bkp-home-daily.tar.gz
8 7 * * 1-6 rm /home/anonftp/incoming/bkp-etc-daily.tar.gz
8 8 * * 1-6 rm /home/anonftp/incoming/bkp-var-daily.tar.gz
8 9 * * 1-6 rm /home/anonftp/incoming/bkp-usradmserv-daily.tar.gz
8 10 * * 1-6 rm /home/anonftp/incoming/bkp-usrlocal-daily.tar.gz
8 5 * * 0 rm /home/anonftp/incoming/bkp-home-weekly.tar.gz
8 6 * * 0 rm /home/anonftp/incoming/bkp-opt2-weekly.tar.gz
8 7 * * 0 rm /home/anonftp/incoming/bkp-etc-weekly.tar.gz
8 8 * * 0 rm /home/anonftp/incoming/bkp-var-weekly.tar.gz
8 9 * * 0 rm /home/anonftp/incoming/bkp-usradmserv-weekly.tar.gz
8 10 * * 0 rm /home/anonftp/incoming/bkp-usrlocal-weekly.tar.gz
---------------

As you can see, timing is everything with this system. Once both machines are synchronized to send, accept, remove, move files in harmony it works like a charm.

For the "hands off" automatic backups the $30/mo we pay for the backup server space is well worth it.

Consult a Linux handbook for explanations on the use of CRON, GZIP, PERMISSIONS, INSTALLING, etc. Ohhh.. and for info on how to RESTORE (if you ever need to).

Brian Kane
DJ.NET




,.-=~'`^`'~=-.,_,.-=~'`^`'~=-.,_,
| Brian Kane brian@xxxxxx |
^`'~=-.,_,.-=~'`^`'~=-.,_,.-=~'`^