Amanda-Users

Re: controlling hardware compression?

2003-05-23 11:29:04
Subject: Re: controlling hardware compression?
From: Paul Bijnens <paul.bijnens AT xplanation DOT com>
To: Mathias Körber <mathias AT koerber DOT org>
Date: Fri, 23 May 2003 17:23:23 +0200
Mathias Körber wrote:
Obviously I can turn it off on the drive itself (DIP-switch 1) but that
should also be doable using a SCSI command (thus leaving h/w comp
available for non-amanda usage if required)

Question is: How do I do that? Is there a special tape device (/dev/nrmtu0
or such for *u*ncompressed access and the driver will take card of that),
or does AMANDA know how to send SCSI commands to its device [ I could not
find anything though on first look].

I am running a 2.4.18 kernel.

So it's linux:

Possible commands (if they are installed):
   tapeinfo -f /dev/st0
   mt -t /dev/st0 status       # you need mt-st, the scsi tape version!

Also the program amtapetype in amanda 2.4.4 does a write test and detects hardware compression without any ioctl inquiry on the device.
It does not assume it's running on some OS or that the drive is a scsi
device.  It only assumes your cpu/bus must be fast enough to hold up
with the streaming tape.
To do only the test and quit, run like (takes only a few minutes):
   amtapetype -c -f /dev/st0


Under linux to turn hardware compression off:
For the next tape only:
   mt -t /dev/st0 compression off

To set the default from now on:
   mt -t /dev/st0 defcompression off


You probably also want variable blocksize:
For the next tape only:
   mt -t /dev/st0 setblk 0

To set default from now on:
   mt -t /dev/st0 defblksize 0


To automatically set compression off and variable blocksize
after a reboot, create a file /etc/stinit.def and fill with
a configuration for your drive, like:

  # DDS-2 drive
  manufacturer=ARCHIVE  model = "Python 02635-XXX" {
    can-bsr can-partitions auto-lock
    mode1 blocksize = 0 compression = 0
    #mode2 blocksize = 512 compression = 0
    #mode3 blocksize = 0 compression = 1
    #mode4 blocksize = 512 compression = 1
  }

The string after manufacturer and model can be extracted from
 /proc/scsi/scsi (Vendor == manufacturer).
See:  "man stinit"  for more info on the format.

IMPORTANT!
You also have to know that, no matter what you had executed as
setting for the compression of your drive, if you READ a tape, the
drive will set itself to what the mode of the tape was.  If you insert
a tape written with hardware compression, disable the drive hw compr
by "mt compression off" (verify with "mt status"), then read the tape,
it's back in hardware compression! (verify again with "mt status").

This implies that if you want to overwrite a tape with the other mode,
you may NOT read anything on the tape after setting the mode.

amtapetype from 2.4.4 does a write without a read (and will detect
hw compression if still on :-) ).


--
Paul Bijnens, Xplanation                            Tel  +32 16 397.511
Technologielaan 21 bus 2, B-3001 Leuven, BELGIUM    Fax  +32 16 397.512
http://www.xplanation.com/          email:  Paul.Bijnens AT xplanation DOT com
***********************************************************************
* I think I've got the hang of it now:  exit, ^D, ^C, ^\, ^Z, ^Q, F6, *
* quit,  ZZ, :q, :q!,  M-Z, ^X^C,  logoff, logout, close, bye,  /bye, *
* stop, end, F3, ~., ^]c, +++ ATH, disconnect, halt,  abort,  hangup, *
* PF4, F20, ^X^X, :D::D, KJOB, F14-f-e, F8-e,  kill -1 $$,  shutdown, *
* kill -9 1,  Alt-F4,  Ctrl-Alt-Del,  AltGr-NumLock,  Stop-A,  ...    *
* ...  "Are you sure?"  ...   YES   ...   Phew ...   I'm out          *
***********************************************************************