LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-23-2017, 05:14 PM   #1
dwhswebhosting
LQ Newbie
 
Registered: Jun 2004
Location: Earth
Distribution: CentOS 6 and 7
Posts: 27

Rep: Reputation: 0
What is the best tool for compressing and un-compressing files?


If a server crashes, we have to tar up about 200 gigs or data. We then transfer it to a new server and untar.

I was just wondering if anyone happens to know if there is a better program to tar and untar? (compress and un-compress)

When compressing millions of files into one it can take hours if not days and with customer sites possibly down, the fastest method can make a huge difference.

Thank you,
Charles
 
Old 03-23-2017, 05:43 PM   #2
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Do you have multiple processors/cores? If so, have a look at pigz (http://zlib.net/pigz/).

See here for the developer's comments on the fact that compression is much faster but decompression isn't a great advance over single core. I guess you can't have everything.

http://stackoverflow.com/questions/1...-decompression

Last edited by hydrurga; 03-23-2017 at 05:45 PM. Reason: More info
 
Old 03-23-2017, 08:31 PM   #3
dwhswebhosting
LQ Newbie
 
Registered: Jun 2004
Location: Earth
Distribution: CentOS 6 and 7
Posts: 27

Original Poster
Rep: Reputation: 0
Perfect thanks, it does have a ton of processors.
 
Old 03-24-2017, 04:11 AM   #4
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
pigz would probably be fastest but pxz might be preferable as it uses lzma compression and is the multi-threaded version of xz. while pxz might not be quiet as fast as pbzip (bzip) or pigz (gzip), it has a better compression ratio which will help when transferring the compressed data. Also remember that most these compression utilities have configurable options for compression ratio vs. speed, so check the manpages too.
 
Old 03-24-2017, 04:17 AM   #5
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,328
Blog Entries: 3

Rep: Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726
zpaq might be worth investigating.

The different compression tools work best with different types and quantities of data, so you'll probably have to test a few to see which is best for your situation.
 
Old 03-24-2017, 06:43 AM   #6
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Tar is not a tool for compression, it originally was tape archiver and wasn't intended for compression. In fact, it was designed for exactly what you are doing, backing up entire hard drives to secondary storage media.

Many of the other tools which other members have mentioned are typically for compressing, and tar can usually make use of them based on extensions or command line arguments.

If you are backing up data, I recommend still using tar, but also specifying that you wish the contents to be compressed.
 
Old 03-24-2017, 09:21 AM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,668
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
A so-called .tar.gz file is a .tar file that has been compressed using the gzip algorithm.

File transfer tools such as rsync and scp have options to apply gzip compression to the transfer, so that the data is compressed on-the-fly before being put onto the wire, and decompressed as it is being taken off.

Compression algorithms are basically a compromise between speed and file-size. In addition to gzip, "(PK)zip" and "bzip2" are in common use.
 
Old 03-24-2017, 10:25 AM   #8
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,328
Blog Entries: 3

Rep: Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726
Quote:
Originally Posted by sundialsvcs View Post
A so-called .tar.gz file is a .tar file that has been compressed using the gzip algorithm..
Yes, the old way to compress was to pipe to gzip

Code:
tar cf - ./*.odt | gzip > ~/documents.tar.gz

cd /tmp/

gzip -cd ~/documents.tar.gz | tar xf -
The same can still be done for compression methods that are not build into but that can send or receive via stdout and stdin.
 
1 members found this post helpful.
Old 03-24-2017, 03:30 PM   #9
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,993

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
There have been a number or web pages that give the various types of compression programs a review as to how well they handle files. Knowing both your system and the type of file and size of file may allow you to select the best program. Remember too that many offer levels like .gz does. It's default I think is 5 but can range from about 1 to 9 for speed versus size.
 
  


Reply

Tags
compress, tar, untar



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML compressing tool Michal Krzyz Linux - Software 5 03-26-2012 10:57 AM
Compressing tool in Linux.. your_shadow03 Linux - Newbie 2 07-10-2009 04:34 AM
Compressing VOB files eplanamente Linux - Software 6 01-04-2006 11:15 AM
compressing files master Linux - Newbie 4 03-18-2004 11:48 AM
Compressing files GtkUser Linux - Software 1 04-02-2003 06:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration