LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-29-2005, 07:28 PM   #1
yougene
Member
 
Registered: Oct 2005
Posts: 65

Rep: Reputation: 15
Tar won't exclude directories.


I've been trying to get the whole backup thing down the past couple days with tar. The exclude option has been giving me problems though.


I've been trying to use this command

tar -zcvpf /archive/full-backup-`date '+%d-%B-%Y'`.tar.gz \
--directory / --exclude=mnt --exclude=proc --exclude=var/spool/squid


taken from http://www.tldp.org/LDP/lame/LAME/li...er-backup.html



Even though the exclude options are there it still tries to archive mnt, proc, and var/spool/squid



I'm running a relatively clean install of Slackware 10.2.
 
Old 11-29-2005, 08:05 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
It could well be that you're not invoking that line
from the root directory? If you don't try to prepend
all of the excluded directories with a / :}


Cheers,
Tink
 
Old 11-29-2005, 08:12 PM   #3
yougene
Member
 
Registered: Oct 2005
Posts: 65

Original Poster
Rep: Reputation: 15
I've tried running it from / , prepending a / to all the directories and both of them together. Still no luck.
 
Old 11-29-2005, 08:26 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Well ... the other thing I overlooked the first time around ...
where do you tell tar WHAT to backup in the first place?

What is that command backing up?


Cheers,
Tink
 
Old 11-29-2005, 08:37 PM   #5
yougene
Member
 
Registered: Oct 2005
Posts: 65

Original Poster
Rep: Reputation: 15
Oooops, I excluded the period at the end in the post, but it's definately in my command line.



I'm trying to backup my whole system.

Last edited by yougene; 11-29-2005 at 08:40 PM.
 
Old 11-29-2005, 10:39 PM   #6
yougene
Member
 
Registered: Oct 2005
Posts: 65

Original Poster
Rep: Reputation: 15
After tinkering with this a little bit I found that taking out the \ after the file name excluded the directories but now every directory starts with period(e.g ./bin).

tar -zcvpf /archive/full-backup-`date '+%d-%B-%Y'`.tar.gz --directory / --exclude mnt --exclude proc --exclude var/spool/squid .

What does that \ do? Are those periods in front of the directories going to be a problem when trying to restore?
 
Old 11-29-2005, 10:47 PM   #7
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 53
That \ is used to tell bash that the command spans to another line, it's usually used inside scripts. If you're running the command on a single line, then, you don't have to use it.
The ./ inside tar is fine.
 
Old 11-30-2005, 03:06 PM   #8
yougene
Member
 
Registered: Oct 2005
Posts: 65

Original Poster
Rep: Reputation: 15
Oh good.

Will the tar need any special commands since it has the period in front of every dir, or will this one do?

tar -zxvpf /archive/full-backup-09-October-1999.tar.gz
 
Old 11-30-2005, 03:48 PM   #9
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 53
Probably it needs --directory / too
 
Old 12-01-2005, 09:32 AM   #10
yougene
Member
 
Registered: Oct 2005
Posts: 65

Original Poster
Rep: Reputation: 15
Yeah it did
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
wget --exclude-directories option broken? (fc2) fsbooks Fedora 3 06-20-2009 06:08 PM
tar --exclude --exclude-from cefn Linux - Software 4 10-11-2005 07:31 PM
tar exclude-from drisay Slackware 1 12-23-2004 01:10 PM
Exclude directories when backing up with 'tar'? wolfpeach Linux - Newbie 2 06-28-2004 10:54 AM
wget & --exclude-directories Tinkster Slackware 4 07-20-2003 10:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:45 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration