Hardware Installation Notes

Installing an OnStream DI-30 on RedHat Linux

Don't let anybody (like your brother-in-law) tell you different. Installing an OnStream DI-30 on RedHat Linux is no piece of cake. However, if you follow the steps outlined herein, you may not have to rebuild the kernel from scratch seven or eight times like we did.

First of all, the part about how the drivers are already in the kernel and you can just use 'em is, as far as we can tell, a major lie. Maybe they're in the 2.4.x kernel but they sure weren't in our 2.2.16 kernel.

Secondly, if you are using the 2.2.16 kernel, you need to get the 2.2.18 kernel, since 2.2.16 is supposedly inadequate.

Here are the steps you should take to get the drive working. Do everything as root.

  1. Install the drive in the machine. We put it on the secondary IDE as the slave. Do not, under any circumstances, put it on the primary IDE. It will cause big (timing) problems for the tape and possibly your hard drive.
  2. If you don't already have the right kernel source, go and get it. You should use 2.2.18 on systems that require a 2.2 kernel.
  3. Create a new kernel build subdirectory and unpack the kernel source into it, per the instructions in KernelBuild.
  4. Apply any patches to the kernel that are recommended for the OnStream tape drive family (see the OnStream_DI-30-RedHat_Backup_mini-HOWTO). For the 2.2.18 kernel, the IDE-Tape patch is required. You should look for "ide.2.2.18.1221.patch" on the Web and download it. If it is compressed with bzip2, you can uncompress it with:

    bunzip2 ide.2.2.18.1221.patch.bz2

    Apply the patch with the patch command:

    patch -p1 < ide.2.2.18.1221.patch
  5. Download the OnStream driver from the OnStream testers page.

    Beware! We have observed that this file is downloaded as a "...tar.gz" file when it is, in reality, a straight ".tar" file. If this happens to you, a simple rename to the correct name will work.

  6. Unpack the tarball to the directory where you want to put the OnStream source. We put our's under "usr/src/linux/drivers/onstream". To do this, copy the tarball to "usr/src/linux/drivers" and run tar:

    cd /usr/src/linux/drivers
    guzip onstream-20011111.tar.gz [possibly not required]
    tar -xvf onstream-20011111.tar
    cd ..
  7. Apply the appropriate patch for your kernel level (22 or 24), to the kernel (prior to building). If you are building the 2.2.18 kernel, use:

    patch -p1 < drivers/onstream/driver-22/osst-22.diff
  8. Copy the appropriate driver sources to the SCSI source tree (those for 2.2.18 kernel shown):

    cp -p drivers/onstream/driver-22/osst.? drivers/scsi/
    cp -p drivers/onstream/driver-22/osst_options.h drivers/scsi/
  9. Configure the kernel, according to the directions in KernelBuild. Make sure that the following options are set:

    CONFIG_SCSI=y
    CONFIG_BLK_DEV_IDETAPE=m
    CONFIG_BLK_DEV_IDESCSI=y
    CONFIG_CHR_DEV_OSST=m

    Note that most kernels default to loading the SCSI and IDE-SCSI drivers as modules but it is better to have them be resident in the kernel to detect the tape drive at startup. Consequently, you'll want to change the kernel parameters to make this happen, even if the OSST drivers are already included.
  10. In the 2.2.18 kernel, the ide-scsi driver explicitly rejects the OnStream tape drive as not doing emulation properly. Since we are now supplying an OnStream SCSI driver that does do emulation properly, the ide-scsi driver must be fixed to cause it to pass requests for the OnStream drive to the osst driver. To fix this problem, you need to patch the ide-scsi driver. The unpatched lines of code in "ide-scsi.c" read:
    
    if (strstr(drive->id->model, "OnStream DI-30")) {
         printk("ide-tape: ide-scsi emulation is not supported for %s.\n",
              drive->id->model);
         continue;
    }
      

    The patched code should read:
    
    if (strstr(drive->id->model, "OnStream DI-30")) {
         printk("ide-scsi: OnStream emulation supported for %s.\n",
              drive->id->model);
    }
      

    If you have a 2.4 kernel, this test for OnStream DI-30 emulation is no loger done so you needn't bother with fixing the ide-scsi module.
  11. In the 2.2.18 kernel, the ide-tape driver has a bug in it so that it won't coexist with the osst driver. For the OnStream drive to work with the ide-tape driver, ide-tape must be fixed to pass requests for the OnStream drive to the ide-scsi driver and then on to the osst driver. To fix this problem, you need to do the following.

    First apply the 2.2.18 patch for ide-tape.

    Then, fix the bug in the ide-tape driver. The unpatched lines of code in "ide-tape.c" read:

    
    if (drive->scsi) {
         if (strstr(drive->id->model, "OnStream DI-30")) {
              printk("ide-tape: ide-scsi emulation is not supported
                   for %s.\n", drive->id->model);
         } else {
              printk("ide-tape: passing drive %s to ide-scsi emulation.\n",
                   drive->name);
              continue;
         }
    }
      

    The patched lines of code in "ide-tape.c" are pretty much the same, except for the test being duplicated:
    
    if (drive->scsi) {
         if (strstr(drive->id->model, "OnStream DI-30")
              || (strstr(drive->id->model, "OnStream DI-30"))) {
              printk("ide-tape: init: ide-scsi emulation is not supported
                   for %s.\n", drive->id->model);
         } else {
              printk("ide-tape: init: passing drive %s to ide-scsi
                   emulation.\n", drive->name);
              continue;
         }
    }
      

    My take on this is that, if the test failed the first time, it will probably fail exactly the same way the second time (changing the text of the error messages sure ain't going to help). Somebody is obviously confused. They probably thought strstr works like strcmp or one of those other string compares that return zero if the compare is equal. Too bad strstr returns a pointer (i.e. non-zero) if it finds the string. Also, the duplicate test was probably meant to be for a second device. If the code is written like this here, makes you wonder what the rest of it is like, don't it? Good luck with this driver.

    Anyway, the code should read:

    
    if (drive->scsi) {
         if (strstr(drive->id->model, "OnStream DI-30") == NULL) {
              printk("ide-tape: init: ide-scsi emulation is not supported
                   for %s.\n", drive->id->model);
         } else {
              printk("ide-tape: init: passing drive %s to ide-scsi
                   emulation.\n", drive->name);
              continue;
         }
    }
      

    If you have a 2.4 kernel, you should check the source for "ide-tape.c" to see if it is just as screwed as the 2.2.18 code. The kernel that we had (2.4.18) had the code from before the patch, which is none-the-less broken . So, as long as the code is broken in this manner, you must fix it as described herein.
  12. Build the kernel and install it according to the directions in KernelBuild.
  13. Before building the boot sector with lilo, add the following to the "/etc/lilo.conf" file under the new kernel's configuration:

    append="hdx=scsi"

    Where "hdx" should be set to the drive where the tape is installed (e.g. "hdd" if it is the secondary slave). A typical kernel configuration might look like:

    image=/boot/vmlinuz-2.2.18
    label=test-2.2.18
    read-only
    root=/dev/hda6
    append="hdd=scsi"
  14. Set up lilo to use the new configuration:

    /sbin/lilo -v
  15. If you don't have a devfs kernel, you will need to create the device nodes by calling the "makedevs" script manually. Here is the script:
    
    #!/bin/sh
    # Script to create OnStream SC-x0 device nodes (major 206)
    # Usage: makedevs [nos [path to dev]]
    major=206
    nrs=4
    dir=/dev
    test -z "$1" || nrs=$1
    test -z "$2" || dir=$2
    declare -i nr
    nr=0
    test -d $dir || mkdir -p $dir
    while test $nr -lt $nrs; do
      mknod $dir/osst$nr c $major $nr
      chown 0.disk $dir/osst$nr; chmod 660 $dir/osst$nr;
      mknod $dir/nosst$nr c $major $[nr+128]
      chown 0.disk $dir/nosst$nr; chmod 660 $dir/nosst$nr;
      mknod $dir/osst${nr}l c $major $[nr+32]
      chown 0.disk $dir/osst${nr}l; chmod 660 $dir/osst${nr}l;
      mknod $dir/nosst${nr}l c $major $[nr+160]
      chown 0.disk $dir/nosst${nr}l; chmod 660 $dir/nosst${nr}l;
      mknod $dir/osst${nr}m c $major $[nr+64]
      chown 0.disk $dir/osst${nr}m; chmod 660 $dir/osst${nr}m;
      mknod $dir/nosst${nr}m c $major $[nr+192]
      chown 0.disk $dir/nosst${nr}m; chmod 660 $dir/nosst${nr}m;
      mknod $dir/osst${nr}a c $major $[nr+96]
      chown 0.disk $dir/osst${nr}a; chmod 660 $dir/osst${nr}a;
      mknod $dir/nosst${nr}a c $major $[nr+224]
      chown 0.disk $dir/nosst${nr}a; chmod 660 $dir/nosst${nr}a;
      let nr+=1
    done
      

    Cut this block of code and paste it into a file called "makedevs". Apply execute permissions to it, after saving it, and run it to make the device nodes:

    makedevs 1
  16. To make sure that the osst module is autoloaded whenever the tape drive is accessed, add the following to "/etc/modules.conf":

    alias char-major-206 osst
  17. You may find that creating a symbolic link, will make programs that assume a default name of "/dev/tape" more convenient to use:

    ln -s /dev/nosst0 /dev/tape
  18. Boot the new kernel. If you gave it a name of "test-2.2.18" or something like that, be sure to choose that name from the list of kernels to boot, shown by lilo.
  19. Kudzu should now recognize the tape drive and ask you about configuring it. Kudzu may also want to remove the configuration for some previously existing IDE device on the same string as the tape drive. This is OK, since it will immediately be re-added with a new ID. This is just Kudzu's way of shuffling things around.

    If Kudzu doesn't see the drive, you've done something wrong. Go back and check everything to make sure you haven't missed any steps (like patching the SCSI drivers).
  20. Once everything is working, install the kernel permanently, according to the instructions in KernelBuild.
  21. If you are seeing windges in the system messages file that look like:

    kernel: osst0:I: Old OnStream firmware revision detected (1.05),
    kernel: osst0:I: an upgrade to version 1.06 or above is recommended

    you should upgrade the firmware to the latest version (the tape drive will probably even work better/faster after you do).

    Go to the table at:

    http://www.linux1onstream.nl/product_table.html

    Find your tape drive model and download both the firmware update program and the correct microcode update. Hint, the links we followed did not download the program/update properly. You should choose "Save link as" or its equivalent from your browser. Also, the static version of the program is most likely required to do this update under the older kernels (e.g. the now-running 2.2.18 kernel).
  22. Apply the firmware upgrade to the drive (IDE 1.09 assumed):

    ./di30fix_static IDE109.bin

    Make sure you have the right firmware update (i.e. if your drive says "1.05", don't apply the "4.12" update).