Linux: Setting Tape Modes Properly

If you have a modern SCSI tape drive and you are having problems with the test command as noted above, it may be that some program has set one or more of your SCSI driver’s options to non-default values. For example, if your driver is set to work in SysV manner, Bacula will not work correctly because it expects BSD behavior. To reset your tape drive to the default values, you can try the following, but ONLY if you have a SCSI tape drive on a Linux system:

become super user
mt -f /dev/nst0 rewind
mt -f /dev/nst0 stoptions buffer-writes async-writes read-ahead

The above commands will clear all options and then set those specified. None of the specified options are required by Bacula, but a number of other options such as SysV behavior must not be set. Bacula does not support SysV tape behavior. On systems other than Linux, you will need to consult your mt man pages or documentation to figure out how to do the same thing. This should not really be necessary though – for example, on both Linux and Solaris systems, the default tape driver options are compatible with Bacula. On Solaris systems, you must take care to specify the correct device name on the Archive device directive. See above for more details.

You may also want to ensure that no prior program has set the default block size by explicitly turning it off with:

mt -f /dev/nst0 defblksize 0

If you are running a Linux system, and the above command does not work, it is most likely because you have not loaded the appropriate mt package, which is often called mt_st, but may differ according to your distribution.

If you would like to know what options you have set before making any of the changes noted above, you can now view them on Linux systems. Do the following:

become super user
mt -f /dev/nst0 stsetoptions 0
grep st0 /var/log/messages

and you will get output that looks something like the following:

kernel: st0: Mode 0 options: buffer writes: 1, async writes: 1, read ahead: 1
kernel: st0: can bsr: 0, two FMs: 0, fast mteom: 0, auto lock: 0,
kernel: st0: defs for wr: 0, no block limits: 0, partitions: 0, s2 log: 0
kernel: st0: sysv: 0 nowait: 0

Note

The beginning of the line with the date and machine name was chopped off for presentation purposes.

Some people find that the above settings only last until the next reboot, so check this otherwise you may have unexpected problems.

Go back to the Troubleshooting chapter.

Go back to the Tape Autochanger Setup chapter.

Go back to the main Advanced Features Usage page.