As recently written, I have acquired a tape library with a 15-tape magazine. It contains a DLT-8000 tape drive which, although it is no longer state-of-the-art, is a step up from the DLT-7000 I am currently using.
Today, I will try using this unit for the first time. I’ll do a simple write, try changing tapes, etc. I’ll be using my previous postings on this topic, such as one on using tape libraries with bacula and and on integrating a tape library with an existing installation.
Let’s look at the devices
I’m using FreeBSD 8.2. The devices listed by camcontrol are:
$ sudo camcontrol amcontrol devlist Password: <DEC TL800 (C) DEC 0326> at scbus12 target 0 lun 0 (pass11,ch0) <QUANTUM DLT8000 0250> at scbus12 target 4 lun 0 (pass13,sa1) <DEC TZ89 (C) DEC 2561> at scbus12 target 5 lun 0 (sa0,pass12) <OVERLAND LXB 0524> at scbus12 target 6 lun 0 (ch1,pass14)
NOTE: There are more devices on this system than listed above. I have removed the hard drives from this output to improve readability.
The DEC TL800 and DEC TZ89 are, respectively, my DEC tape library and the DLT 7000 which it contains.
The OVERLAND and the QUANTUM are the new tape library and its DLT 8000.
Let’s look at the permissions of those devices. First, the DEC unit, which is fully operational with Bacula.
$ ls -l /dev/pass11 /dev/ch0 /dev/sa0 /dev/pass12 /dev/sa0.0 crw------- 1 root operator 0, 94 Nov 27 13:17 /dev/ch0 crw-rw---- 1 root operator 0, 106 Nov 27 13:17 /dev/pass11 crw------- 1 root operator 0, 107 Nov 27 13:17 /dev/pass12 lrwxr-xr-x 1 root wheel 5 Nov 27 13:17 /dev/sa0 -> sa0.0 crw-rw---- 1 root operator 0, 109 Nov 27 13:17 /dev/sa0.0
As you can see, both the changer and the tape drive are chown root:operator and allow the operator group to read and write.
Now let’s compare the above with the new unit:
$ ls -l /dev/pass13 /dev/sa1 /dev/ch1 /dev/pass14 /dev/sa1.0 crw------- 1 root operator 1, 13 Dec 4 14:26 /dev/ch1 crw------- 1 root operator 1, 11 Dec 4 14:26 /dev/pass13 crw------- 1 root operator 1, 12 Dec 4 14:26 /dev/pass14 lrwxr-xr-x 1 root wheel 5 Dec 4 14:26 /dev/sa1 -> sa1.0 crw-rw---- 1 root operator 0, 252 Dec 4 14:26 /dev/sa1.0
OK, we can see that the tape drive ((sa1.1)is OK, but the changer (pass14) is not. We can change those permissions using /etc/devfs.conf. Looking in that file, I see (near the end of the file):
# so bacula can access the autochanger via the operator group perm pass11 0660
This refers to the DEC unit, not the new unit. So let me add in the autochanger from the new tape library. Now we have:
# so bacula can access the DEC autochanger via the operator group perm pass11 0660 # so bacula can access the overland autochanger via the operator group perm pass14 0660
A quick restart of devfs shows us the new permissions on the autochanger devices:
$ sudo /etc/rc.d/devfs restart Password: $ ls -l /dev/pass11 /dev/pass14 crw-rw---- 1 root operator 0, 106 Nov 27 13:17 /dev/pass11 crw-rw---- 1 root operator 1, 12 Dec 4 14:26 /dev/pass14 $
OK, so given that I’m in the operator group, I should now be able to manipulate the autochanger and the tape library.
Loading a tape
Let’s try a simple command. How many slots do you have?
NOTE: I copied /usr/local/sbin/mtx-changer from /usr/local/share/bacula/mtx-changer.conf, where is was installed by bacula-server. I did this so I could make my own local modifications.
$ /usr/local/sbin/mtx-changer /dev/pass14 slots mtx: Request Sense: Long Report=yes mtx: Request Sense: Valid Residual=no mtx: Request Sense: Error Code=70 (Current) mtx: Request Sense: Sense Key=Unit Attention mtx: Request Sense: FileMark=no mtx: Request Sense: EOM=no mtx: Request Sense: ILI=no mtx: Request Sense: Additional Sense Code = 28 mtx: Request Sense: Additional Sense Qualifier = 00 mtx: Request Sense: BPV=no mtx: Request Sense: Error in CDB=no mtx: Request Sense: SKSV=no Mode sense (0x1A) for Page 0x1D failed 15
Hmm. I have no idea why I got those mtx: Request Sense messages. They did not appear again.
That works. Now, what tapes are loaded?
$ /usr/local/sbin/mtx-changer /dev/pass14 list 14:ETU145 15:ETU140
Good. Now, let’s load a tape.
$ /usr/local/sbin/mtx-changer /dev/pass14 load 14 /dev/sa1 0 Loading media from Storage Element 14 into drive 0...done $ /usr/local/sbin/mtx-changer /dev/pass14 loaded 0 /dev/sa1 0 14
Excellent! Now, lets write.
Writing to a tape
This will be a destructive test. Any data on the tape will be lost.
$ cd /bin $ tar -cvf /dev/nsa1 . a . a ./check_zpool.sh a ./erase-tapes.sh a ./kernel_memory.sh a ./dlt a ./dlt-functions a ./dlt-simple a ./dlt-stats a ./dlt-write a ./rsync-bacula-database.sh a ./dlt-read a ./dlt-statsDRIVE a ./volume-loaded a ./EraseTapeLabels a ./dlt-stats-ORIGINAL a ./dlt-clean-vars a ./dlt-cleaning-required-is a ./EraseTapeLabels~ a ./dlt-cleaning-flag-set a ./dlt-cleaning-flag-clear $
Now, let’s restore that, to another location.
$ cd ~/tmp $ mkdir bin $ cd bin $ mt -f /dev/sa1 rewind $ tar -xvf /dev/nsa1 x ./ x ./check_zpool.sh x ./erase-tapes.sh x ./kernel_memory.sh x ./dlt x ./dlt-functions x ./dlt-simple x ./dlt-stats x ./dlt-write x ./rsync-bacula-database.sh x ./dlt-read x ./dlt-statsDRIVE x ./volume-loaded x ./EraseTapeLabels x ./dlt-stats-ORIGINAL x ./dlt-clean-vars x ./dlt-cleaning-required-is x ./EraseTapeLabels~ x ./dlt-cleaning-flag-set x ./dlt-cleaning-flag-clear $ diff -ruN /bin ~/tmp/bin $
That diff line is key. The restored files were the same as the files that were backed up.
Test successful.
Now, let’s write some more
Let’s backup a bit more data:
$ du -ch -d 1 ~/PORTS-SVN 970M /home/dan/PORTS-SVN/ports 966M /home/dan/PORTS-SVN/test 1.9G /home/dan/PORTS-SVN 1.9G total $ tar -cvf /dev/nsa1 ~/PORTS-SVN
That’s a 2GB write. Now let’s try the read and diff.
$ cd ~/tmp $ mkdir PORTS-SVN $ cd PORTS-SVN $ mt -f /dev/sa1 rewind $ tar -xvf /dev/nsa1 $ diff -ruN ~/PORTS-SVN/ ~/tmp/PORTS-SVN/home/dan/PORTS-SVN/ $
You’ll notice that the restored files have the pathname on it… that’s because it was used during the creation of the tarball.
More mtx-changer tests
Let’s do some more mtx-changer tests based on tests I run before.
$ mtx -f /dev/pass14 status Storage Changer /dev/pass14:1 Drives, 15 Slots ( 0 Import/Export ) Data Transfer Element 0:Full (Storage Element 14 Loaded):VolumeTag = ETU145 Storage Element 1:Empty Storage Element 2:Empty Storage Element 3:Empty Storage Element 4:Empty Storage Element 5:Empty Storage Element 6:Empty Storage Element 7:Empty Storage Element 8:Empty Storage Element 9:Empty Storage Element 10:Empty Storage Element 11:Empty Storage Element 12:Empty Storage Element 13:Empty Storage Element 14:Empty Storage Element 15:Full :VolumeTag=ETU140
Now we unload into element 1.
$ /usr/local/sbin/mtx-changer /dev/pass14 unload 1 /dev/sa1 0 Unloading drive 0 into Storage Element 1...done $ /usr/local/sbin/mtx-changer /dev/pass14 14 list 1:ETU145 15:ETU140 $ mtx -f /dev/pass14 14 status Storage Changer /dev/pass14:1 Drives, 15 Slots ( 0 Import/Export ) Data Transfer Element 0:Empty Storage Element 1:Full :VolumeTag=ETU145 Storage Element 2:Empty Storage Element 3:Empty Storage Element 4:Empty Storage Element 5:Empty Storage Element 6:Empty Storage Element 7:Empty Storage Element 8:Empty Storage Element 9:Empty Storage Element 10:Empty Storage Element 11:Empty Storage Element 12:Empty Storage Element 13:Empty Storage Element 14:Empty Storage Element 15:Full :VolumeTag=ETU140 $
Lastly, let’s move the tape in slot 15 into slot 2.
$ mtx -f /dev/pass14 transfer 15 2 $ mtx -f /dev/pass14 14 status Storage Changer /dev/pass14:1 Drives, 15 Slots ( 0 Import/Export ) Data Transfer Element 0:Empty Storage Element 1:Full :VolumeTag=ETU145 Storage Element 2:Full :VolumeTag=ETU140 Storage Element 3:Empty Storage Element 4:Empty Storage Element 5:Empty Storage Element 6:Empty Storage Element 7:Empty Storage Element 8:Empty Storage Element 9:Empty Storage Element 10:Empty Storage Element 11:Empty Storage Element 12:Empty Storage Element 13:Empty Storage Element 14:Empty Storage Element 15:Empty $
Good. Very good.
What’s the density?
The tapes I was testing with were originally written on a DLT 7000. I was just using them on a DLT 8000, which is a different density. Let’s see if that density has changed…
$ mt -f /dev/sa1 status Mode Density Blocksize bpi Compression Current: 0x41:DLTapeIV(40GB) variable 98250 IDRC ---------available modes--------- 0: 0x41:DLTapeIV(40GB) variable 98250 IDRC 1: 0x41:DLTapeIV(40GB) variable 98250 IDRC 2: 0x41:DLTapeIV(40GB) variable 98250 IDRC 3: 0x41:DLTapeIV(40GB) variable 98250 IDRC --------------------------------- Current Driver State: at rest. --------------------------------- File Number: 1 Record Number: 0 Residual Count 0
Ahh, there it is, right there! 40GB. OK, we’re good. This means I can use the same tapes from the old library. I won’t be able to read them in the old library. Hmm.
That’s a good reason for forcing a 35GB density on the new library… I can use the old library as a backup. However, that will forego the greater speeds of the faster tape drive.
I think I’ll just go and buy a few more DLT 8000 library drives. They should be fairly cheap.
That’s All Folks!
OK. These are the simple tests that everyone should do with a computer library before you start integrating it with Bacula. In my next post, I’ll write about setting up this tape library with Bacula.