Bacula-users

Re: [Bacula-users] How do I force Bacula to unlock a drive? (SCSI Prevent/Allow Media Removal)

2011-08-23 11:01:36
Subject: Re: [Bacula-users] How do I force Bacula to unlock a drive? (SCSI Prevent/Allow Media Removal)
From: mark.bergman AT uphs.upenn DOT edu
To: s.guenther AT in-put DOT de
Date: Tue, 23 Aug 2011 10:59:18 -0400
In the message dated: Tue, 23 Aug 2011 12:01:59 +0200,
The pithy ruminations from =?utf-8?Q?Stefan_Michael_Guenther?= on 
<[Bacula-users] How do I force Bacula to unlock a drive?> were:
=> Hi,
=> 
=> we still have a problem with our tapeloader. 
=> The status of the storage tells me:
=> 
=>  Jobs waiting to reserve a drive:
=>     3608 JobId=1097 wants Pool="Mittwoch" but have Pool="Dienstag" 
nreserve=1 on
=>  drive "Drive-1" (/dev/st0).
=>     3606 JobId=1097 prefers mounted drives, but drive "Drive-1" (/dev/st0) 
has
=>  no Volume.
=>     3608 JobId=1115 wants Pool="Mittwoch" but have Pool="Dienstag" 
nreserve=1 on
=>  drive "Drive-1" (/dev/st0).
=>     3606 JobId=1115 prefers mounted drives, but drive "Drive-1" (/dev/st0) 
has
=>  no Volume.
=> >
=> okay, we had problems with the pool Dienstag and we cancelled the 
corresponding job, but still t
=> he drive is blocked.
=> Hm, neither release, nor unmount or a restart of the storage daemon allows 
me to reactivate the 
=> drive ??
=> 


We've run into what may be the same issue. We've got a SAN-attached tape
library, and 3 HA-clustered servers, any one of which may be the bacual-sd
server.

When bacula-sd halts uncleanly (the daemon is killed, the bacula service
transistions to a different HA node, or the server is shutdown uncleanly),
the SCSI reservation on the tape drive is not released.

The symptom is that bacula and "mtx" are unable to unmount a tape. The mtx
command reports errors like:

        mtx -f /dev/changer unload 28 1
        Unloading drive 1 into Storage Element 28...mtx: Request Sense: Long
        Report=yes
        mtx: Request Sense: Valid Residual=no
        mtx: Request Sense: Error Code=70 (Current)
        mtx: Request Sense: Sense Key=Illegal Request

This seems like a physical problem with the library (ie., the hardware
is unable to eject a tape), but is actually a software issue.

In our case, the tape drive itself gives some diagnostics:

        A host issued a SCSI Prevent/Allow Media Removal command which
        is preventing the drive from unloading a tape cartridge.

Unfortunately, the tape library cannot tell which host (of the 3 possible
bacula-sd servers) issued the lock. The lock is host-specific, and must be
released from the same machine that locked the drive, even if that machine is
not running bacula-sd at the moment.

The solution in our environment is to use the "sg_prevent" command
(from the sg3_utils package) to release the SCSI Prevent/Allow Media
Removal lock:

        sg_prevent --allow --verbose /dev/tape0
        sg_prevent --allow --verbose /dev/tape1

I've put those commands in the bacula-sd init script, to be executed
before the daemon starts, and at shutdown.

Note that bacula-sd must be stopped before running those commands.

I hope this helps.

Mark


=> Stefan
=> 

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users