Skip to content

Bacula Relabel Tape

Some notes on what I did to erase a tape in Bacula.

unmount using bconsole

*unmount
The defined Storage resources are:
     1: File
     2: Scalar
Select Storage resource (1-2): 2
3307 Issuing autochanger "unload slot 2, drive 0" command.
3001 Device ""Drive-1" (/dev/nst0)" unmounted.

I used the library web front-end to move the tape into this drive then erased the label using operating system command mt:

root@bcla001:~# mt -f /dev/st0 rewind && mt -f /dev/st0 weof && mt -f /dev/st0 rewind

Manually label tape using bconsole. You probably want to use barcode labeling though. Look further down in this post.

*label
The defined Storage resources are:
     1: File
     2: Scalar
Select Storage resource (1-2): 2
Enter new Volume name: FullTest0002
Enter slot (0 or Enter for none): 
Defined Pools:
     1: Default
     2: File
     3: Scratch
     4: FullTest
     5: AllIncrementals
     6: AllDifferentials
     7: DiffTest
     8: IncrTest
Select the Pool (1-8): 4
Connecting to Storage daemon Scalar at bcla001:9103 ...
Sending label command for Volume "FullTest0002" Slot 0 ...
No slot defined in catalog (slot=0) for Volume "" on "Drive-1" (/dev/nst0).
Cartridge change or "update slots" may be required.
3301 Issuing autochanger "loaded? drive 0" command.
3302 Autochanger "loaded? drive 0", result is Slot 2.
3000 OK label. VolBytes=64512 DVD=0 Volume="FullTest0002" Device="Drive-1" (/dev/nst0)
Requesting to mount Drive-1 ...
3001 Device ""Drive-1" (/dev/nst0)" is mounted with Volume "FullTest0002"

check status using bconsole:

*status jobid=6
Connecting to Storage daemon Scalar at bcla001:9103

bcla001-sd Version: 5.2.6 (21 February 2012) x86_64-pc-linux-gnu debian wheezy/sid
Daemon started 07-Sep-12 17:37. Jobs: run=2, running=0.
 Heap: heap=589,824 smbytes=296,475 max_bytes=460,222 bufs=128 max_bufs=142
 Sizes: boffset_t=8 size_t=8 int32_t=4 int64_t=8 mode=0,0

Running Jobs:
Writing: Full Backup job Test JobId=6 Volume="FullTest0002"
    pool="FullTest" device="Drive-1" (/dev/nst0)
    spooling=0 despooling=0 despool_wait=0
    Files=1,047,529 Bytes=1,862,098,892,915 Bytes/sec=36,129,899
    FDReadSeqNo=36,562,344 in_msg=33718333 out_msg=5 fd=4
====
...snip
====

Device status:
Autochanger "Autochanger" with devices:
   "Drive-1" (/dev/nst0)
Device "FileStorage" is not open or does not exist.
Device "Drive-1" (/dev/nst0) is mounted with:
    Volume:      FullTest0002
    Pool:        FullTest
    Media type:  Ultrium5-SCSI
    Slot 2 is loaded in drive 0.
    Total Bytes=758,596,608 Blocks=11,758 Bytes/block=64,517
    Positioned at File=0 Block=11,759
====

Used Volume status:
FullTest0002 on device "Drive-1" (/dev/nst0)
    Reader=0 writers=1 devres=0 volinuse=1
====

====

Label using the barcode on the tape.

*label barcodes slot=11
The defined Storage resources are:
     1: File
     2: Scalar
Select Storage resource (1-2): 2
Connecting to Storage daemon Scalar at bcla001:9103 ...
3306 Issuing autochanger "slots" command.
Device "Drive-1" has 30 slots.
Connecting to Storage daemon Scalar at bcla001:9103 ...
3306 Issuing autochanger "list" command.
The following Volumes will be labeled:
Slot  Volume
==============
  11  VOL021
Do you want to label these Volumes? (yes|no): yes
Defined Pools:
     1: Default
     2: File
     3: Scratch
     4: FullTest
     5: AllIncrementals
     6: AllDifferentials
     7: DiffTest
     8: IncrTest
Select the Pool (1-8): 1
Connecting to Storage daemon Scalar at bcla001:9103 ...
Sending label command for Volume "VOL021" Slot 11 ...
3301 Issuing autochanger "loaded? drive 0" command.
3302 Autochanger "loaded? drive 0", result: nothing loaded.
3304 Issuing autochanger "load slot 11, drive 0" command.
Published inBackups