Path: utzoo!attcan!uunet!sdrc!cinnet!icc!cbp From: cbp@icc.com (Chris Preston) Newsgroups: comp.unix.questions Subject: Re: Tar file on multiple tapes Keywords: tar Message-ID: <1990Oct9.042831.20159@icc.com> Date: 9 Oct 90 04:28:31 GMT References: <1990Oct6.235203.24093@uokmax.ecn.uoknor.edu> <1990Oct7.160605.13851@hq.demos.su> Organization: Intercomputer Communications Corp., Cincinnati, OH Lines: 78 In article <1990Oct7.160605.13851@hq.demos.su> avg@hq.demos.su (Vadim G. Antonov) writes: >In article <1990Oct6.235203.24093@uokmax.ecn.uoknor.edu> jay@alliant.backbone.uoknor.edu (Jay Liang) writes: >>Is it possible to tar a single huge file on multiple tapes as dump >>would do to handle file systems that are bigger than the tape >>capacity? > > >If your local tar does not support multi-tape feature (RTFM), >you could write something like (Bourne shell): > >tar cf - your_files | while true >do echo -n "Mount the (next) tape (type CR of ^C to quit):" > gets < /dev/tty > dd of=/dev/TAPE bs=20b count=SIZE >done > >where TAPE is the name of RAW tape device and SIZE is the >size of tape in 10K records. > >If you have no (very useful) gets, the source follows: [deleted] A solution that uses `read' and `while' follows: tar cvf - /usr 2>filelist | while [ -z "$ans" ] && dd of=/dev/rmt0 bs=$BUFSIZ count=$BCOUNT do echo "\n\n\n\ttype carriage return to continue" echo "\tor any non white-space character" echo "\tand return to quit -> \c" read ans < /dev/tty #my personal version of gets #it's in the fine manual even :-) echo "\n\n\n" done # remember we quit on the first dd that is not a complete # record - 0+3 or somesuch, or do one iteration of 0+0 for sure which would seem more standard and works in sh and csh. (assuming one defines BUFSIZ and BCOUNT). One might also do this in 2400/2800? (I forget just now) block increments in order to produce high density floppy (5 1/4":3 1/2") diskettes and add a little `expr' to number them (for those of us without tape drives at home for backups ... yet). If one wanted the file list to be seen as well (smaller now, we hope), one could do: $dno=0 tfile="/tmp/foo$$" tar cvf - /usr | #put favorite compression in pipe here while [ -z "$ans" ] && dno=`expr $dno+1` && (dd of="/tmp/disk$dno" bs=$BUFSIZ count=$BCOUNT 2>$tfile) do cat $tfile # insures that the output from dd echo "ditto prompt from above\c" read ans < /dev/tty echo "\n\n\n" done rm $tfile dd is in a subshell in the second case for csh user benefit (disclaimer - which I am not). One can substitute a device in the second case as well and do away with the `expr' bit, and the test could be more explicit with regards to input (say -eq "y"). cbp --- "When Saddam Hussein stops by a Quality, Clarion, or Comfort Inn, ... ee' don' need no stinkin' discount card."