Versione con kernel modulare
insmod tpqic02
Controllate che sia tutto a posto
dmesg |grep tpqic02
Creare il device
in /dev
Verifichiamo se esiste il file "/dev/tape"
ed eventualmente rimuoviamolo:
"ls /dev/tape"
"rm /dev/tape" (se esiste)
"mknod
/dev/tape c 12 8" oppure
"mknod
/dev/tape c 12 9"
Dei due, il primo, non riavvolge
al termine di una operazione, il secondo si'. Sarebbe consigliabile
crearli con nomi diversi per averli entrambi a disposizione.
Più
avanti, riferendomi a "/dev/tape", intenderò il
secondo.
I due numeri detti 'major e minor' sono una
caratteristica di tutti i device UNIX, ne trovate un elenco nel file
"/usr/src/linux/Documentation/devices.txt".
Se non lo abbiamo
già fatto, ora dobbiamo documentarci sui programmi "mt"
e "tar" e, volendo, anche "dump" e
"restore".
Riporto ora alcuni comandi fondamentali:
mt
"mt -f /dev/tape rewind"
riavvolge
"mt -f /dev/tape
retension" svolge e riavvolge
"mt
-f /dev/tape erase" cancella il nastro
tar
"tar -cvf /dev/tape ./*"
crea un archivio di tutti i file della directory corrente
"tar -cvzf /dev/tape ./*"
crea un archivio, compresso con gunzip, di tutti i file della
directory corrente
"tar -tvf /dev/tape"
elenca il contenuto di un archivio
"tar -xvf
/dev/tape" ripristina il contenuto dell'archivio
nella directory corrente
"tar -xvzf /dev/tape"
ripristina il contenuto dell'archivio, precedentemente
compresso con 'gunzip', nella directory corrente
Le opzioni
importanti di "tar" sono:
-c crea un archivio -A aggiunge i file ad un archivio -r append, aggiunge i file alla fine dell'archivio -t elenca il contenuto dell'archivio -u aggiorna solo i file modificati -x estrae i file -f dispositivo -M multivolume -p estrae tutti i permessi -W verifica dopo ogni scrittura -Z passa i dati a "compress" per la compressione -z passa i dati a "gunzip" per la compressione
Se si passano i dati ad un compressore, si incorre in due inconvenienti:
La perdita di un solo bit nel nastro magnetico compromette tutto l'archivio.
L'impossibilità di utilizzare l'opzione multivolume.
Installazione del pacchetto di supporto per la configurazione del driver QIC-02
STEP 14
Now, gzip -d and tar -xvf the support file, and change into that
directory:
gzip -d tpqic02-support-1.9b.tar.gz
tar -xvf tpqic02-support-1.9b.tar
cd tpqic02-support
STEP 15
Now, since the new driver is dynamically configurable, we need to edit
a configuration file.. In my case, I have a Mountain QIC-02
card/drive, so I edited 'conf-mountain'. Make sure the DMA, irq, and
port variables are all set correctly for your card. Make your best
guess about addresses/locations of other cards in your system so that
your QIC-02 card doesn't conflict with them by having the same
address/locations..
STEP 16
Now there should be a quick and very dirty Makefile in the current
(tpqic02-support) directory which I use to install this stuff.. You
may not want to install this stuff in global areas yet, in which case
skip this step... But if you want to use it you should edit it for
your preferences for where stuff should go by editting the USRBIN,
BIN, and SBIN variables (although the current values are the
recommended ones). If you want to put your conf-* and qic02conf files
in some other location than /sbin, then you should also edit the
conf-* script you're going to use, because inside your conf- script it
refers to /sbin/qic02conf. You'd have to change that to whatever
location qic02conf is in.. I recommend just keeping them in /sbin.
If you don't have /sbin, this Makefile will make it for you. If you
already have one, it will use the one you have. So edit, then run the
makefile:
emacs Makefile
make
CONFIGURAZIONE PER IL DRIVE TEAC
For the Teac MT2ST/45D I have used the following script (/dev/tape -> /dev/ntpqic-nodens):
#!/bin/sh
# QIC02 DYNCONF parameters for Teac MT2ST drive on Wangtek 30631
/usr/local/bin/qic02conf -f /dev/tape \
--drive=15 \
--card=wangtek \
--irq=5 \
--dma=1 \
--port=0x280 \
--have-dens=0 \
--have-bsf=0 \
--have-fsr=0 \
--have-bsr=0 \
--have-eod=0 \
--debug=0xfc
STEP 17
Copy 'mt' to the root floppy. Don't forget to link them statically if
you're not using shared libs on the root floppy!
[You'll also want `qic02conf' and the conf-* of your choice
on your rootdisk. ;) --hhb]
(If you have >=2 floppy drives, you may want to create a `bare bones'
recovery disk and simply use the standard root disk to boot from, then
mount the recovery floppy on the other floppy drive. Make sure you put
a copy of the root/boot disks with tape support in a safe place.)
STEP 18
Usually the `tar' program on the standard root disk is actually `pax',
which may not fully understand all GNU tar special stuff, like volume
labels. Check this before it's too late.
Make sure you have a good tar program. Check that it supports symbolic
links. GNU tar is useful because it adds Volume headers (-V) and
multivolume support, but it may not fit on your root disk. As of the
time of this writing, one could ftp this file from:
sunsite.unc.edu:/pub/Linux/system/Backup/tar1111B.taz
STEP 19
Make the device files [Check tpqic02.h for the minor bits]
mknod /dev/rmt0 c 12 4 # QIC-24
mknod /dev/rmt8 c 12 6 # QIC-120
mknod /dev/rmt16 c 12 8 # QIC-150
rm /dev/tape
mknod /dev/tape c 12 8 # Or whatever appropriate
mknod /dev/tape-d c 12 `expr 128 + 8` # ditto
mknod /dev/tape-reset c 12 255 # For resetting only
mknod /dev/tape-nodens c 12 0 # Without setting density
Make /dev/tape a copy of the device file you prefer as the default device. The names /dev/rmt? are used mainly for historic reasons. (i.e. GNU tar uses them.) NOTE: When using a drive without `set density' command, you should use minor number 0. Beware that lots of programs will default to /dev/tape, especially `mt'. Use of a tape device with any minor number other than 0 will force a `set density' command. Some drives may be unable to recognize other formats after they have received a `set density' command. The actual major number (currently 12) may be different. [Note: The minor numbers given above don't rewind automatically. Most *nix variants use ``rmtN'' for a rewinding device. If you want that behaviour, add one to the minor number.]
STEP 20
Insert a blank tape.
STEP 21
Run your particular 'conf-*' program. In my case, I type:
conf-mountain
(You actually don't need a tape in the drive to run the conf- scripts,but you would need it for the next step :)
STEP 22
Do an 'mt rewind'.
Il comando corretto e' /sbin/mt rewind
STEP 23
Now the big test:
tar -cvf /dev/tape /
If your fs is slow, the drive will not `stream' continuously. In that case, a buffering program should be used. Unfortunately, that's not available (yet?) for Linux. In the meantime, try:
tar -b 3000 -cvf /dev/tape /
[Newsflash: You may want to try ``edd''. The source for edd can be found in ftp.mei.co.jp:/free/others/edd.tar.Z.]
[Mountain NOTE: At least for me, the Mountain driver does not currently work correctly for large files.. that is, it completely hangs the system. :( If this happens for you, turning your tape drive off and on twice (slowly) should release the system and give you a prompt back. ]
STEP 24
Verify with:
mt rewind;
cd /; tar -b 3000 -dvf /dev/tape [not sure pax can do this]
[Maybe: ``cd /; tar -cvf - | cmp -'' for pax]
STEP 25
If all this works, then you might want to include the conf- script in your /etc/rc.local file. Mine has a couple of lines which say, simply:
# Configure and reset the QIC-02 tape drive
/sbin/conf-mountain
STEP 26
Take the rest of the day off! You deserve it!
NOTES FROM HENNUS:
==================
NOTE 1:
When using tapes, it is important that the tape 'streams', i.e.
doesn't start/stop all the time because that is bad for the tape as
well as for the drive. If you are cursed with a slow hard disk, you
should use a large buffer (-b option for tar) to reduce the
starting/stopping. When doing backups on heavely loaded systems
however, you may experience similar problems. Alternatively, you can
use the 'buffer' program.
NOTE 2:
A QIC-02 drive will attempt to rewind the tape after power-on and also
after it has been given a reset command. It will not rewind the tape
immediately but instead it will will delay the rewind until it is
given a command that requires actual tape movement. So, if you don't
want any nasty surprises, get used to rewinding the tape before/after
using it. Otherwise you may insert a tape that has not been rewound
and try to append to the end and discover that your data has just been
overwritten. The driver sometimes rewinds the tape after reading or
writing a file on the tape. [It should only do this when something
goes wrong...] So always make sure you know the tape position before
performing any command that will write to the tape!
NOTE 3:
The QIC-02 standard specifies that all drives should support at least
some basic commandset, and specifies some optional commands as well. I
don't know which drives support which optional commands. Some optional
commands are required for certain ioctl operations. In tpqic02.h you
can specify which commands are supported by your drive using the
TP_HAVE_... defines. You could first try it with all commands enabled
and disable the ones that return an 'illegal command' exception
status. The seek-to-end-of-recorded media is particularly useful as it
avoids re-reading the entire tape, but it will only work correctly if
you drive supports it and if there is no data recorded beyond the end
of the most recently written file.
[With the runtime config this testing has become a little easier...]
NOTE 4:
Please send me a note whether it works or not. Try to find out what
commands are supported by your drive. If I get enough feedback on
this, I will include the TP_HAVEs in the distributed sources. Bug
fixes and suggestions are of course welcome! IF YOU SEND ME A NOTE
ABOUT A PROBLEM OR BUG, MAKE SURE YOU SPECIFY WHAT VERSION OF THE
DRIVER, WHAT VERSION OF LINUX, WHAT KIND OF HARDWARE AND ANY OTHER
RELEVANT INFO YOU HAVE. The version number of the driver should be
printed on-screen when linux boots. If you have problems, please make
sure that you are using a clean Linus-distributed kernel with my
unmodified qic02 driver/patches. Otherwise contact your distributor
in case of problems.
NOTE 5:
Keep reading comp.os.linux.announce and the tape mailing list.
The tape mailing list is now distributed as Usenet News in
newsgroup "linux.dev.tape". However, not all sites carry this.
NOTE 6:
This driver will NOT work for the QIC-40/QIC-80 tape drives, like the
well-known tape drives that attach to the floppy controller. It will
not work for any kind of SCSI or IDE tape drive. It will not work for
the new Travan TR-4 tape drives.
NOTE 7:
If you are working on another (e.g. SCSI or QIC-40) tape driver,
please try to use the same sys/mtio.h file! Also, join the TAPE
mailing list! This code has not been tested in combination with SCSI
driver(s). If you do, make sure you use different interrupts, dma
numbers and IO addresses!
Enjoy!
--Hennus Bergman
hennus@cybercomm.nl
==============================================================================
This README.tape was originally written by Jeff Stern. Original README.tape
by Hennus Bergman. Please don't write me (Jeff Stern) with problems in
installation intrinsic to the driver itself.
Jeff Stern <jstern@eclectic.ss.uci.edu>.
Bibliografia