The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
Scripts / handy tips
 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Newer Topic  |  Older Topic 
 help making a backup server
Author: rich2375 
Date:   01-07-05 15:27

Hi I'm kind of new to the whole BSD world and needed some help. It deals with how to make a backup server at a different location.
I have a website running on a designated FreeBSD server that I built. I recently built a backup server for this website and copied all of my files to it. The only big thing is that it is at a different location, about 50 miles from the designated server, and I was wondering how to set up some kind of backup program where it will run if the main designated server goes down.
Any help or suggestions would be very appreciative.
Thanks again for your time and help on this question.

Reply To This Message
 Re: help making a backup server
Author: riamo 
Date:   02-08-06 19:47

I have a suggestion that might help.

1. Make an ftp or NFS server on the machine, that will be the backup server ( you can refere to handbook to know how to do that.

2. Dump your partitions ( Full filesystem backup)

//to dump root partition
shell# dump -0uLaf /path_to_remote_backup_file/FreeBSD_root /

//to dump usr partition
shell# dump -0uLaf /path_to_remote_backup_file/FreeBSD_usr /usr

//to dump var partition
shell# dump -0uLaf /path_to_remote_backup_file/FreeBSD_var /var

//to dump tmp partition
shell# dump -0uLaf /path_to_remote_backup_file/FreeBSD_tmp /tmp

//the options above means:
// 0: dump level, zeroo means full system backup, this number can be 0-9 which indicate incremental backups that will update old changed files and append the new files

// u: update the /etc/dumpdates file after successfull dump

// L: indicate that filesystem is a life filesystem (i.e no need to stop the server, backup while it is working)

// a: auto-size, make single file or volume and write untill the end of it (this option is necessary to dump the whole filesystem into one file)

// f: this option must be followed by file_name that will contain the dump filesystem

3. tarball the partitions to save diskspace (optional)
// put FreeBSD_root, FreeBSD_usr, FreeBSD_var and FreeBSD_tmp into one ompressed file called FreeBSD.tar.gz as follows

shell# tar -czf /path_to_remote_backup_file/FreeBSD.tar.gz /path_to_remote_backup_file/FreeBSD_*

//options above means
// c: create new archive
// z: compress it (produce .gz file)
// f: the file name

// remove the uncompressed FreeBSD_root,FreeBSD_usr,FreeBSD_var,FreeBSD_tmp after compressing them into one file

4. Restoring the file systems ( Full filesystem restore)
// to restore a dump filesystem you MUST cd to it first then run the restore command

// to untar the previous compressed partitions run
shell# tar -zxvf /path_to_remote_backup_file/FreeBSD.tar.gz

shell# cd /
shell# restore -xuf /path_to_remote_backup_file/FreeBSD_root

//restoring usr partition
shell# cd /usr
shell# restore -xuf /path_to_remote_backup_file/FreeBSD_usr

//restoring var partition
shell# cd /var
shell# restore -xuf /path_to_remote_backup_file/FreeBSD_var

//restoring root partition
shell# cd /tmp
shell# restore -xuf /path_to_remote_backup_file/FreeBSD_tmp

//options above means
// x: extract the entire root directory from the given file
// u: rename links if already exist
// f: file name to be restored

5. To restore subdirectories ( optionally)
// restore in interactive mode
// example for restoring apache2 directory from FreeBSD_usr file
shell# cd /usr
shell# restore -i -f /path_to_remote_backup_file/FreeBSD_usr
shell# cd local
shell# add apache2 //add apache2 directory to extraction list
shell# extract //extract all added directories in the extraction list
shell# quit

// the option i for restoring means interactive mode, in interactive mode you have a minimal shell with the follwing commands
// add: add directory to the extraction list if no arguments is given the current directory will be added to the extraction list
// delete: same as add command but it deletes the dir from extraction list

// cd: change directory
// ls: list current directory contents
// quit: exit restore
// extract: extract all added directories from extraction list

Once you do not succeed pray for god and ask for need.

Reply To This Message
 Re: help making a backup server
Author: Dan 
Date:   03-08-06 18:58

I would keep the backup server up to date with the same versions etc as in production. I would then use something like rsync to keep the web data in sync.

Note: this isn't a backup. rsync just keeps you a copy. One copy. If something is corrupted today, tomorrow after you run rsync, it'll be corrupted on your backup server too.

What you also need is backups.


Reply To This Message
 Forum List  |  Threaded View   Newer Topic  |  Older Topic 

 User Login
 User Name:
 Remember my login:
 Forgot Your Password?
Enter your email address or user name below and a new password will be sent to the email address associated with your profile.
How to get the most out of the forum