home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / perl / 6929 < prev    next >
Encoding:
Text File  |  1992-11-10  |  4.4 KB  |  107 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!destroyer!cs.ubc.ca!alberta!kakwa.ucs.ualberta.ca!news
  3. From: sherwood@space.ualberta.ca (Sherwood Botsford)
  4. Subject: Re: i need help with tar and tapes drives.
  5. Message-ID: <1992Nov10.181807.23804@kakwa.ucs.ualberta.ca>
  6. Sender: news@kakwa.ucs.ualberta.ca
  7. Nntp-Posting-Host: fenris.space.ualberta.ca
  8. Organization: University Of Alberta, Edmonton Canada
  9. References: <1992Nov9.164953.20181@fnbc.com>
  10. Date: Tue, 10 Nov 1992 18:18:07 GMT
  11. Lines: 94
  12.  
  13. Joseph Alotta writes
  14. > i am trying to tar backup files to tape. 
  15. >  
  16. > i can:
  17. > tar cvf /dev/rst0 /data/*
  18. > tar tvf /dev/rst0
  19. > tar xvf /devrst0  filenames.
  20. > without much problem.
  21. > but since my tape is not filled up, i'd like to append new files to
  22. > the end of it.
  23. >  
  24. > i tried "tar rvf /dev/rst0"  but it didn't work.  seems the r option
  25. > is unsupported on my machine.  
  26. > i ftp'd gnutar and tried "gnutar -Avf /dev/rst0"  but that didn't  
  27. work.
  28. > i got cannot backspace errors.
  29. >  
  30. > people say i should use "mt -f /dev/nrst0 -fsf 99" to get to the end  
  31. of  
  32. > thetape and then "tar cvf /dev/nrst0 *", but i don't like having to  
  33. > remember what segments i've used on the tape and what is in each  
  34. segment.
  35. > can anyone help me to get gnutar to append?
  36. >  
  37. > btw, i am using a archive dat tape and a nextstation 3.0. and perl as  
  38. a
  39. > wrapper for all these commands.
  40. >  
  41. > thanks in advance,
  42.  
  43. Appending in my limited experience only works with 9 track tapes.
  44.  
  45. You have a significant problem with Nexts in that they have a slightly  
  46. flaky interface between the tape driver and the SCSI bus.  This results  
  47. in periodic bus device reset being sent to every device.  The disk  
  48. doesn't care.  It resets, and waits for a new command.  The tape drive  
  49. on reset rewinds the tape.  The frequency of this occurence depends on  
  50. network load, and disk activity, but running backups at night, I was  
  51. getting them about once for every 4 hours of tape operation.   
  52. Increasing nbuf has since made the problem go away, or at least become  
  53. much less frequent.
  54.  
  55. When this happens, the program writing to the tape aborts, but if  
  56. embedded in a script it will carry on.
  57.  
  58. However, that this can happen at all is bad news for anyone putting  
  59. multiple archives on a tape, as a dumb script will happily clobber the  
  60. beginning of your tape.   If you are going to do this, and if your  
  61. files are important, you have to do it right.  This means you must  
  62. check the status of the drive before each write, and on finding an  
  63. error either abort the script, or reposition the tape and start again.
  64.  
  65. What does this have to do with Perl?
  66. [Begin shameless plug...]
  67.  
  68. Well, for Nexts I wrote a set of scripts called TarChive that handle  
  69. this problem from the command line.  It gives you a bit more than you  
  70. want, and it doesn't try to append.  It does however keep track how  
  71. many archives are on a tape and keeps track of what is in each archive.   
  72. It also has a mechanism for labeling tapes, and prevents overwriting  
  73. (by the scripts anyway) by someone other than the user's tape. (Even  
  74. root can't write on your tape:  You might have left it in the drive and  
  75. forgotten that cron was going to run at 2 a.m.)
  76.  
  77. TarChive is not elegant perl.  (Not very perlescent...)  I have used  
  78. perl mostly for structure, with hoards of @message=`commandline parm`.
  79. The backup part is based on gnutar.  The SCSI status is based on  
  80. parsing the output of mt. (This makes it very unportable.  Nobody  
  81. writes mt the same way.)  Tape labels are implemented by putting a very  
  82. short tar file at the beginning of the tape.  Tape ownership is tracked  
  83. by creating a file in /usr/local/tapelabels.  Every archive is written,  
  84. then read and compared to the original.  The output of the compare pass  
  85. is send to a ~/backups/TapeLabel-datestring-dirname so that later you  
  86. don't have to read the tape to find something.  (It has a header that  
  87. tells you that this archive is file number XX on Tape TapeLabel
  88.  
  89. TarChive is rugged however.  If the drive faults, it keeps track of  
  90. what archive it was at, repositions the tape to the beginning of that  
  91. archive, and restarts the operation.  I've had busy days when the drive  
  92. faulted while in the process of repositioning the tape after a fault.   
  93. It recovered from that.
  94.  
  95. Scripts for running a full user back, or for users to backup individual  
  96. directories, for labeling and for erasing tapes are included in the  
  97. package.
  98.  
  99. TarChive is on Sonata.cc.purdue.edu 
  100.