LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   split - rejoin problem on tar.bz2 backup (https://www.linuxquestions.org/questions/linux-software-2/split-rejoin-problem-on-tar-bz2-backup-769455/)

garydale 11-16-2009 09:58 AM

split - rejoin problem on tar.bz2 backup
 
Call me old school, but I've been running a server backup using a simple custom script & a cron job to create a backup to dvd-ram.

The theory behind the it is I create a tar.bz2 file on disk, split it into 1G segments (using split) to avoid the old (obsolete, but never got around to removing it from my script) 1G limit on UDF files) then copy the split portions to dvd-ram.

As the backup progresses, I compare the dvd-ram segments to the segments on disk before erasing them. I send myself an e-mail on compare failure (I give the copy/compare three tries before declaring failure).

However, when I (rarely) get called to restore a file, I get into problems. "cat"ing the files together to recreate the original tar.bz2 file leaves me with corruption on the bz2 file.

I can generally get the file back after much wailing and gnashing of teeth, but I'm hoping someone can figure out what is going wrong.

Thanks.

anotherlinuxuser 11-17-2009 12:02 AM

You may want to try 'bzcat' instead of 'cat' to rejoin the files into one bz2 file. bzcat will attempt to create a valid .bz2 file. 'cat' will blindly join the files, but will do no consistency checks. btw, there is also 'zcat' for gzipped files.

garydale 11-18-2009 12:15 PM

Quote:

Originally Posted by anotherlinuxuser (Post 3759604)
You may want to try 'bzcat' instead of 'cat' to rejoin the files into one bz2 file. bzcat will attempt to create a valid .bz2 file. 'cat' will blindly join the files, but will do no consistency checks. btw, there is also 'zcat' for gzipped files.

Not quite. bzcat unzips while concatenating. It won't join a split bzip2 file because the first "archive" ends unexpectedly - at the split point. The output of bzcat is an unzipped file or files.

I actually tried your suggestion in case the man pages were wrong, but bzcat behaves as I described.

Thanks anyway.


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