LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 10-21-2003, 04:41 PM   #1
Donboy
Member
 
Registered: Aug 2003
Location: Little Rock, Arkansas
Distribution: RH, Fedora, Suse, AIX
Posts: 736

Rep: Reputation: 31
Using tar to make regular backups - pros and cons


I'm running RH9 with many different services available... apache, ProFTPd, qmail, Samba, etc etc.

These services + about 1 gig of user data live on a 30 gig drive with about 6 or 7 gig used that I want to backup. I have purchased a 60 gig USB drive that I have successfully mounted as a SCSI device (sda1). Now I'm wondering what sort of backup software to start using.

I have been told that Mondo does very good for backing up the whole thing, but I have tried using this and I'm unsure if I will be able to extract individual files from the backup to restore. It almost seems like Mondo is really only good for backing up and restoring the whole shebang and will not be able to restore individual files. Is that T/F?

I have looked at Norton Ghost, but this also seems to be the same deal.

Now I'm considering just doing a simple backup of the whole root directory (/) using tar and sending the tar file to the 60 gig drive. This drive has very little else on it, so obviously free space isn't a problem.

What are some of the caveats to running just a simple backup like this using tar. Will the permissions/ownership be intact if I restore some of the files from the tar backup? Are there any critical files that I should avoid backing up? Any other pitfalls I should know about?

I'm thinking about doing daily backups using tar, keeping the most recent 10 day's worth, and doing monthly's using Mondo just for good measure. Does this seem like a good strategy for me? Will I be able to restore corrupted programs (apache, ProFTPD, etc) from a tar file that I have made??? This is still a devel server, so I'm likely to break something and be in need of a quick restore. I'm relatively new to Linux and not sure what to expect.

Any advice welcome.
 
Old 10-21-2003, 05:23 PM   #2
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix, 98,2000 + various
Posts: 3,171

Rep: Reputation: 51
make sure you use the p option and --same-owner when restoring.
tar clfvpz - /root > whatever.tgz
tar zxvpf /whatever.tgz --same-owner

dump and restore are good if you use ext2fs.

i've been using dar for different filesystems. i really like it. it handles
the incremental backups really well.

if any part of a tar.gz file gets messed up, all the data after that point is
ruined. dar blocks the data, so you would only lose some.
 
Old 10-21-2003, 06:56 PM   #3
Donboy
Member
 
Registered: Aug 2003
Location: Little Rock, Arkansas
Distribution: RH, Fedora, Suse, AIX
Posts: 736

Original Poster
Rep: Reputation: 31
Well, I took your advice and went looking for a copy of dar. I found a copy here, which looks to be their official site...

http://dar.linux.free.fr/

I got myself a copy of the RPM from their sourceforge site, but when I installed it says I need libbz2.so.1.0 before I can install dar. When I looked up libbz2.so.1.0, I found that it was part of the bzip2 library. Now when I run... rpm -q bzip2, it says my version is bzip2-1.0.2-8 and is already installed. So I take this to mean I already have everything I need.

When I went to the bzip2 official site (http://sources.redhat.com/bzip2/) I found nothing but some executables that are for an older version of RH (like version 7 or something). Are these safe to use? How should I go about using them? There were scant few instructions on how to install them.

I'd really like to take advantage of dar, since the instructions seemed very good (which is important for me because I'm a noob) but this is quickly becoming more trouble than its worth.

Please help!
 
Old 10-22-2003, 12:15 AM   #4
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix, 98,2000 + various
Posts: 3,171

Rep: Reputation: 51
compile it yourself. that way it will use the libraries you have.

or get one of the old versions that doesn't use bzip.
i'm using an old one that just uses gzip.

Last edited by whansard; 10-22-2003 at 01:07 AM.
 
Old 10-23-2003, 09:32 PM   #5
Donboy
Member
 
Registered: Aug 2003
Location: Little Rock, Arkansas
Distribution: RH, Fedora, Suse, AIX
Posts: 736

Original Poster
Rep: Reputation: 31
Well, I downloaded the tar file and installed it that way. No problems at all. I guess I should have tried it that way from the start, but I really like how cleanly RPMs tend to install... this was a notable exception.

Anyway, I have run a full backup, restored a couple of test files, which went fine, and now I'm going to begin looking at diff backups run via cron on a daily basis. I've got a tutorial from their website which I'm sure will do fine, but I figured I would report back and let you know it's working great and also to ask if there are any scripts you may have that might help me. Looks like most of the scripts that people have written are just variations of the ones provided in the examples of the howto.

Thanks for the excellent advice. I've tried many different backup programs and none of them seem to be as nice as this.
 
Old 10-23-2003, 10:00 PM   #6
Donboy
Member
 
Registered: Aug 2003
Location: Little Rock, Arkansas
Distribution: RH, Fedora, Suse, AIX
Posts: 736

Original Poster
Rep: Reputation: 31
Also.... I am looking at the -y option that enables bzip compression. Is that any better than just using the normal -z compression? What are the advantages of using one over another?

Also, I was looking at the -Z option that allows me to disclude certain files from being zipped. The tutorials said that it doesn't make sense to use the -Z option unless you're using the -y option. Why is that???
 
Old 10-23-2003, 10:19 PM   #7
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix, 98,2000 + various
Posts: 3,171

Rep: Reputation: 51
i don't have any special scripts, but i like the way you can seperate the
catalogs from the backups, so that you can do differential backups without
accessing the full backup. dump does that with the dumpdates file, i think.
 
Old 10-23-2003, 10:28 PM   #8
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix, 98,2000 + various
Posts: 3,171

Rep: Reputation: 51
bzip2 compresses better than gzip, but is a lot slower. gzip and bzip2
take numbers for compression level 1 being lowest, i think, and 9, highest.
you can see how well yourself if you compress a file of your choice with
each at different levels. gzip -1 filename or gzip -9 filename.
gzip -9 is about the same speed as bzip2 -1.

they probably just made a slight error with the -Z and -y, and meant it doesn't
make sense to exclude files from compression when you aren't using
compression.
 
Old 10-28-2003, 06:43 AM   #9
Donboy
Member
 
Registered: Aug 2003
Location: Little Rock, Arkansas
Distribution: RH, Fedora, Suse, AIX
Posts: 736

Original Poster
Rep: Reputation: 31
Problem...

When I run my differential backups, I am automating it to run daily using a script. when I run the script, I always get an error message that comes in my mailbox. "No terminal found for user interaction. All questions will abort the program."

The script is below. I would be grateful if you can advise me on what I can do to stop the messages? I added the /dev/null lines as their tutorial specified. It says it will supress any error messages on output, but it's not working.

I'm actually getting the error twice... once for each time I'm calling the dar program. If I comment out the lines for dar -t it will only return one error message to my mailbox, even though I have the /dev/null lines.

########################

#!/bin/sh

TODAYSDATE=$(/bin/date +%A)
DIR=/mnt/usbdrive/backups/daily
FULL=/mnt/usbdrive/backups/full/full
FILE=${DIR}/${TODAYSDATE}

/usr/local/bin/dar -z -w -s 600M \
-R / \
-X "*~" -X ".*~" \
-P dev/pts \
-P proc \
-P mnt \
-P tmp \
-P root/images \
-Z "*.gz" \
-Z "*.bz2" \
-Z "*.zip" \
-D \
-c ${FILE} \
-A ${FULL} \
> /dev/null

/usr/local/bin/dar -t $FILE \
> /dev/null

/bin/chmod 700 ${DIR}/*.*

exit 0
 
Old 10-28-2003, 08:01 AM   #10
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix, 98,2000 + various
Posts: 3,171

Rep: Reputation: 51
I'm no good redirecting messeges. I haven't seen anyone else here
that uses dar either. i think there's a forum at the dar site, maybe.
 
Old 10-28-2003, 08:19 AM   #11
robartes
Member
 
Registered: Oct 2003
Location: Mechelen, BE
Distribution: Mandrake as base, most software hand rolled
Posts: 80

Rep: Reputation: 15
I use a totally different approach, based on hack #74 from Linux Server Hacks. Basically, the method uses rsync and cp with hard links to keep a number of snapshots of the filesystem at various stages. All of the snapshots are totally independent from the original filesystem, and can be used to restore either individual files, or the entire FS, but the beauty of it is that they are true snapshots, in that they only need space for files that have changed since the snapshot was taken. One word of caution: since this uses rsync, it does not handle non regular files (but then neither does tar, completely)

A perl module implementing this is available here if you want to play with this yourself.

Last edited by robartes; 10-28-2003 at 08:21 AM.
 
Old 07-30-2004, 07:04 PM   #12
ashlock
Member
 
Registered: Jul 2003
Distribution: Fedora Core 2, RH 9
Posts: 33

Rep: Reputation: 15
rdiff-backup was recommended by my local unix admin

http://rdiff-backup.stanford.edu/
 
Old 07-30-2004, 07:40 PM   #13
Donboy
Member
 
Registered: Aug 2003
Location: Little Rock, Arkansas
Distribution: RH, Fedora, Suse, AIX
Posts: 736

Original Poster
Rep: Reputation: 31
Hmmm, this is very interesting.

I actually have some questions about this, and I'd like your input if you dont mind. I have started a new thread here, since this thread is really about using tar.

http://www.linuxquestions.org/questi...hreadid=211657

If you dont mind stopping over and giving me your input, I'd be thankful.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
pros/cons of getting a G5 Tomasfuego Linux - Hardware 4 06-07-2005 04:53 AM
The Ultimate - Pros and Cons mattnedgus Linux - Software 5 02-24-2005 10:55 AM
Gnome 2.8 Pros and Cons maelstrom209 Linux - Software 0 01-27-2005 02:36 AM
pros/cons of Distributions Surfmonkey Linux - Newbie 1 11-26-2003 01:46 AM
Pros And Cons Of Linux Oliver_Bell Linux - Newbie 37 05-14-2003 08:54 AM


All times are GMT -5. The time now is 12:57 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration