Re: tar Syntax Help

2005-07-08 Thread Giorgos Keramidas
On 2005-07-07 20:20, Drew Tomlinson [EMAIL PROTECTED] wrote:
 I'm trying to copy an entire file system while using an exclude file
 to avoid copying things such as /dev, /proc, etc.  I've read the man
 page and found the -X or --exclude-from tar option.  I've create a
 file called /exclude.list.  It contains lines such as:

 /exclude.list
 /dev
 /proc

 But I can't figure out how to form the correct command line.  I
 basically want to do this:

 tar -cvf - --exclude-from /exclude.list -C / . | tar xpf - -C .

Perhaps not what you're looking for, but you can perform a similar
exclude operation on the output of find(1), using one or more grep(1)
patterns and then feed the rest to cpio(1) in 'pass-through' mode:

# cd /
# find / | \
grep -v '^/dev/.*' | grep -v '^/proc/.*' | \
grep -v '^/mnt/.*' | \
cpio -p -dmvu /mnt

The most important detail above is that the childen of /dev, /proc and
/mnt are excluded, but not the directories themselves.  This is why I
trim from the output of find '^/dev/.*' but not '^/dev', '^/proc/.*' but
not '^/proc', etc.

- Giorgos

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: tar Syntax Help

2005-07-08 Thread Hornet
On 7/7/05, Drew Tomlinson [EMAIL PROTECTED] wrote:
 I'm trying to copy an entire file system while using an exclude file to
 avoid copying things such as /dev, /proc, etc.  I've read the man page
 and found the -X or --exclude-from tar option.  I've create a file
 called /exclude.list.  It contains lines such as:
 
 /exclude.list
 /dev
 /proc
 
 But I can't figure out how to form the correct command line.  I
 basically want to do this:
 
 tar -cvf - --exclude-from /exclude.list -C / . | tar xpf - -C .
 
 I've search the web and found examples that look similar to the above
 but this does not work for me.  tar attempts to copy /dev and I get all
 the associated errors.  I've tried other placements of either -X, X,
 and --exclude from on the command line various things happen from it
 just being ignored to tar thinking I want to create and archive named
 -X, etc., to tar trying to add a file named -X, etc. to the current
 archive.  I'm at a loss.
 
 I'm using 4.11 and trying to make a good backup before upgrading to
 5.4.  Can anyone tell me the secret incantation to make this work?
 
 Thanks,
 
 Drew
 
 --
 Visit The Alchemist's Warehouse
 Magic Tricks, DVDs, Videos, Books,  More!
 
 http://www.alchemistswarehouse.com
 
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]
 


I wrote this years ago,
http://www.justlinux.com/forum/showpost.php?p=294384postcount=1
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


tar Syntax Help

2005-07-07 Thread Drew Tomlinson
I'm trying to copy an entire file system while using an exclude file to 
avoid copying things such as /dev, /proc, etc.  I've read the man page 
and found the -X or --exclude-from tar option.  I've create a file 
called /exclude.list.  It contains lines such as:


/exclude.list
/dev
/proc

But I can't figure out how to form the correct command line.  I 
basically want to do this:


tar -cvf - --exclude-from /exclude.list -C / . | tar xpf - -C .

I've search the web and found examples that look similar to the above 
but this does not work for me.  tar attempts to copy /dev and I get all 
the associated errors.  I've tried other placements of either -X, X, 
and --exclude from on the command line various things happen from it 
just being ignored to tar thinking I want to create and archive named 
-X, etc., to tar trying to add a file named -X, etc. to the current 
archive.  I'm at a loss.


I'm using 4.11 and trying to make a good backup before upgrading to 
5.4.  Can anyone tell me the secret incantation to make this work?


Thanks,

Drew

--
Visit The Alchemist's Warehouse
Magic Tricks, DVDs, Videos, Books,  More!

http://www.alchemistswarehouse.com

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: tar Syntax Help

2005-07-07 Thread Matt Emmerton


 I'm trying to copy an entire file system while using an exclude file to
 avoid copying things such as /dev, /proc, etc.  I've read the man page
 and found the -X or --exclude-from tar option.  I've create a file
 called /exclude.list.  It contains lines such as:

 /exclude.list
 /dev
 /proc

 But I can't figure out how to form the correct command line.  I
 basically want to do this:

 tar -cvf - --exclude-from /exclude.list -C / . | tar xpf - -C .

 I've search the web and found examples that look similar to the above
 but this does not work for me.  tar attempts to copy /dev and I get all
 the associated errors.  I've tried other placements of either -X, X,
 and --exclude from on the command line various things happen from it
 just being ignored to tar thinking I want to create and archive named
 -X, etc., to tar trying to add a file named -X, etc. to the current
 archive.  I'm at a loss.

 I'm using 4.11 and trying to make a good backup before upgrading to
 5.4.  Can anyone tell me the secret incantation to make this work?

-X only works with specific files, not entire directories.  You will need to
list every file in /dev or /proc that you want to exclude, which is somewhat
painful.

The backup strategy that I've used on production systems is to back up each
directory in a separate tar file.  Not only does this work quicker (since
you can fire off multiple tar sessions in parallel), but you can avoid
special directories like /dev and /proc, temporary mount points such as
/cdrom and /mnt, and other directories that don't need to backed up, such as
/tmp.  It's also quite handy when you've got large volumes of data (such as
in /home) and the complete system image won't fit on a single tape.

The general notion of my script is the following:

#!/bin/sh
for i in bin boot etc home modules root sbin usr var
do
  tar cvzf /backups/$i.`date +%Y%m%d`.tar.gz $i 
done
wait
echo Backups completed!

--
Matt Emmerton

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: tar Syntax Help

2005-07-07 Thread Drew Tomlinson

On 7/7/2005 8:38 PM Matt Emmerton wrote:

 


I'm trying to copy an entire file system while using an exclude file to
avoid copying things such as /dev, /proc, etc.  I've read the man page
and found the -X or --exclude-from tar option.  I've create a file
called /exclude.list.  It contains lines such as:

/exclude.list
/dev
/proc

But I can't figure out how to form the correct command line.  I
basically want to do this:

tar -cvf - --exclude-from /exclude.list -C / . | tar xpf - -C .

I've search the web and found examples that look similar to the above
but this does not work for me.  tar attempts to copy /dev and I get all
the associated errors.  I've tried other placements of either -X, X,
and --exclude from on the command line various things happen from it
just being ignored to tar thinking I want to create and archive named
-X, etc., to tar trying to add a file named -X, etc. to the current
archive.  I'm at a loss.

I'm using 4.11 and trying to make a good backup before upgrading to
5.4.  Can anyone tell me the secret incantation to make this work?
   



-X only works with specific files, not entire directories.  You will need to
list every file in /dev or /proc that you want to exclude, which is somewhat
painful.

The backup strategy that I've used on production systems is to back up each
directory in a separate tar file.  Not only does this work quicker (since
you can fire off multiple tar sessions in parallel), but you can avoid
special directories like /dev and /proc, temporary mount points such as
/cdrom and /mnt, and other directories that don't need to backed up, such as
/tmp.  It's also quite handy when you've got large volumes of data (such as
in /home) and the complete system image won't fit on a single tape.

The general notion of my script is the following:

#!/bin/sh
for i in bin boot etc home modules root sbin usr var
do
 tar cvzf /backups/$i.`date +%Y%m%d`.tar.gz $i 
done
wait
echo Backups completed!

Thanks for your reply.  I can do it this way and will for the sake of 
speed.  However this post suggests that one can use wildcards.


http://lists.freebsd.org/pipermail/freebsd-questions/2004-July/052207.html

Have you ever tried that?  I did but was not successful.

Thanks,

Drew

--
Visit The Alchemist's Warehouse
Magic Tricks, DVDs, Videos, Books,  More!

http://www.alchemistswarehouse.com

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: tar Syntax Help

2005-07-07 Thread Matt Emmerton
 On 7/7/2005 8:38 PM Matt Emmerton wrote:
 
 I'm trying to copy an entire file system while using an exclude file to
 avoid copying things such as /dev, /proc, etc.  I've read the man page
 and found the -X or --exclude-from tar option.  I've create a file
 called /exclude.list.  It contains lines such as:
 
 /exclude.list
 /dev
 /proc
 
 But I can't figure out how to form the correct command line.  I
 basically want to do this:
 
 tar -cvf - --exclude-from /exclude.list -C / . | tar xpf - -C .
 
 I've search the web and found examples that look similar to the above
 but this does not work for me.  tar attempts to copy /dev and I get all
 the associated errors.  I've tried other placements of either -X, X,
 and --exclude from on the command line various things happen from it
 just being ignored to tar thinking I want to create and archive named
 -X, etc., to tar trying to add a file named -X, etc. to the current
 archive.  I'm at a loss.
 
 I'm using 4.11 and trying to make a good backup before upgrading to
 5.4.  Can anyone tell me the secret incantation to make this work?
 
 
 
 -X only works with specific files, not entire directories.  You will need
to
 list every file in /dev or /proc that you want to exclude, which is
somewhat
 painful.
 
 The backup strategy that I've used on production systems is to back up
each
 directory in a separate tar file.  Not only does this work quicker (since
 you can fire off multiple tar sessions in parallel), but you can avoid
 special directories like /dev and /proc, temporary mount points such as
 /cdrom and /mnt, and other directories that don't need to backed up, such
as
 /tmp.  It's also quite handy when you've got large volumes of data (such
as
 in /home) and the complete system image won't fit on a single tape.
 
 The general notion of my script is the following:
 
 #!/bin/sh
 for i in bin boot etc home modules root sbin usr var
 do
   tar cvzf /backups/$i.`date +%Y%m%d`.tar.gz $i 
 done
 wait
 echo Backups completed!
 
 Thanks for your reply.  I can do it this way and will for the sake of
 speed.  However this post suggests that one can use wildcards.

 http://lists.freebsd.org/pipermail/freebsd-questions/2004-July/052207.html

 Have you ever tried that?  I did but was not successful.

I just tried this out (on 5.4-REL) and the wildcards appear to work fine.
If you specify wildcards on the command line (ie, with --exclude or -X), you
must quote them to prevent premature expansion.

--
Matt

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: tar Syntax Help

2005-07-07 Thread Carl Delsey
Try leaving off the leading / from each line in your exclude list. I
think what is happening is that, by default, tar drops the leading / from
each file it tars up so that when you untar, it extracts all files
relative to the current directory. I think because of this, when you
specify absolute paths in your exclude file, tar fails to match them.

Alternatively, if you want to keep the absolute paths, try tar with the -P
option. Your exclude list may work as is in that case. I haven't ever
tried that myself though. Just be careful when you untar if you do use that
switch.

Carl

On Thu, Jul 07, 2005 at 08:20:50PM -0700, Drew Tomlinson wrote:
 I'm trying to copy an entire file system while using an exclude file to 
 avoid copying things such as /dev, /proc, etc.  I've read the man page 
 and found the -X or --exclude-from tar option.  I've create a file 
 called /exclude.list.  It contains lines such as:
 
 /exclude.list
 /dev
 /proc
 
 But I can't figure out how to form the correct command line.  I 
 basically want to do this:
 
 tar -cvf - --exclude-from /exclude.list -C / . | tar xpf - -C .
 
 I've search the web and found examples that look similar to the above 
 but this does not work for me.  tar attempts to copy /dev and I get all 
 the associated errors.  I've tried other placements of either -X, X, 
 and --exclude from on the command line various things happen from it 
 just being ignored to tar thinking I want to create and archive named 
 -X, etc., to tar trying to add a file named -X, etc. to the current 
 archive.  I'm at a loss.
 
 I'm using 4.11 and trying to make a good backup before upgrading to 
 5.4.  Can anyone tell me the secret incantation to make this work?
 
 Thanks,
 
 Drew
 
 -- 
 Visit The Alchemist's Warehouse
 Magic Tricks, DVDs, Videos, Books,  More!
 
 http://www.alchemistswarehouse.com
 
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]
 
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]