[Techtalk] Help? tar(1) -X Option Not Working

Kai MacTane kmactane at GothPunk.com
Fri Aug 30 12:05:05 EST 2002


Hi, Folks--

I'm backing up a bunch of stuff by tar(1)ing it up and FTPing it to another 
machine. I've got a couple of files, listing the stuff to be included and 
the stuff to be excluded. Using tar's -T and -X flags to direct it to these 
files, I find that it tars everything in the include file, but doesn't omit 
the stuff from the exclude file.

I've pored over the man page and it looks like I've got the syntax right. 
Can anyone advise me on this? Here are the files and the command I'm using.

/etc/include:

/etc
/var/named
/home
/var/qmail/alias
/var/qmail/control
... (and so on)

/etc/exclude:

/etc/X11/
/etc/tin/
lost+found
/home/working/
... (and so on)

The command I'm running is:

tar cvzf /backup/BackupFile -X /etc/exclude -T /etc/include

I've also tried using --exclude-from=/etc/include, with no change in 
observed behavior. Moving the -X after the -T also has no effect. Either 
way, tar starts its run, and immediately *includes* /etc/X11 and /etc/tin. 
Later, I can see it including /home/working, which is where I download and 
untar all my tarballs. This means my backups wind up including things like 
linux-2.4.19.tar.gz... *and* the entire linux-2.4.19/ source tree in 
untarred form, as well!

This is wasteful enough on its own, but similar things happen for Apache, 
BIND, and various other large packages. It's ridiculous and I want to stop it.

When tar starts, it says:

    tar: Removing leading `/' from absolute path names in the archive

I've tried removing the leading slashes in the exclude file to match, and 
that also has no effect.

Can anyone tell me what I'm doing wrong? I'm using GNU tar version 1.13.

Thanks in advance.

                                                 --Kai MacTane
----------------------------------------------------------------------
"I looked Death in the face last night,/I saw him in a mirror,
  And he simply smiled,/He told me not to worry:
  He told me just to take my time."
                                                 --Oingo Boingo,
                                                  "We Close Our Eyes"




More information about the Techtalk mailing list