1 Date: Tue, 15 Feb 2005 17:36:06 +0100
2 From: Mario Wolff <mwolff@unix.schubert-gruppe.de>
4 CC: bacula-devel <bacula-devel@lists.sourceforge.net>
5 Subject: Re: Using multiple tapedrives as autochanger!
12 > There is a similar script named ak-mtx-changer.txt in the
13 > <bacula>/examples/autochangers directory of the source tree. If you feel
14 > that your script brings something different, then I'll be happy to
15 > include it in the same directory. If that is the case, please put a
16 > small note in an email message to me with the script and I'll include it
17 > (I know you've already sent the script, but it saves me the time of
18 > searching for it, and I'm sure I've got the right one).
22 As far as i understood the ak-mtx-changer.txt it's simply a
23 human-resource-changer!?!
24 In the past every single server had it's own DDS-3 Tape, since we switch
25 to a centralized networkbackup all these drives are unused.
26 Now i took 6 of these drives and placed it in large case on one
27 scsi-controller. Running bacula with multitape-changer these six drives
28 are used as one drive with a 6-Slot-Changer!
33 PS: I've posted a deploy-script (deploy windows-fd from linux, automated
34 your hints) a few days ago over gmane to the devellist. This message
35 was never posted and i got no error message. Maybe problem with the size
36 (Windows-FD was attached!) ???
38 [pasted the hints once again for Kern!]
43 # Definition of DDS tape storage device
46 #Do not use "localhost" here
47 Address = mystorage # N.B. Use a fully qualified name here
49 Password = "strongsecret" # password for Storage daemon
59 Archive Device = /dev/tape
60 AutomaticMount = yes; # when device opened, read it
65 Changer Command = "/etc/bacula/scripts/multitape-changer %c %o %S %a %d"
66 Changer Device = /dev/null
71 - Important to use a virtual name! multidrive-changer will create links!
72 (Archive Device = /dev/tape)
73 - It's a bash script not a sh script!
74 - SD must run as root or the multitape-changer must be called with sudo
75 to have write permission to the /dev dir!
76 - the default-config does an umount on tape-change! Don't switch this!
77 SD has to release the device-file!
78 - don't use your tapedrives directly anymore! SD does not know that
79 /dev/tape is /dev/nst0!
80 - don't remove the sleep 1 after getslot...! Without the sleep you will
81 get a "Operation not permitted" error!
82 - only tested with Debian/GNU-Linux-SID
87 --------------050209030507060501040304
88 Content-Type: text/plain;
89 name="multitape-changer"
90 Content-Transfer-Encoding: 7bit
91 Content-Disposition: inline;
92 filename="multitape-changer"
96 # Bacula interface to use multiple drives as one tape-changer
97 # Arguments are copied from the mtx-script! Simply exchange
98 # the scriptname from demo-config
100 # If you set in your Device resource
102 # Changer Command = "path-to-this-script/multitape-changer %c %o %S %a %d"
103 # you will have the following input to this script:
105 # multitape-changer "changer-device" "command" "slot" "archive-device" "drive-index"
110 # multitape-changer /dev/sg0 load 1 /dev/nst0 0 (on a Linux system)
115 DEVICE=${4:-/dev/tape}
117 LABELDIR=/etc/bacula/tapelabel # where to find labelfiles
118 NULLDEVICE=/dev/null # if unmount link to this
119 SLOT01=/dev/nst0 # first slot
120 SLOT02=/dev/nst1 # second slot
123 #get device for a given slotnumber
126 if [ ${#myslot} -gt 2 ];then exit 1;fi
127 if [ ${#myslot} -eq 2 ];then
128 eval echo \$SLOT$myslot
131 eval echo \$SLOT0$myslot
136 #get name of labelfile for a given slot
139 if [ ${#myslot} -gt 2 ];then exit 2;fi
140 if [ ${#myslot} -eq 2 ];then
149 #how many tapes/slots to manage
152 while [ "$( getdevice $count )" ];do
153 count=$[ $count + 1 ]
159 #get slot for a given device-file
161 device=${1:-$NULLDEVICE}
162 if [ "$device" = "$NULLDEVICE" ];then
167 slotdev=$( getdevice $count )
168 while [ "$slotdev" ]; do
169 if [ "$slotdev" = "$device" ];then
173 count=$[ $count + 1 ]
174 slotdev=$( getdevice $count )
180 if test $# -lt 2 ; then
181 echo "usage: multitape-changer ctl-device command slot archive-device drive"
182 echo " Insufficient number of arguments arguments given."
183 echo " Mimimum usage is first two arguments ..."
188 # Check for special cases where only 2 arguments are needed,
189 # all others are a minimum of 3
200 if test $# -lt 3; then
201 echo "usage: multitape-changer ctl-device command slot archive-device drive"
202 echo " Insufficient number of arguments arguments given."
203 echo " Mimimum usage is first three arguments ..."
212 if [ -e $DEVICE ];then
213 rm $DEVICE && ln -s $NULLDEVICE $DEVICE || exit 6
215 ln -s $NULLDEVICE $DEVICE || exit 7
220 CURDEV=$( getdevice $slot )
221 if [ -e $DEVICE ];then
222 rm $DEVICE && ln -s $CURDEV $DEVICE || exit 8
224 ln -s $CURDEV $DEVICE || exit 9
230 for slot in $( seq 1 $slots );do
231 labelfile=$LABELDIR/$( getname $slot )
232 if [ -f "$labelfile" ];then
233 echo "$slot:$( head -n 1 $labelfile)"
242 if [ -e $DEVICE ];then
243 line=$( ls -la $DEVICE )
245 line=${line:-$NULLDEVICE}
257 --------------050209030507060501040304--