SUMMARY: How to free a "busy" tape drive without rebooting?

From: Johan Nyberg (nyberg@unix.tsl.uu.se)
Date: Thu Mar 18 1999 - 14:11:11 CST


Hi Sun Managers,

Sorry for the delayed summary. I got several answers but none of them
helped solving the problem I had with accessing a locked up tape
drive. Finally I had to reboot the machine to free the tape drive. My
original question is at the end of this letter.

Thanks to:

Damir Delija <ddelija@srce.hr>
Robert Hill <Robert_Hill@cch.com>
Jeff Brody <jbrody@usgs.gov>
Daniel Beaudry <Daniel.Beaudry@enter-net.com>
Dale Shaw <Dale.Shaw@select.com.au>

Here is a summary of the suggestions:

1. Use command 'fuser'
----------------------

Most people suggested me to try the command 'fuser'. I tried several
versions of this:

  # mt -f /dev/rmt/2 status
  /dev/rmt/2: Device busy
  # fuser /dev/rmt/2
  /dev/rmt/2:
  # fuser -u /dev/rmt/2
  /dev/rmt/2:
  # ls -l /dev/rmt/2
  lrwxrwxrwx 1 root root 50 Jun 24 1997 /dev/rmt/2 ->
    ../../devices/sbus@1f,0/SUNW,fas@e,8800000/st@4,0:
  # fuser /devices/sbus@1f,0/SUNW,fas@e,8800000/st@4,0:
  /devices/sbus@1f,0/SUNW,fas@e,8800000/st@4,0::
  # fuser -u /devices/sbus@1f,0/SUNW,fas@e,8800000/st@4,0:
  /devices/sbus@1f,0/SUNW,fas@e,8800000/st@4,0::

but as you can see fuser does not report that somebody is using the
file /dev/rmt/2.

2. Use command 'lsof'
---------------------

Jeff Brody <jbrody@usgs.gov> suggested I should use the program 'lsof':

# lsof /dev/rmt/2
#

This did not either list any process that holds the tape drive.

3. Remove lock files in /var/spool/locks/
-----------------------------------------

Jeff Brody <jbrody@usgs.gov> suggested I should remove any lock files
/var/spool/locks/LCK* associated with the tape drive. I checked this
directory but it contained now files at all.

4. Try to rewind the tape
-------------------------

Dale Shaw <Dale.Shaw@select.com.au> suggested I should try
'mt -f /dev/rmt/2 rewind' but this did not work either.

5. Original Question:
----------------------

We are using both EXABYTE 8500 and DLT7000 tape drives to do a ufsdump
of several local file systems which is done by a cron job every
night. Sometimes the backup script exits due to whatever reason
(e.g. tape drive error, disk read error etc) and after that the tape
drive is allocated and I only get the "Device busy" message whatever I
do (e.g. 'mt -f /dev/rmt/2n status') I have checked all the processes
by doing 'ps -ef' but I cannot find any process that I suspect to hold
the tape drive. I can only cure this problem by rebooting.

A few months ago Shouben Zhou <zshouben@icase.edu> asked the
same question and he also summarized his responses. In his
case he could find some left over 'rmt' processes that held the tape
drive, but this is not the case for me. Shouben also indicated in
his SUMMARY that one could try running drvconfig + tapes + devlinks
to cure this problem. I wonder if any of you have a more
precise recipe of how to do this? I have briefly read the
man pages for these three commands, but it seems rather complicated
to fix the problem this way. What I am asking for is e.g. a simple (?)
script one could run the release the tape drive.

-- 
Johan Nyberg  mailto:nyberg@unix.tsl.uu.se  http://www3.tsl.uu.se/~nyberg  
The Svedberg Laboratory, Uppsala Univ., BOX 533, S-75121  Uppsala, Sweden
Tel: +46-18-4713047 (office),  +46-18-324314 (home).  Fax: +46-18-4713833



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:13:16 CDT