jots on linux/UNIX system administration, bash and perl -Tom Rodman

about
resume

contact me
site uses txt2html

Mon 21 Sep 2009

--

DDS Tape Drives - Observations and Best Practices

At home, after writing backup data to DDS tape, I rewind, and read each tape file to validate the tape.

If that tape drive fails, I want to be able to recover using a different drive.

I have several drives, can they read
each others tapes? SCSI DDS tape drives have always been dicey, delicate devices for me. Yesterday, I ran some preliminary tests. My DDS3 drive can read DDS2 tapes created by other drives. As a rule, it appears, my DDS2 drives can read each other's tapes.

Unfortunately my DDS2 drives can not read any DDS2 tape that was written to by my DDS3 tape drive. I have checked the density of the writes with 'mt -f /dev/st0 stat', and DDS2 is reported. Needless to say I won't be creating any more DDS2 tape backups w/my DDS3 drive. After each backup, is done I update the paper label on the tape with the date, and the name of the specific tape drive that wrote it.

--
Ever have a DDS tape refuse to eject? Take the steps needed so you can see the outside of the drive itself from the side. On one side, there should be a hole in the metal drive cover, for a small screw driver. Around this hole should be a CW or CCW arrow, to suggest which way to rotate the internal screw head. It is geared down, so it takes many turns to eject the tape - as you turn, be careful, to untangle the tape media, if the drive has 'eaten the tape'.

Wed 26 Aug 2009

--

nice and backgrounding a ~/.bashrc function

Say you have a bash function defined as part of your login sequence, so it is available to your interactive shell. You want to run this function for a job you know will take hours, so you'd like to background it and run at a lower priority.

In the last example below I want to report diffs on my "day plan" (a text file 'dp') over a 6 year period; 'dp' was cron/auto checked in to RCS revision control each work day.

methods that fail, the third suggests the solution:

  ~ $ bash -c '(set -x; alias pgrep; type _history)'
  + alias pgrep
  bash: line 1: alias: pgrep: not found
  + type _history
  bash: line 1: type: _history: not found
  ~ $ bash -lc '(set -x; alias pgrep; type _history)'
  + alias pgrep
  bash: line 1: alias: pgrep: not found
  + type _history
  bash: line 1: type: _history: not found
  ~ $ bash -lic '(set -x; alias pgrep; type _history)'
  + alias pgrep
  alias pgrep='pgrep -l -f'
  + type _history
  _history is a function
  _history ()
  {
      case $BASH_VERSION in
          [12]*)
              history "$@"
          ;;
          *)
              HISTTIMEFORMAT="%x %X " history "$@"
          ;;
      esac
  }
  ~ $

So in my real world case, here is the solution:

  nice bash -lic 'hrcs -t "6 years ago" /tmp/dp' &>/var/tmp/foo &
    # 'hrcs' (show RCS history) is bash function I define for my
    # login sessions; so above job runs in background at lower
    # priority. see 'man bash': ( -l ==> login; -i ==> interactive)

--
hint at a simplier approach, that fails:

  ~ $ foo() { echo hi; }
  ~ $ foo
  hi
  ~ $ nice foo
  nice: foo: No such file or directory