Use tar to append?

Mike McCarty Mike.McCarty at sbcglobal.net
Fri Mar 9 16:17:56 UTC 2007


Cameron Simpson wrote:
> On 09Mar2007 03:03, Mike McCarty <Mike.McCarty at sbcglobal.net> wrote:
> | Cameron Simpson wrote:
> | >Maybe:
> | >  tar Af tarfile more-files...
> | 
> | Time comparisons, for exact same backup...
> | 
> | tar Af  0:52:07
> | gzip    0:28:52
> | total   1:20:59
> | 
> | tar cz  0:24:49
> [...]
> | Doesn't look all that efficient to me. Perhaps doing separate
> | tar and then using "r" will be better. But note that the compression
> | alone took longer than both tarring and compressing in one step.
> 
> Yeah. "tar czf" works by piping through a gzip, so it's faster than "tar cf

That's not the cause, I'm sure. For example, adding /usr/src, which is
48 KB (i.e. I deleted it, and only the directory structure remains) took
two minutes. I looked carefully at the behavior, and it appears that
tar reads the entire archive to find the EOF.

> ...; gzip ..." because the separate gzip is reading from the disc ad writing
> to the disc at the same time. The first one is reading from, ideally, another
> disc.

No, that's not it.

[snip]

> Presuming the latter, why not use one tar?
> A plain "tar cf tarfile" or "tar czf tarfile.gz" will be nice and silent and

That's the way it works now. I don't want silence, I want progress
reports of the top level directories.

[snip]

> Regarding progress reporting, "tar cvf" reports nicely but interleaves any
> error message with the TOC, which is annoying and also hides the errors. I

I don't want to watch the xterm it's running in. I want a wall.

> have a suggestion for this, which is a little tacky but may work quite
> nicely:
> 
>   >tarfile

This line looks like a syntax error to me. What is it
supposed to accomplish?

>   tar cf tarfile ... &
>   tarpid=$!       
> 
>   tailpid=`
>           exec 3>&1 1>&2
>           ( tail -f tarfile 3>&- & 
>             echo $! >&3
>           ) | ( exec 3>&-; tar tvf - | cat >/dev/tty ) &
>           ` 
> 
>   wait          # ... for the "tar cf"
>   kill $tailpid # kill the tail
> 

[snip]

> The "cat >/dev/tty" is for demo purposes, writing the TOC to the terminal. Do
> as you wish. Grepping for '/$' lists just the directories, for example.

Umm, two points. (1) Having one process writing and another reading
the same archive results in a "chase", eating lots of resources
while the reader tries to catch up with the writer. (2) I don't
want a detailed report, I want a progress report so I can know
approx. how much has been done.

[snip]

> How far does that go towards solving your problem?

I sure appreciate the effort. I don't want a detailed TOC.
I generate that while verifying that the backup looks
intact, and put that on the last CDROM. Just a little
bit every once in a while to let me know how far it's
gotten.

Mike
-- 
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
Oppose globalization and One World Governments like the UN.
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!




More information about the fedora-list mailing list