Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

If I have a bziped tar file split over multiple dvd's what's the best way of extracting it without creating a lot of intermediate files? I don't want to first copy all the archive parts to an intermediate disk.

so far the best I can come up with is

terminal 1:

mkfifo temppipe1
mkfifo temppipe2
...
mkfifo temppipen
cat temppipe* | bunzip2 |tar -xvf -

terminal 2:

dd if=archive.tar.bz_part1 of=temppipe1
....
dd if=archive.tar.bz_partn of=temppipen

This works, allowing me to change the dvd after each dvd but strikes me as potentially creating a lot of named pipes, and potentially error prone. One typo in terminal 2 and tar is going to quit leaving no option but to start again. It's also essential to create enough names pipes at the beginning

Anyone got any better ideas?

share|improve this question
    
You should look at the --multi-volume option - One of tar's specialties is splitting an archive across multiple devices sequentially. –  Darth Android May 16 '13 at 18:45
    
Unfortunately, use of -M precludes the use of compression on all versions of tar (big down side), doesn't help at all extracting existing split archives, and has the an issue of portability. –  camelccc May 16 '13 at 20:06

1 Answer 1

up vote 2 down vote accepted

You can use a single pipe, and keep a writer open on it so it doesn't close until you are done.

terminal 1:

mkfifo temppipe
tar xvfj temppipe

terminal 2:

cat > temppipe

We won't have cat write anything to the pipe, but it's presence will keep the pipe open while we run the dd commands.

terminal 3:

dd if=archive.tar.bz_part1 of=temppipe # and so on

Then go back to terminal 2 and hit Control-D. cat will send the final end of file and tar will complete.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.