DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD General

FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 11th July 2008
mwotsch mwotsch is offline
New User
 
Join Date: Jul 2008
Posts: 3
Thanked 0 Times in 0 Posts
Default backing up an entire system

Hello!

We run a production server that is of course rather important. The files on it (with the exception of databases, which are regularly backed up, and log files) don't change really. There are of course code changes, but those are pulled in from a subversion server. Nonetheless, I would like to back up the entire machine. It runs FreeBsd 6.2, and has apache, tomcat as well as postgresql on it.

A quick
Code:
#df -h
reveals
Code:
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/ad0s1a     70G    6.3G     58G    10%    /
devfs          1.0K    1.0K      0B   100%    /dev
/dev/ad2s1d     72G    8.2G     58G    12%    /opt
I read that in order to backup a live system you have to use the -L option when using dump. This should take a snapshot of the filesystem and then dump that to avoid missing changes while dump is executed.

After investigating for a while I came up with
Code:
#dump -0u -h 0 -C 16 -L -f path/to/file/to/dump/to
where -0 is for full backup, -u for update of the dumpdates file, -h 0 for honoring no nodump flags that could be set, -C 16 for cache size of 16MB, -L for live system, -f for the output file.

This makes sense to me. Also, I verified that the directory /.snap exists, so that a snapshot can be taken.

Questions are as follows:
1) What do I need to specify to be backed up? Does no argument need to be provided to backup the entire machine? Does "/" suffice? Do I need to specify the device name as in "/dev/ad0s1a"?

2) When the backup is written, will it be backed up as well and then recursively repeatedly backed up? How can I avoid that if I don't have an external device to write to? Does the option -L take care of that?

Thanks in advance,
mwotsch
Reply With Quote
  #2   (View Single Post)  
Old 11th July 2008
jbhappy's Avatar
jbhappy jbhappy is offline
Real Name: Jeff
Port Guard
 
Join Date: Jun 2008
Location: MI, US
Posts: 30
Thanked 4 Times in 3 Posts
Default

Quote:
Originally Posted by mwotsch View Post
Questions are as follows:
1) What do I need to specify to be backed up? Does no argument need to be provided to backup the entire machine? Does "/" suffice? Do I need to specify the device name as in "/dev/ad0s1a"?
you'll need to invoke a 'dump' command for each filesystem. as far as specifying a filesystem goes, see dump(8):

Quote:
The file system to be dumped is specified by the argument filesystem as either its device-special file or its mount point (if that is in a standard entry in /etc/fstab).
Quote:
Originally Posted by mwotsch View Post
2) When the backup is written, will it be backed up as well and then recursively repeatedly backed up? How can I avoid that if I don't have an external device to write to? Does the option -L take care of that?
with a dump snapshot (-L or mksnap_ffs(8) + mdconfig(8)), you can probably dump to the filesystem you're backing up, though if you have room on the smaller filesystem for a dump of the larger filesystem, you should consider dumping one filesystem to a file on the other fs, move the dump file off the system, and then dump the other fs to a file on the first fs. but if you don't have an archive filesystem (one that holds backups but never gets backed up, whether on the same host or another), you will definitely back up your dump files unless you start doing something like shuffling all backup files off of the filesystem you're backing up.

if backup storage space is an issue, try "-f - | bzip2 > fs.dump.bz2" instead of "-f filename" to compress on-the-fly.
Reply With Quote
  #3   (View Single Post)  
Old 14th July 2008
mwotsch mwotsch is offline
New User
 
Join Date: Jul 2008
Posts: 3
Thanked 0 Times in 0 Posts
Default

jbhappy,

Thanks for the response. I checked and the contents of /etc/fstab are as follows:
Code:
# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/ad0s1b           none                swap     sw                 0            0
/dev/ad0s1a           /                       ufs         rw                 1            1
/dev/ad2s1d           /opt                  ufs        rw                  2            2
Hence, I should be able to sump / to /opt, then pull that file off the server, and then back up /opt to / and then pull that one down.

So, am I correct in the assumption that the command
Code:
/sbin/dump -0u -f /dev/nsa0 /usr/src
backs up /usr/src to /dev/nsa0, which I think is a tape drive?

Would the following command then do the job?
Code:
#dump -0u -h 0 -C 16 -L -f /opt/path/to/backupfile /
Then move /opt/path/to/backupfile away from that machine altogether and delete it. Then do a
Code:
#dump -0u -h 0 -C 16 -L -f /path/to/backupfile /opt
and remove that file from the server as well.

Thanks for your help.
mwotsch
Reply With Quote
  #4   (View Single Post)  
Old 14th July 2008
graudeejs's Avatar
graudeejs graudeejs is offline
Real Name: Aldis Berjoza
formerly killasmurf86
 
Join Date: Jul 2008
Location: Riga, Latvia
Posts: 588
Thanked 29 Times in 26 Posts
Default

Quote:
Originally Posted by mwotsch View Post
jbhappy,

Thanks for the response. I checked and the contents of /etc/fstab are as follows:
Code:
# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/ad0s1b           none                swap     sw                 0            0
/dev/ad0s1a           /                       ufs         rw                 1            1
/dev/ad2s1d           /opt                  ufs        rw                  2            2
Hence, I should be able to sump / to /opt, then pull that file off the server, and then back up /opt to / and then pull that one down.

So, am I correct in the assumption that the command
Code:
/sbin/dump -0u -f /dev/nsa0 /usr/src
backs up /usr/src to /dev/nsa0, which I think is a tape drive?

Would the following command then do the job?
Code:
#dump -0u -h 0 -C 16 -L -f /opt/path/to/backupfile /
Then move /opt/path/to/backupfile away from that machine altogether and delete it. Then do a
Code:
#dump -0u -h 0 -C 16 -L -f /path/to/backupfile /opt
and remove that file from the server as well.

Thanks for your help.
mwotsch
No, you need -a if you back up to file

I woul use:
Code:
dump -0Lauf - /dev/slice | bzip2 > /backup/file.bz2
or
dump -0Lauf /backup/file /dev/slice
-L is if you backup slice on system, that you are running (meaning, you don't use live CD)
-u can be skipped



EDIT uh sorry, my mistake about that /sbin/dump -0u -f /dev/nsa0 /usr/src
Ignore this post

Edit: there was mistake in 2nd example

Last edited by graudeejs; 14th July 2008 at 06:11 PM.
Reply With Quote
  #5   (View Single Post)  
Old 14th July 2008
mwotsch mwotsch is offline
New User
 
Join Date: Jul 2008
Posts: 3
Thanked 0 Times in 0 Posts
Default

Thanks killasmurf,

Why do I need -a if dumping to a file? The man page does not specify that. Will it otherwise create a too large file?

So I am beginning to understand this a bit better. I was originally under the assumption that I could back up the system with one simple command but it seems that I need one for
Code:
/dev/ad0s1a
and one for
Code:
/dev/ad2s1d
Thanks, mwotsch
Reply With Quote
  #6   (View Single Post)  
Old 14th July 2008
graudeejs's Avatar
graudeejs graudeejs is offline
Real Name: Aldis Berjoza
formerly killasmurf86
 
Join Date: Jul 2008
Location: Riga, Latvia
Posts: 588
Thanked 29 Times in 26 Posts
Default

if you won't include -a flat, dmup will calculate some tabe blocks or something, and write only as much as these can be filles (whic is very small), and then ask to dumb question... i don't remember what exactly....

Code:
     -a      ``auto-size''.  Bypass all tape length considerations, and
	     enforce writing until an end-of-media indication is returned.
	     This fits best for most modern tape drives.  Use of this option
	     is particularly recommended when appending to an existing tape,
	     or using a tape drive with hardware compression (where you can
	     never be sure about the compression ratio).

Whit -a dump will write as long as there is space on disk. or dump is ended.....
and there won't be problems.....
I did it many times....

to restore dump you need to format slice (newfs /dev/slice or newfs -U /dev/slice), then mount it, ch into mount point, and restore -rf /path/to/dumpfile
or bzcat /pat/to/dumpfile.bz2 | restore -rf -
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cloning an entire drive? spiderpig OpenBSD General 10 7th May 2012 12:23 PM
How can I move this system? Randux FreeBSD Installation and Upgrading 7 3rd February 2009 09:01 AM
system resources gosha OpenBSD General 7 30th January 2009 12:01 AM
Which file system use to share data on Bsd system? aleunix Other BSD and UNIX/UNIX-like 2 1st June 2008 04:14 PM
backing up via 'dump'... Damien787 FreeBSD General 5 8th May 2008 01:05 AM


All times are GMT. The time now is 05:08 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick