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   Previous Message  |  Next 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  |  Forum List  |  Flat View   Newer Topic  |  Older Topic 

 Topics Author  Date
 help making a backup server   new
rich2375 01-07-05 15:27 
 Re: help making a backup server   new
riamo 02-08-06 19:47 
 Re: help making a backup server   new
Dan 03-08-06 18:58 

 Forum List  |  Need a Login? Register Here 
 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