Unix administration - Why tar take me so much time?

This is Interesting: Free IT Magazines  
Home > Archive > Unix administration > December 2007 > Why tar take me so much time?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Why tar take me so much time?
byang

2007-12-26, 1:39 am

Hi,
I find that tar command has some absolute flaw. Take an example, I
have an archive with 10000 files in a .tar.bz2 file. And I want to know
whether there is a file called "abc/abc/abc.txt" in it. I just run

tar -j -f archive.tar.bz2 -t "abc/abc/abc.txt"

And after two second it gives me an answer that there is one. But it
still run. But why does it still run, if the archive's files is sorted,
it can stop now, why does it still run?

And so does the extract process.

tar -j -f archive.tar.bz2 -x "abc/abc/abc.txt"

is running too more time than it need, I think . Is it necessary for it
to run so long?

Regards!
Bo

loki harfagr

2007-12-26, 7:34 am

On Wed, 26 Dec 2007 13:37:48 +0800, byang wrote:

> Hi,
> I find that tar command has some absolute flaw. Take an example, I
> have an archive with 10000 files in a .tar.bz2 file. And I want to know
> whether there is a file called "abc/abc/abc.txt" in it. I just run
>
> tar -j -f archive.tar.bz2 -t "abc/abc/abc.txt"
>
> And after two second it gives me an answer that there is one. But it
> still run. But why does it still run, if the archive's files is sorted,
> it can stop now, why does it still run?
>
> And so does the extract process.
>
> tar -j -f archive.tar.bz2 -x "abc/abc/abc.txt"
>
> is running too more time than it need, I think . Is it necessary for it
> to run so long?


As we have no idea of what a "correct time" would be on your system for
this type of disk and size of files within the load you may have that's
quite hard to tell!

Could you check in your logs if there are any hard-disk failure signs?
You may try and run your untar command with the 'verbose' flag
to see if the slowdown is on specific file(s) or general.
You may also try the same tar+untar tests with the gzip in place
of the bzip.
Also, if you have some spare RAM, mount a partition in RAM
and do the same tests, that'd get rid of the possible HD failure.



--
have space suit : "VMSBUX:B0N1@GOHH.GO"
will travel : tr "MLKJHGFDSQNBVCXWPOIUYTREZA" "a-z"
loki harfagr

2007-12-26, 7:34 am

On Wed, 26 Dec 2007 13:37:48 +0800, byang wrote:

> Hi,
> I find that tar command has some absolute flaw. Take an example, I
> have an archive with 10000 files in a .tar.bz2 file. And I want to know
> whether there is a file called "abc/abc/abc.txt" in it. I just run
>
> tar -j -f archive.tar.bz2 -t "abc/abc/abc.txt"
>
> And after two second it gives me an answer that there is one. But it
> still run. But why does it still run, if the archive's files is sorted,
> it can stop now, why does it still run?
>
> And so does the extract process.
>
> tar -j -f archive.tar.bz2 -x "abc/abc/abc.txt"
>
> is running too more time than it need, I think . Is it necessary for it
> to run so long?


Besides my oher post, could you also test with the tar arguments in
a straight way?

like:
$ tar -j -f -x archive.tar.bz2 "abc/abc/abc.txt"
and:
$ tar xjvf archive.tar.bz2 "abc/abc/abc.txt"
Doug Freyburger

2007-12-26, 1:25 pm

byang <techr...@eyou.com> wrote:
>
> =A0 =A0I find that tar command has some absolute flaw. Take an example, I
> have an archive with 10000 files in a .tar.bz2 file. And I want to know
> whether there is a file called "abc/abc/abc.txt" in it. I just run
>
> tar -j -f archive.tar.bz2 -t "abc/abc/abc.txt"
>
> And after two second it gives me an answer that there is one. But it
> still run. But why does it still run,


tar reads the entire archive. I have no idea why you think it should
exit just because it found the file you are looking for.

> if the archive's files is sorted,
> it can stop now, why does it still run?


It might not be sorted. tar does support multiple copies of the same
file because it supports appending to an existing archive.

That and the fact that exitting when a file is located takes more
coding
to work correctly and it often isn't what the user wants.

> And so does the extract process.
>
> tar -j -f archive.tar.bz2 -x "abc/abc/abc.txt"
>
> is running too more time than it need, I think . Is it necessary for it
> to run so long?
>
> Regards!
> Bo


Thorbjoern Ravn Andersen

2007-12-26, 1:25 pm

Doug Freyburger <dfreybur@yahoo.com> writes:

> That and the fact that exitting when a file is located takes more
> coding to work correctly and it often isn't what the user wants.


From "man tar" on FreeBSD:

"
--fast-read (-W fast-read)
(x and t mode only) Extract or list only the first archive entry
that matches each pattern or filename operand. Exit as soon as
each specified pattern or filename has been matched. By default,
the archive is always read to the very end, since there can be
multiple entries with the same name and, by convention, later
entries overwrite earlier entries. This option is provided as a
performance optimization.
"

So some tar's support it. You just need to specify it.

Please make yourself familiar with the manual system - it is very
powerful online documentation. Unfortunately the modern commands
available under Unix with a GUI usually fail to provide a manual page.
--
Thorbjørn Ravn Andersen
byang

2007-12-27, 7:34 am

Thorbjoern Ravn Andersen wrote:
> Doug Freyburger <dfreybur@yahoo.com> writes:
>
>
> From "man tar" on FreeBSD:
>
> "
> --fast-read (-W fast-read)
> (x and t mode only) Extract or list only the first archive entry
> that matches each pattern or filename operand. Exit as soon as
> each specified pattern or filename has been matched. By default,
> the archive is always read to the very end, since there can be
> multiple entries with the same name and, by convention, later
> entries overwrite earlier entries. This option is provided as a
> performance optimization.
> "
>
> So some tar's support it. You just need to specify it.
>
> Please make yourself familiar with the manual system - it is very
> powerful online documentation. Unfortunately the modern commands
> available under Unix with a GUI usually fail to provide a manual page.

I have look into the manual before I ask in this group. But I did not
find the options you specify. I think it is not a standard option.

Regards!
Bo

Bill Vermillion

2007-12-27, 1:24 pm

In article <fkstsj$git$1@news.cn99.com>, byang <techrazy@eyou.com> wrote:
>Hi,
> I find that tar command has some absolute flaw. Take an example, I
>have an archive with 10000 files in a .tar.bz2 file. And I want to know
>whether there is a file called "abc/abc/abc.txt" in it. I just run
>
>tar -j -f archive.tar.bz2 -t "abc/abc/abc.txt"


>And after two second it gives me an answer that there is one. But it
>still run. But why does it still run, if the archive's files is sorted,
>it can stop now, why does it still run?


It still runs because it does not know that there is only one
file with that name on the tape. It will run to the end of the
archive unless you interupt it.

Bill

--
Bill Vermillion - bv @ wjv . com
Thorbjoern Ravn Andersen

2007-12-27, 1:24 pm

byang <techrazy@eyou.com> writes:

> I have look into the manual before I ask in this group. But I did not
> find the options you specify. I think it is not a standard option.


In that case you may want to describe what your environment is in more
detail.

If your standard tar does not do what you want it to, then you may want
to install one that do.

--
Thorbjørn Ravn Andersen
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com