1377b Backup entire system using dump - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Base System > General

General General questions about the FreeBSD operating system. Ask here if your question does not fit elsewhere.

Reply
 
Thread Tools Display Modes
  #1  
Old June 19th, 2009, 15:45
SuperMiguel SuperMiguel is offline
Junior Member
 
Join Date: May 2009
Posts: 80
Thanks: 3
Thanked 0 Times in 0 Posts
Default Backup entire system using dump

Im reading few things a about dump and i have few unclear points..

if i want to backup my entire system i tough i had to use:

dump -0 -f /mnt/externaldrive/backuplfs.dump /

This ony copies my partition: ad4s1a

then i typed:

dump -0 -f /mnt/externaldrive/backuplfs.dump /usr

which copied the partition: ad4s1f


so my question is:

since i ran the command 2 times using the same file: backuplfs.dump will this file include partitions: ad4s1a and ad4s1f?? or only the last one??

Also is there a way to backup my full file system??? with out listing the folders individually ?? like i want to back up ad4s1a (/),ad4s1d (/var),ad4s1e(/tmp) and ad4s1f(/usr) if not the command to backup everything would be:

dump -0 -f /mnt/externaldrive/backuplfs.dump / /var /tmp /usr

And if i run that command, when i run it again will it try to backup using incremental backups or it will copy everything again?
Thanks
Reply With Quote
  #2  
Old June 20th, 2009, 13:04
jb_fvwm2 jb_fvwm2 is offline
Senior Member
 
Join Date: Nov 2008
Posts: 1,385
Thanks: 60
Thanked 145 Times in 130 Posts
Default

I've no time to re-read you post, but it might be easier
to find an fstab on the web which is simlar to yours and
include then the dump command (in the
web search) (or vice versa). Someone
may have written a guide you can use that would be more
reliable and already have a restore write-up in it; the
restore is probably more critical than the backup.

Unless there is a guide here already in the HowTo section.
Reply With Quote
  #3  
Old June 20th, 2009, 13:14
graudeejs's Avatar
graudeejs graudeejs is offline
Style(9) Addict
 
Join Date: Nov 2008
Location: Riga, Latvia
Posts: 4,522
Thanks: 422
Thanked 607 Times in 475 Posts
Default

you need to dump each partition to separate file.

http://forums.freebsd.org/showthread.php?t=185


Code:
#!/bin/sh


DEFAULT_BAK_FS='root var home usr'


if [ "$USER" = 'root' ]; then
	if [ -c /dev/ufs/backup ]; then

		if [ "$1" = '--backup' ]; then
			echo '*** starting backup ***'
			echo

			mkdir "/tmp/$(basename $0).$$"

			echo '*** saving kernel configuration ***'
			cat /usr/src/sys/i386/conf/killabsd | bzip2 > "/tmp/$(basename $0).$$/killabsd.bz2"

			if [ "$2" = 'all' ]; then
				for i in $DEFAULT_BAK_FS; do
					echo "*** dumping $i ***"
					dump -h 0 -0Laf - "/dev/ufs/$i" | gzip > "/tmp/$(basename $0).$$/$i.dump.gz"
					shift
				done
			else
				while [ $2 ]; do
					echo "*** dumping $2 ***"
					dump -h 0 -0Laf - "/dev/ufs/$2" | gzip > "/tmp/$(basename $0).$$/$2.dump.gz"
					shift
				done
			fi

			bakDate="$(date '+%Y-%m-%d')"

			echo '*** Mounting ks86backup ***'
			mount -o noatime /dev/ufs/backup /mnt

			echo '*** Saving Backups ***'
			if [ ! -d '/mnt/bak' ]; then mkdir '/mnt/bak'; fi
		
			if [ ! -d "/mnt/bak/$bakDate" ]; then rm -Rf "/mnt/bak/$bakDate"; fi
			mkdir "/mnt/bak/$bakDate"
		
			cp "/tmp/$(basename $0).$$/"* "/mnt/bak/$bakDate/"

			umount /mnt
			echo '*** ks86backup unmounted ***'

			echo '*** cleaning tmp ***'
			rm -Rf "/tmp/$(basename $0).$$"
			echo "*** backup $bakDate compleate ***"
			exit 0
		elif [ "$1" = '--restore' ]; then
			echo 'not implemented yet'
			exit 1
		else
			echo 'Err: unknown command'
			exit 1
		fi
	else
		echo "Err: backup drive ain't plugged"
		exit 1
	fi
else
	echo "Err: you're not root"
	exit 1
fi

echo "Err: you shouldn't naturally see this. A bug is somwhere."
exit 1
here's my backup script.
I used this to dump important to me FS to /tmp/backup... and then to copy to my 16GB flash
It depends on UFS labels

to use this script make sure you have ufs labels in /dev/ufs/
and edit the red line

Last edited by graudeejs; June 20th, 2009 at 13:22.
Reply With Quote
  #4  
Old June 20th, 2009, 14:27
vivek's Avatar
vivek vivek is offline
Member
 
Join Date: Nov 2008
Location: Hyper Space
Posts: 809
Thanks: 3
Thanked 184 Times in 102 Posts
Default

Your are overwriting file. Use -L option to dump live file system

day0 (full backup (Sunday)):
Code:
dump -0uLf /mnt/externaldrive/week0/fsroot0.dump /
day1 (level 1 (Monday)):
Code:
dump -1uLf /mnt/externaldrive/week0/fsroot1.dump /
day2 (level 2, Tue):
Code:
dump -1uLf /mnt/externaldrive/week0/fsroot2.dump /
....
day6 (level 6 Sat):
Code:
dump -6uLf /mnt/externaldrive/week0/fsroot6.dump /
Now start same process with week1. If possible backup should be taken in single user mode (though -L option make it live backup easy). Tower of Hanoi sequence is known for the dump level scheduling. This is what we use in production. dump level
Code:
0 3 2 5 4 7 6 9 8
To do full full-restoration, you should skip these ineffective archives i.e. your sequence should be as
Code:
0 2 4 6 8
Read dump and restore man page.
__________________
Neither in this world nor elsewhere is there any happiness in store for him who always doubts. If you enjoyed my answer please consider donating some money to FreeBSD foundation @ http://www.freebsdfoundation.org/
Reply With Quote
  #5  
Old June 20th, 2009, 15:38
graudeejs's Avatar
graudeejs graudeejs is offline
Style(9) Addict
 
Join Date: Nov 2008
Location: Riga, Latvia
Posts: 4,522
Thanks: 422
Thanked 607 Times in 475 Posts
Default

I'd suggest to use fs name in dump file name.
That way if you change setup it's much easier to restore from dumps
Reply With Quote
  #6  
Old June 22nd, 2009, 14:16
SuperMiguel SuperMiguel is offline
Junior Member
 
Join Date: May 2009
Posts: 80
Thanks: 3
Thanked 0 Times in 0 Posts
Default

and using dump is a better solution than using rsync.. correct?
Reply With Quote
  #7  
Old June 22nd, 2009, 14:37
graudeejs's Avatar
graudeejs graudeejs is offline
Style(9) Addict
 
Join Date: Nov 2008
Location: Riga, Latvia
Posts: 4,522
Thanks: 422
Thanked 607 Times in 475 Posts
Default

I've never tried rsync
Reply With Quote
  #8  
Old June 29th, 2009, 01:05
CyberCr33p CyberCr33p is offline
Junior Member
 
Join Date: Nov 2008
Posts: 18
Thanks: 0
Thanked 1 Time in 1 Post
Default

The only problem with this method is doing mysql backups (not recommended).
Reply With Quote
  #9  
Old June 29th, 2009, 07:39
graudeejs's Avatar
graudeejs graudeejs is offline
Style(9) Addict
 
Join Date: Nov 2008
Location: Riga, Latvia
Posts: 4,522
Thanks: 422
Thanked 607 Times in 475 Posts
Default

Well, you can create ufs snapshot, and then dump it
I believe it solves the problem

Last edited by graudeejs; June 29th, 2009 at 09:31.
Reply With Quote
  #10  
Old June 29th, 2009, 09:14
vivek's Avatar
vivek vivek is offline
Member
 
Join Date: Nov 2008
Location: Hyper Space
Posts: 809
Thanks: 3
Thanked 184 Times in 102 Posts
Default

UFS snapshot makes *SQL online backup pretty easy without putting any load on server.
__________________
Neither in this world nor elsewhere is there any happiness in store for him who always doubts. If you enjoyed my answer please consider donating some money to FreeBSD foundation @ http://www.freebsdfoundation.org/
Reply With Quote
  #11  
Old August 12th, 2012, 04:18
Davers Davers is offline
Junior Member
 
Join Date: Nov 2011
Location: Ontario, Canada
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is giving me a head ache.
I need another beer...
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
UFS Backup graudeejs Howtos & FAQs 95 October 9th, 2012 00:20
ZFS and Dump bluetick General 15 June 3rd, 2012 19:37
How can I make the entire disk partition completely empty in a very short time? T010 Installing & Upgrading 22 June 5th, 2009 17:52
backup and dvds bluetick Off-Topic 2 April 5th, 2009 23:47
Backup of desktops guybor General 2 January 17th, 2009 02:01


All times are GMT +1. The time now is 13:37.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0