LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) (http://www.linuxquestions.org/questions/linux-general-1/backup-and-restore-with-tar-tar-tar-gz-tar-bz2-tar-z-514581/)

asgarcymed 12-29-2006 08:20 AM

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.

pixellany 12-29-2006 08:54 AM

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.

trickykid 12-29-2006 02:24 PM

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.. ;)

asgarcymed 12-30-2006 04:36 AM

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?

eldoran 12-30-2006 08:45 PM

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)

asgarcymed 12-31-2006 03:53 AM

eldoran - thank you!


All times are GMT -5. The time now is 09:12 AM.