LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 12-29-2006, 07:20 AM   #1
asgarcymed
LQ Newbie
 
Registered: Dec 2006
Location: Lisboa - Portugal
Distribution: Mandriva
Posts: 12

Rep: Reputation: 0
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z)


What are the command-line parameters to make backups with tar when we want:

1) the maximum (<=> slowest) compression ratio (keeping files and folders names inside the tar file) ?

2) the minimal (<=> fastest) compression ratio (keeping files and folders names inside the tar file) ?

3) split the tar file generated (part1, part2, and so on <=> user defines parts' size) ?


Is it possible to use a "pipe" (|) to {"compress" | "split"} ?

How to restore (join the splitted parts and untar) ? Is a new "pipe" possible to restore ?

Thanks in advance.
Best regards.
 
Old 12-29-2006, 07:54 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
At first glance this looks like homework, but previous posts say not....

Pipe (|) works for any command that produces output which is readable/useful by another command. take a dumb example: "cat myfile|cd"
cd does not expect input, so the pipe is ignored.
"Is a new "pipe" possible to restore ?" I don't know what this means...

The 2 common compression schemes are gzip (.gz) and bzip2 (.bz2). gzip is faster, and bzip2 gives more compression.

"man tar" for the structure of the commands and all the details.
 
Old 12-29-2006, 01:24 PM   #3
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
Quote:
Originally Posted by pixellany
The 2 common compression schemes are gzip (.gz) and bzip2 (.bz2). gzip is faster, and bzip2 gives more compression.
There's also rzip as well, recommended for larger type files and it actually gets better compression than bzip2, but to my knowledge it's slower than both bzip2 and gzip.

Fastest to Slowest in order on smaller filesystems:

1. gzip
2. bzip2
3. rzip

Fastest to Slowest in order on larger filesystems:

1. rzip
2. bzip2
3. gzip

Best Compression Rate for smaller files and filesystems, bunch of files:

1. bzip2
2. gzip
3. rzip

Best Compression Rate for larger files and filesystems:

1. rzip
2. bzip2
3. gzip

The standard that most use would probably be gzip. There's also just zip but that's for weenies..

Last edited by trickykid; 12-29-2006 at 01:25 PM.
 
Old 12-30-2006, 03:36 AM   #4
asgarcymed
LQ Newbie
 
Registered: Dec 2006
Location: Lisboa - Portugal
Distribution: Mandriva
Posts: 12

Original Poster
Rep: Reputation: 0
Smile

trickykid - thank you!

No I know that no compression is:
tar -cf archive.tar directoryname
And it is possible to pipe it to split command:
tar -cf directoryname | split -b 100m archive.tar

What are the other commands?
 
Old 12-30-2006, 07:45 PM   #5
eldoran
LQ Newbie
 
Registered: Apr 2005
Location: Black Hawk, Colorado
Distribution: Ubuntu
Posts: 26

Rep: Reputation: 15
you can definitely pipe tar and split it into smaller files..

Try something like:

tar cvpjf - | (cd /backup;split -b 4024m - 20061217backup.tar.bz2. )

That would split things into 4G files .. adjust as necessary..

split doesn't handle output to anything other than the current directory, which is why you need the 'cd /backup' to make sure you are backing up to the directory you want to. (substitute this with the directory you want the backup files written to)
 
Old 12-31-2006, 02:53 AM   #6
asgarcymed
LQ Newbie
 
Registered: Dec 2006
Location: Lisboa - Portugal
Distribution: Mandriva
Posts: 12

Original Poster
Rep: Reputation: 0
Thumbs up

eldoran - thank you!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 10 02-23-2008 05:40 AM
.rpms, .tar.gz, .tgz, .src.rpm, & .tar.bz2 whoots Mandriva 10 10-18-2003 12:08 PM
GUI support tar.gz/tar/gz/bz2 and etc demmylls Linux - General 3 10-09-2003 07:43 PM
problem unzipping a tar.bz2 file tar: Error is not recov jyome Linux - Software 4 09-04-2003 01:04 PM
Diferance between rpm, tar, tar.gz, scr.tar, etc mobassir Linux - General 12 08-21-2003 06:30 AM


All times are GMT -5. The time now is 08:07 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration