 |
|
 |
|
Next: [PATCH 3/9] virt/kvm: correct error-handling code
|
| Author |
Message |
External

Since: Feb 03, 2009 Posts: 24
|
(Msg. 1) Posted: Tue Jul 28, 2009 1:20 pm
Post subject: tar or gzip dry run? Archived from groups: alt>os>linux>debian (more info?)
|
|
|
Does anyone know of a way to determine the final file size of a tar
archiving process without actually writing anything to disk? Like a dry run?
Let's say I want to know if my final archive will fit on a given drive
*before* actually creating it? And then directly create it at the
destination, if it fits, otherwise log an error message and not archive
anything.
I have found the --list option for gzip, which lists the compressed file
size, and -c to output the file to stdout instead of disk, which I could
suppress - however that does not include the tar archiving process
(which should come first), and those two options seem to not work
together...
Any ideas?
Best Regards,
Lars |
|
| Back to top |
|
 |  |
External

Since: May 20, 2007 Posts: 45
|
(Msg. 2) Posted: Tue Jul 28, 2009 1:20 pm
Post subject: Re: tar or gzip dry run? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Tue, 28 Jul 2009 18:11:38 +0200, Lars Uffmann wrote:
> Does anyone know of a way to determine the final file size of a tar
> archiving process without actually writing anything to disk? Like a dry
> run?
>
> Let's say I want to know if my final archive will fit on a given drive
> *before* actually creating it? And then directly create it at the
> destination, if it fits, otherwise log an error message and not archive
> anything.
>
> I have found the --list option for gzip, which lists the compressed file
> size, and -c to output the file to stdout instead of disk, which I could
> suppress - however that does not include the tar archiving process
> (which should come first), and those two options seem to not work
> together...
>
> Any ideas?
>
> Best Regards,
>
> Lars
You could pipe the stdout of tar to a command to count characters. There
is no reason
tar --gzip --create --file - directory | wc -c |
|
| Back to top |
|
 |  |
External

Since: Feb 03, 2009 Posts: 24
|
(Msg. 3) Posted: Tue Jul 28, 2009 1:20 pm
Post subject: SOLVED: tar or gzip dry run? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
jellybean stonerfish wrote:
> You could pipe the stdout of tar to a command to count characters. There
> is no reason
>
> tar --gzip --create --file - directory | wc -c
>
I assume you meant to add "[..] wouldn't work"  And you are so right!
I did not know about the wc tool, and I did not find the information how
to redirect tar output to stdout. You covered both
Thanks a lot!
Lars |
|
| Back to top |
|
 |  |
External

Since: May 03, 2006 Posts: 66
|
(Msg. 4) Posted: Tue Jul 28, 2009 5:20 pm
Post subject: Re: SOLVED: tar or gzip dry run? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
jellybean stonerfish wrote:
> You could pipe the stdout of tar to a command to count characters. There
> is no reason
> tar --gzip --create --file - directory | wc -c
Lars Uffmann <aral DeleteThis @nurfuerspam.de> wrote:
> I assume you meant to add "[..] wouldn't work" And you are so right!
It looks like there may be some sarcasm there. I'm not entirely sure
why, because jellybean stonerfish's suggestion works perfectly. At least
for me:
$ tar --gzip --create --file - /boot | wc -c
tar: Removing leading `/' from member names
37972847
$
So, archiving /boot on my system would require approximately 38MB.
I must admit that, personally, I'd have used the older flags and done
it this way, but the effect is exactly the same:
$ tar czf - /boot | wc -c
Chris |
|
| Back to top |
|
 |  |
External

Since: May 20, 2007 Posts: 45
|
(Msg. 5) Posted: Wed Jul 29, 2009 3:20 am
Post subject: Re: SOLVED: tar or gzip dry run? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Tue, 28 Jul 2009 22:38:18 +0100, Chris Davies wrote:
> jellybean stonerfish wrote:
>> You could pipe the stdout of tar to a command to count characters.
>> There is no reason
>> tar --gzip --create --file - directory | wc -c
>
> Lars Uffmann <aral.RemoveThis@nurfuerspam.de> wrote:
>> I assume you meant to add "[..] wouldn't work" And you are so right!
I remember trying to say that tar would have to read everything with this
method, and there is probably a better way, but decided to make my post
short. I don't have a clue where the string "There is no reason" came
from. I don't remember typing that.
>
> It looks like there may be some sarcasm there. I'm not entirely sure
> why, because jellybean stonerfish's suggestion works perfectly. At least
> for me:
>
> $ tar --gzip --create --file - /boot | wc -c tar: Removing leading
> `/' from member names 37972847
> $
>
> So, archiving /boot on my system would require approximately 38MB.
>
> I must admit that, personally, I'd have used the older flags and done it
> this way, but the effect is exactly the same:
>
> $ tar czf - /boot | wc -c
>
> Chris
I tested it with "-czf -" and use that style of options myself. I posted
the long options to be pedantic. |
|
| Back to top |
|
 |  |
External

Since: Feb 03, 2009 Posts: 24
|
(Msg. 6) Posted: Wed Jul 29, 2009 1:20 pm
Post subject: Re: SOLVED: tar or gzip dry run? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Chris Davies wrote:
>> You could pipe the stdout of tar to a command to count characters. There
>> is no reason
>> tar --gzip --create --file - directory | wc -c
>
> Lars Uffmann <aral.DeleteThis@nurfuerspam.de> wrote:
>> I assume you meant to add "[..] wouldn't work" And you are so right!
>
> It looks like there may be some sarcasm there.
Nope, I was serious - I was completing the sentence from above the
suggestion  |
|
| Back to top |
|
 |  |
External

Since: Feb 03, 2009 Posts: 24
|
(Msg. 7) Posted: Wed Jul 29, 2009 1:20 pm
Post subject: Re: SOLVED: tar or gzip dry run? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
jellybean stonerfish wrote:
> I remember trying to say that tar would have to read everything with this
> method, and there is probably a better way, but decided to make my post
> short.
Actually I wouldn't know how there could be a better way - gzip doesn't
really know the filesize it will reach by compressing until it has
processed the whole data, I guess...
> I don't have a clue where the string "There is no reason" came from. I don't remember typing that.
OMG, it's gotta be *them*! Watch out, they are everywhere
> I tested it with "-czf -" and use that style of options myself. I posted
> the long options to be pedantic.
Actually, as a friend pointed out, -f - is merely giving the --file
option it's default value. So
# tar -cz * | wc -c
works just as fine. Glad to have such a steep learning curve still -
maybe I'm not so old yet after all ^^
Thanks again for your help, it was your solution (with -czf) that I
implemented to get things working last night - a neat little backup
script which has big room for improvement, but I will work on that
tomorrow...
Best Regards,
Lars |
|
| Back to top |
|
 |  |
External

Since: Feb 03, 2009 Posts: 24
|
(Msg. 8) Posted: Wed Jul 29, 2009 1:20 pm
Post subject: Re: SOLVED: tar or gzip dry run? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Lars Uffmann wrote:
> option it's default value. So
^^^^
its! I meant to type its!  |
|
| Back to top |
|
 |  |
External

Since: May 20, 2007 Posts: 45
|
(Msg. 9) Posted: Wed Jul 29, 2009 7:20 pm
Post subject: Re: SOLVED: tar or gzip dry run? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Wed, 29 Jul 2009 19:46:35 +0200, Lars Uffmann wrote:
> Lars Uffmann wrote:
>> option it's default value. So
> ^^^^
> its! I meant to type its!
If it belongs to it, it is it's, if you have a more than one it, it is
its, and if it belongs to more than one it, it is its'. |
|
| Back to top |
|
 |  |
External

Since: Feb 03, 2009 Posts: 24
|
(Msg. 10) Posted: Wed Jul 29, 2009 7:20 pm
Post subject: Re: SOLVED: tar or gzip dry run? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
jellybean stonerfish wrote:
>> Lars Uffmann wrote:
>>> option it's default value. So
>> ^^^^
>> its! I meant to type its!
> If it belongs to it, it is it's, if you have a more than one it, it is
> its, and if it belongs to more than one it, it is its'.
I was trying to differ from "it is"... but yes I guess in genitive case,
it's also "it's"... |
|
| Back to top |
|
 |  |
External

Since: May 03, 2006 Posts: 66
|
(Msg. 11) Posted: Tue Aug 04, 2009 11:20 am
Post subject: Re: SOLVED: tar or gzip dry run? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Lars Uffmann <aral.DeleteThis@nurfuerspam.de> wrote:
> Actually, as a friend pointed out, -f - is merely giving the --file
> option it's default value. So
That's only true for certain instances of default. By providing the "-"
explicitly you guarantee the tar will (more probably) do what you expect.
Chris |
|
| Back to top |
|
 |  |
External

Since: Feb 03, 2009 Posts: 24
|
(Msg. 12) Posted: Mon Aug 10, 2009 7:20 am
Post subject: Re: SOLVED: tar or gzip dry run? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Chris Davies wrote:
> That's only true for certain instances of default. By providing the "-"
> explicitly you guarantee the tar will (more probably) do what you expect.
(back from a business trip, sorry for the late reply) Could you
elaborate on "certain instances of default"? Otoh I did a little math
and found out I'll probably need to do a different approach since a
whole tgz archive creation will need many hours for ~ 500GB - and I
probably cannot afford to zip it all up for the backup, much less do
that twice, only to know how much disk space is needed.
I might just do an unpacked backup, that will give me a good idea of how
much disk space I need and I'll be fine as long as my backup media are
big enough...
Best Regards and thanks for your help!
Lars |
|
| Back to top |
|
 |  |
| Related Topics: | printer - is brother better than hp for debian? i want all in one.
printer - all in one is brother better easier than hp to run?
How to download youtube video into Adobe Premiere - How to download youtube video into Adobe Premiere I like to lounge around online and youtube is my favorite. Sometimes...
gzip or zlib - hi all, I'm new to this grp.I'm wrking with naukri.com. While recently wrking on compression...I am facing proble,..
Can I give password when gzip files? - Hi there, Could I set a password when I am compressing a file using gzip, so that people need put the password when..
[gentoo-dev] virtual/gzip madness - I was discussing this with kloeri and a few other devs in #gentoo-bugs this morning and they suggested I post this lis... |
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
 |
|
|