• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

replace bzip2 with pbzip2

overmind

Well-Known Member

Thanks: 31
Messages: 332

#1
Hi,

I've noticed bzip2 does not scale (on Quad Core I have less than 1.0 load when archiving a big file with bzip2).

With pbzip2 I can speed up the archiving process x3 times.

Is ok to move bzip2 from /usr/bin/bzip2 and then create a symlink to pbzip2 ?

That would be something like this:
Code:
mv /usr/bin/bzip2 /usr/bin/bzip2.old
ln -s /usr/local/bin/pbzip2 /usr/bin/bzip2
I want that my tar utility to use bpzip2 instead of bzip2. I want to know if I break anything by using that method or if is there other approach other than the one with pipes.

The one with pipes would be:
Code:
tar cf - . | pbzip2 > ../file.tbz
or:

Code:
tar --use-compress-prog=pbzip2 -cf file.tbz .
 

mix_room

Aspiring Daemon

Thanks: 47
Messages: 598

#2
In your first example I don't see why you would need the symlink nor in the second case.

Why don't you just leave bzip2 in place, thus reducing the chances of getting other weird behaviour, and just drop in pbzip2 as an argument where you need it?
 

overmind

Well-Known Member

Thanks: 31
Messages: 332

#3
I want to use:

Code:
tar -cvjf archive.tgz *
That's why I would need a symlink.

Well, I think I'll leave it as it is and use one of my examples from previous pos, until I am sure that I don't break anything.
 

Galactic_Dominator

Active Member

Thanks: 35
Messages: 196

#4
overmind said:
I want to use:

Code:
tar -cvjf archive.tgz *
That's why I would need a symlink.

Well, I think I'll leave it as it is and use one of my examples from previous pos, until I am sure that I don't break anything.
Except that the compression algo for gzip and bzip2 is built into the tar binary. In your example, your proposed changes will have zero impact.
 

Alt

Aspiring Daemon

Thanks: 82
Messages: 726

#5
overmind said:
I want that my tar utility to use bpzip2 instead of bzip2. I want to know if I break anything by using that method or if is there other approach other than the one with pipes.

The one with pipes would be:
Code:
tar cf - . | pbzip2 > ../file.tbz
or:

Code:
tar --use-compress-prog=pbzip2 -cf file.tbz .
You can make shell alias for tar so he will alway use your prog:
Code:
alias tar tar --use-compress-prog=pbzip2
 
Top