There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
UNIX/Linux
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Operating Systems > UNIX/Linux >
Solved: TAR (advanced) - multiple source files


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
snorkytheweasel's Avatar
Computer Specs
Senior Member with 133 posts.
 
Join Date: May 2006
Experience: UNIX/VMS:Elder Geek; DOS/Windows:Fossil
11-Mar-2008, 07:57 PM #1
Solved: TAR (advanced) - multiple source files
The web server is old and slow. It performs wonderfully on a day-to-day basis. But sometimes it chokes and times out during a large backup.

The server operates several virtual web sites. Each has several sub-directories, some of which need to be backed up nightly. Other subdirectories are large and cumbersome - and they do not require backups. Each site has
/web -- must be backed up
/users -- must be backed up
/logs -- large, no backup needed.
plus some other subdirectories that don't need to be backed up.

To make backups work more smoothly, I separated the old one process - one tar nightly backup into separate backups for each virtual site. Now I backup to create
site1.tar
site2.tar
site3.tar
and so on....

That worked for a while. But as the sites grow, the files are bigger and the tars are more likely to fail. The log files are a large part of the growth problem.

I'm going to change the backup procedure (again) to eliminate the backup of the "logs" directories.

Is there a way to express the tar command so that I can create one backup for each site, but include only 2 of the subdirectories (or exclude 1 of the subdirectories) for each site?

The current command for each site's backup is
tar -xvf site1.tar /home/site1

I'm thinking of something like tar -xvf site1.tar /home/site1/web,/home/site1/users.

I could do two backups for each site:
tar -xvf site1.tar /home/site1/web
tar -xvf site1.tar /home/site1/users

That would just double the fun.

There is no money for a new webserver. The frequency of backups and the retention policies are not negotiable.

Like the people working in public schools, this public school system's web server is overworked and underfunded. I use scripts and multiple archive directories to help manage this load, but I still have to inspect the newest TARs every day to reduce the chances of a foul-up.

15 backups (15 sites) nightly is complicated enough; 30 backups every night might push me over the edge.

I'm open to suggestions. Thanks in advance.
tomdkat's Avatar
Computer Specs
Distinguished Member with 3,494 posts.
 
Join Date: May 2006
Location: S.F. Bay Area, CA
Experience: Intermediate
11-Mar-2008, 08:03 PM #2
Looks like tar DOES (or can) have an exclude option. I would read the man page on tar on your system and see if it supports the "--exclude" option.

EDIT: Your 'tar -xvf site1.tar /home/site1/web /home/site1/users' command should also work, I believe, but I think you can omit the comma between the paths you want to tar.

Peace...
snorkytheweasel's Avatar
Computer Specs
Senior Member with 133 posts.
 
Join Date: May 2006
Experience: UNIX/VMS:Elder Geek; DOS/Windows:Fossil
11-Mar-2008, 08:34 PM #3
Quote:
Originally Posted by tomdkat View Post
Looks like tar DOES (or can) have an exclude option. I would read the man page on tar on your system and see if it supports the "--exclude" option.

EDIT: Your 'tar -xvf site1.tar /home/site1/web /home/site1/users' command should also work, I believe, but I think you can omit the comma between the paths you want to tar.

Peace...
Before posting, I tried several variants each of
tar -xvf site1.tar dir1 dir2
and
tar -xvf site1-exclude.tar /home/site1/ -exclude="/logs"
to no avail. I assumed that this ancient version of tar wasn't as advertised (in MAN)

When reading your answer, I noticed that
tar -xvf
was a command to extract from a tar, not to create a new one.

When I changed to
tar -cvf site1.tar dir1 dir2
and
tar -cvf site1-exclude.tar /home/site1/ -exclude="/logs"
it worked. Had I written the commands right the first time, I wouldn't have needed to post.

It was easier to see the mistake in your post than in my post and in my commands. Without your help, I would have been tearing my hair out for another day or 2. THX
tomdkat's Avatar
Computer Specs
Distinguished Member with 3,494 posts.
 
Join Date: May 2006
Location: S.F. Bay Area, CA
Experience: Intermediate
11-Mar-2008, 09:36 PM #4
Wow, I missed that as well. It's official, I'm a bonehead.

Glad one of us is paying attention!

Peace...
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 02:47 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.