Pages

Monday, February 20, 2012

WORM media with mhvtl and bacula

WORM (write once read multiple) media is necessary if you need to make sure that special backups are kept forever (or as long as possible). How long a backup must kept alive depends on the data to backup, company needs, government regulations and so on. To play a little with WORM media you can use mhvtl (I used the web gui to create a new media). If you are lazy then you can spare this step, you can use any other media as WORM. The advantage of a real WORM media is that it won'toverwrite in other libraries, environments or even accidently. A cheap example with less capacity for a WORM media are writable CD's and DVD's - not rewritable!

To add a WORM media to my library configuration I just created a new media in the mhvtl web gui under 'Configuration' and selected 'WORM' as 'Media Type' (the rest depends on your mhvtl configuration). Then I used the 'Operator Panel' to load the WORM tape into the library. Before you can use the tape you should definitely setup a WORM pool inside bacula:

# cd /opt/bacula/latest/etc
# vi common/pool.conf
...
Pool {
  Name = MSL6000_WORM
  Pool Type = Backup
  Recycle = no
  AutoPrune = no
  Volume Retention = 100 years
  Maximum Volume Bytes = 500M
  Maximum Volumes = 10
}
...

The trick inside bacula is to create a pool that will never overwrite any volume (Recycle = no) or job/file (AutoPrune = no). Unfortunately a unlimited retention period is not poosible (as far as I know) but a retention period of 100 years should even satisfy your government regulations. With this setup you can even use normal media as WORM media - just keep in mind that may get overwritten accidently...
Then reload the configuration to make sure that bacula can use it:

*reload

Next label the barcode for the new media in the library. If a media was found that is already labeled and assigned to a pool then it will be not relabeled or moved into another pool. Eg.: my library has only one new media (the new WORM tape) and 47 old more or less used tapes. When I relabeled the new media it completely ignored the old tapes. Don't forget to use the proper pool (which you created before):

*update slots
...
*label barcodes
...
     3: MSL6000
Select Storage resource (1-3): 3
...
     4: MSL6000_WORM
Select the Pool (1-4): 4
...
Media record for Slot 47 Volume "HPS047L3" already exists.
Connecting to Storage daemon MSL6000 at dc01:9103 ...
Sending label command for Volume "WOR001L3" Slot 48 ...
3301 Issuing autochanger "loaded? drive 0" command.
3302 Autochanger "loaded? drive 0", result: nothing loaded.
3304 Issuing autochanger "load slot 48, drive 0" command.
3305 Autochanger "load slot 48, drive 0", status is OK.
3000 OK label. VolBytes=64512 DVD=0 Volume="WOR001L3" Device="Drive-1" (/dev/nst0)
Catalog record for Volume "WOR001L3", Slot 48  successfully created.

After the new media was assigned to your pool you can create a normal job or run a manual backup that uses the WORM pool (depending on your needs).