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 August 2008
cwhitmore cwhitmore is offline
Port Guard
 
Join Date: May 2008
Posts: 27
Thanked 0 Times in 0 Posts
Default Auto backup

I'd like to run a script once a week to backup /root, /usr and /var. I'd also like to tar those dump files. If I run the following script what do I need to add to it to compress the dump files? Also, will the dump commands run one after another or do I need something to start each one?

#!/bin/sh

mount /dev/d0s1 /mnt/usb

dump -0au -L -f /mnt/usb/usr.ad0s1f.dump /usr
dump -0au -L -f /mnt/usb/var.ad0s1d.dump /var
dump -0au -L -f /mnt/usb/root.ad0s1a.dump /

#end
Reply With Quote
  #2   (View Single Post)  
Old 7th August 2008
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Old man from scene 24
 
Join Date: Apr 2008
Location: Eindhoven, Netherlands
Posts: 2,080
Thanked 198 Times in 156 Posts
Default

tar doesn't compress files, it just archives them.

For compressiong, use an application such as gzip(1), bzip2(1), or p7zip(1).

gzip and bzip2 read from the standard input, not sure about p7zip.

# dump -0auf- -L /usr | gzip > /mnt/usb/usr.ad0s1f.dump.gz
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #3   (View Single Post)  
Old 8th August 2008
Weaseal's Avatar
Weaseal Weaseal is offline
Package Pilot
 
Join Date: May 2008
Location: East Coast, US
Posts: 177
Thanked 7 Times in 7 Posts
Default

Does dump write unused space? I know dd does and that always bugged me...
__________________
FreeBSD addict since 4.2-RELEASE.
My FreeBSD wiki.
Reply With Quote
  #4   (View Single Post)  
Old 8th August 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 Carpetsmoker View Post
tar doesn't compress files, it just archives them.

For compressiong, use an application such as gzip(1), bzip2(1), or p7zip(1).

gzip and bzip2 read from the standard input, not sure about p7zip.

# dump -0au -L /usr | gzip > /mnt/usb/usr.ad0s1f.dump.gz
Are you sure you're right?
I'm using:
Code:
dump -0Lauf - /usr | bzip2 >/mtn/usb/usr.ad0s1f.dump.bz2
-f - outputs to stdout
Reply With Quote
  #5   (View Single Post)  
Old 8th August 2008
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Old man from scene 24
 
Join Date: Apr 2008
Location: Eindhoven, Netherlands
Posts: 2,080
Thanked 198 Times in 156 Posts
Default

Yeah, you're right, I thought dump outputted to stdout by default ... apparently not ... (edited post)

Quote:
Does dump write unused space? I know dd does and that always bugged me...
No.
dd just copies a disk/partition/slice and is completely unaware of the filesystem.
dump on the other hand is aware of the filesystem and backs up files (Not 0's and 1's).
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #6   (View Single Post)  
Old 8th August 2008
cwhitmore cwhitmore is offline
Port Guard
 
Join Date: May 2008
Posts: 27
Thanked 0 Times in 0 Posts
Default

The bzip2 worked great. thanks.
Reply With Quote
  #7   (View Single Post)  
Old 19th August 2008
Weaseal's Avatar
Weaseal Weaseal is offline
Package Pilot
 
Join Date: May 2008
Location: East Coast, US
Posts: 177
Thanked 7 Times in 7 Posts
Default Restoring

What would be the correct way to then restore a backup made with this?
Code:
dump -0Lauf - /usr | bzip2 >/mtn/usb/usr.ad0s1f.dump.bz2
If I am reading the man page correctly, to restore into a new partiton, it would be,
Code:
newfs /dev/ad0s1f
mount /dev/ad0s1f /usr
cd /usr
bzcat usr.ad0s1f.dump.bz2 | restore -rf -
Does this look right?
__________________
FreeBSD addict since 4.2-RELEASE.
My FreeBSD wiki.
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
backup freeBSD 7.0 using Backup Exec ccc FreeBSD General 2 25th April 2009 09:23 PM
auto restart an app within wine hamba General software and network 3 25th November 2008 11:56 AM
Auto-YES? wubrgamer FreeBSD Ports and Packages 7 24th September 2008 01:58 PM
DSL auto login Weaseal FreeBSD General 3 17th June 2008 03:26 PM
Customizeable FTP auto-fetch script (OpenBSD snapshot download as example) J65nko Guides 2 1st June 2008 03:29 AM


All times are GMT. The time now is 06:05 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