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 7th December 2008
giga giga is offline
Port Guard
 
Join Date: May 2008
Posts: 11
Default Backup to USB flash drive

What is easiest way to backup every day my server to USB flash drive (16GB)?

I like to backup full system, not only "/home", so I can easely replase my HD and restore all from flash drive if something goes wrong.

Code:
$ df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/ad0s1a    989M    268M    642M    29%    /
devfs          1.0K    1.0K      0B   100%    /dev
/dev/ad0s1g     19G    4.3G     14G    24%    /home
/dev/ad0s1f    989M    570K    910M     0%    /tmp
/dev/ad0s1d    9.7G    4.6G    4.3G    52%    /usr
/dev/ad0s1e    989M    482M    428M    53%    /var
devfs          1.0K    1.0K      0B   100%    /var/named/dev
Reply With Quote
  #2   (View Single Post)  
Old 7th December 2008
Oko's Avatar
Oko Oko is offline
Rc.conf Instructor
 
Join Date: May 2008
Location: Kosovo, Serbia
Posts: 1,102
Default

Read man pages for dump.
Reply With Quote
  #3   (View Single Post)  
Old 7th December 2008
lvlamb's Avatar
lvlamb lvlamb is offline
Real Name: Louis V. Lambrecht
Spam Deminer
 
Join Date: May 2008
Location: .be
Posts: 221
Default

dump or rsync
__________________
da more I know I know I know nuttin'
Reply With Quote
  #4   (View Single Post)  
Old 7th December 2008
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,125
Default

The smallest atom dump can backup is a filesystem, so in your case
Code:
/dev/ad0s1a (/)
/dev/ad0s1g (/home)
/dev/ad0s1f (/tmp)
/dev/ad0s1d (/usr)
/dev/ad0s1e (/var)
By default dump assumes to be working on a tape drive device. If you want to backup to a file you have to use both the -f and -a options.

You have to watch out that you don't backup the filesystem you backup device is mounted on.
E.g if you are dumping /dev/ad0s1g, your /home directory, don't mount your drive on a subdirectory of /home.
If you backup drive is mounted on "/mnt", then it is ok to dump any other filesystem, except /dev/ad0s1a (/) of course

If you are the only user, you could mount your disk on a directory in /tmp, which you probably don't want to backup anyway.

Assuming your backup drive has been mounted on /tmp/mount you could do something like this
Code:
# dump -0auf /tmp/mnt/myhome_dump0 /dev/ad0s1g
The options
Code:
0                       : level of backup   
a                       : auto-size to bypass tape length stuff
u                       : update dump statistics in /etc/dumpdates
f /tmp/mnt/myhome_dump0 : destination file 
/dev/ad0s1g             : the filesystem to be 'dump'ed
Or you could compress with gzip
Code:
# dump -0auf - /dev/ad0s1g  | gzip >/tmp/mnt/myhome_dump0.gz
Here you specify the destination file with a hyphen: -.
This means standard output, which is piped into gzip for compression.

All this works similar in FreeBSD and OpenBSD. Most system administrators will either go into single user mode, or stop daemons/programs which could generate file output during the dumping process.

With FreeBSD, you don't have to do this, if you the -L option which takes a snapshot of the filesystem and dumps the snapshot.
But I am conservative, I just go into single user mode
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #5   (View Single Post)  
Old 8th December 2008
elon elon is offline
New User
 
Join Date: Jul 2008
Posts: 3
Default

Using tar is also a common alternative. It has the advantage, that you can restore single files if something bad happened to them. The disadvantage is, that a bare metal restore needs a bit more steps done by hand.
Reply With Quote
  #6   (View Single Post)  
Old 8th December 2008
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,125
Default

Elon, you can restore individual files from a dump backup using restore -i
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
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
System freeze when connecting USB flash drive (4.4 & 4.5 but worked in 4.3) GardenGnome OpenBSD Installation and Upgrading 11 7th May 2009 02:32 PM
HOWTO: reformat a USB flash drive in NetBSD JMJ_coder Guides 0 6th February 2009 03:52 AM
which Flash Drive I must buy for FreeBSD and OpenBSD mfaridi General Hardware 18 22nd October 2008 07:43 PM
backup drive to image file milo974 OpenBSD General 8 14th August 2008 02:01 PM
USB flash drive criglerj NetBSD General 1 26th July 2008 01:25 AM


All times are GMT. The time now is 03:01 AM.


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