Friday, February 18, 2005

Sending Backup via FTP

So I was reading the SBS 2003 public newsgroup a few days ago, and one of the customers wanted to send backup files to an FTP site (for offsite storage).

This reminded me of what I did for my parents a few years back. When they wanted to backup their My Documents (they all share the same one, since its been like that for years) they would click on the backup icon on the desktop and it would send files to my server in Seattle over the internet. In the even of a harddrive failure, I could easily mail them a CD (or 2) with all their documents.

Of course the SBS backup files are a little larger than one CD, but who am I to tell you what to do with your bandwidth? I thought I'd share my learnings with my folks, and you can adapt it to meet your or your customers needs as you feel fit.

The first step is to create a "backup" batch file. The file should be called backup.cmd or backup.bat. The contents of this file are:

    @echo off
    ftp -vin -s:info.txt

Next you have to create the info.txt in the same directory as the batch file. The contents of this file are as follows:

    user [account_on_ftp_site]
    cd /[location_on_ftp_site_to_store_files]
    put [local_location_of_file]

Essentially, this will log into the FTP site, change to the approprate folder and put the file you want. You can do multiple puts if you want. The peice that I didn't show you here, was I compressed all the files into a big zip file; but seeing as the NTBackup file is already a single file, that won't help you.

So the next question is how do you place this into the backup process? Well, I would recommend doing this for one back-up a week, which will require some fancy batch programming, or simple scheduler work.

But this will get you started. I suspect the hardest part will be to get the name of the file you want to send. Perhaps the easier method would be to take the command line that bkprunner.exe uses (visible in each log file) and modify it to run natively using ntbackup to a file that you send offsite. That way you can name it the same thing each time and won't have this problem.

One other thing you might consider, is on the remote machine, setting up a scheduled task to rename the file (this will allow you to keep multiple offsite backups, since if the building falls down in the middle of the transfer, you have no offsite backup (since you have 1/2 a file on the ftp site) and all the onsite backups lost.

Hopefully this will help some of you who actually want to send GB of data over the wire.