[chuug] tape question
Jeff King
peff at peff.net
Wed May 30 17:21:38 EDT 2007
On Wed, May 30, 2007 at 11:03:51AM -0400, Josh Malone wrote:
> I have 1 command that spits lots of data (a tar stream, actually) out
> on stdout. I need to make that stream go to a tape....but - I need to
> be able to span tapes. I.e., I'm looking for a program that will take
> stdin and write it to tape while interactively allowing me to change
> tapes.
GNU tar has --tape-length (aliased to -L), but BSD tar does not.
> Does anybody know of such a program (or a techinique I could use to
> create said program in perl, etc.)? I've been unable to convince tar,
> pax or cpio to do that for me - although that's not to say there isn't
> a way.
You could do it with a shell loop and dd:
tar cf - $FILES |
while true; do
echo >/dev/tty Insert next tape
read </dev/tty junk
dd bs=1M count=$SIZE_OF_TAPE
done >$TAPEDRIVE
Unfortunately, dd doesn't signal premature EOF on input, so it is up to
you to read the stderr output of dd and see when you have finished (by
doing a shorter than maximal read). Parsing stderr to end the loop
automagically is an exercise for the reader.
Or is writing to the tape drive harder than just throwing stuff to
stdout?
-Peff
More information about the Chuug
mailing list