User Tools

Site Tools


removable_disk

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
removable_disk [2009/07/20 19:21]
sathe markup fixes
removable_disk [2010/11/12 20:08] (current)
darrick
Line 2: Line 2:
 ===Josh Fisher=== ===Josh Fisher===
 ==Revision History== ==Revision History==
 +
 +Revision 0.9.1 2009-10-27
 +  * Vchanger is now an open source project hosted at SourceForge at http://​sourceforge.net/​projects/​vchanger/​. The most recent howto is included in the source tarball.
  
 revision 0.9 2009-01-26 revision 0.9 2009-01-26
  
-  * Moved to http://​wiki.backula.org+  * Moved to http://​wiki.bacula.org
  
 Revision 0.8 2008-12-06 Revision 0.8 2008-12-06
Line 23: Line 26:
   * Initial version.   * Initial version.
  
-This document describes how to utilize removable disk drives as backup media for a backup solution using [[http://​www.bacula.org/​|Bacula]] +This document describes how to utilize removable disk drives as backup media for a backup solution using [[http://​www.bacula.org/​|Bacula]].\\  
- +In addition to reading this guide you could check out [[http://​bacula.svn.sourceforge.net/​viewvc/​bacula/​trunk/​bacula/​scripts/​disk-changer.in?​view=markup|"​disk-changer"​ script]] which is part of bacula distribution.
  
 ====1. Introduction==== ====1. Introduction====
Line 88: Line 90:
 The second parameter is the autochanger command to be performed and is either one of the standard Bacula autochanger API commands: The second parameter is the autochanger command to be performed and is either one of the standard Bacula autochanger API commands:
  
-  * load                 Load a "​tape"​ from a magazine "​slot"​ into a "​drive"​. Vchanger creates a symlink with the name passed in parameter 4 (archive_device) pointing to the file mIIsJJJ, where II is the two digit magazine index and JJJ is the slot number passed to Vchanger as parameter 3.+  ​* **load**                 Load a "​tape"​ from a magazine "​slot"​ into a "​drive"​. Vchanger creates a symlink with the name passed in parameter 4 (archive_device) pointing to the file mIIsJJJ, where II is the two digit magazine index and JJJ is the slot number passed to Vchanger as parameter 3.
  
-  * unload ​            ​Unload a "​tape"​ from the "​drive"​ back into the magazine "​slot"​. Vchanger deletes the symlink that was created by a previous load command for the drive.+  ​* **unload**             Unload a "​tape"​ from the "​drive"​ back into the magazine "​slot"​. Vchanger deletes the symlink that was created by a previous load command for the drive.
  
-  * loaded ​            ​Return the "​slot"​ currently loaded into the "​drive"​.+  ​* **loaded**             Return the "​slot"​ currently loaded into the "​drive"​.
  
-  * list                   List the barcodes of the "​tapes"​ in each of the "​slots"​ in this magazine.+  ​* **list**                   List the barcodes of the "​tapes"​ in each of the "​slots"​ in this magazine.
  
-  * slots                Return the number of slots per magazine.+  ​* **slots**                ​Return the number of slots per magazine.
  
 ... or one of the vchanger extended commands: ​ ... or one of the vchanger extended commands: ​
  
-  * purge               ​Delete all volumes in a magazine and re-create them using the bconsole 'label barcodes'​ command. Volumes are deleted from the Bacula catalog using the bconsole '​delete volume'​ command, and the files acting as virtual tapes containing those volumes are deleted from the virtual magazine filesystem.+  ​* **purge**               Delete all volumes in a magazine and re-create them using the bconsole 'label barcodes'​ command. Volumes are deleted from the Bacula catalog using the bconsole '​delete volume'​ command, and the files acting as virtual tapes containing those volumes are deleted from the virtual magazine filesystem.
  
 The third parameter is the slot number to use for the current command. The third parameter is the slot number to use for the current command.
Line 152: Line 154:
 ===6.2 Formatting / Labeling Magazine Partitions=== ===6.2 Formatting / Labeling Magazine Partitions===
  
-Assuming the drive was assigned node /dev/sdc, the partition can now be formatted and labeled using:+Assuming the drive was assigned node /dev/sdX, the partition can now be formatted and labeled using:
  
-  mke2fs -j -T largefile -L "​usbchanger1"​ /dev/sdc1+  mke2fs -j -T largefile -L "​usbchanger1" ​-m 0 /dev/sdX1
  
 This will create a new ext3 filesystem on the partition with filesystem label '​usbchanger1'​. Now unplug the USB drive, wait a few seconds, then plug it back in. A few seconds after plugging it in you should see a symlink /​dev/​disk/​by-label/​usbchanger1 pointing to whatever device node udev decided to assign to the partition. Now try: This will create a new ext3 filesystem on the partition with filesystem label '​usbchanger1'​. Now unplug the USB drive, wait a few seconds, then plug it back in. A few seconds after plugging it in you should see a symlink /​dev/​disk/​by-label/​usbchanger1 pointing to whatever device node udev decided to assign to the partition. Now try:
Line 168: Line 170:
 ====7. Installing vchanger==== ====7. Installing vchanger====
  
-Place a copy of the [[#​vchanger|vchanger shell script]] in the /etc/bacula directory, than change its owner and permissions as foolows:+Place a copy of the [[#​vchanger|vchanger shell script]] in the /etc/bacula directory, than change its owner and permissions as follows:
  
   chown root.disk /​etc/​bacula/​vchanger   chown root.disk /​etc/​bacula/​vchanger
Line 175: Line 177:
 The first positional parameter passed to vchanger from Bacula specifies the [[#​example_autochanger_config_file|autochanger configuration file]]. Each virtual autochanger will have its own configuration file. An autochanger configuration file defines the following values: The first positional parameter passed to vchanger from Bacula specifies the [[#​example_autochanger_config_file|autochanger configuration file]]. Each virtual autochanger will have its own configuration file. An autochanger configuration file defines the following values:
  
-baculasd ​         [Required] The name of the autochanger,​ as defined in bacula-dir.conf by the Name parameter of the Storage resource for the autochanger device.\\  +  * "**baculasd**" ​[Required] ​(Default: none) The name of the autochanger,​ as defined in bacula-dir.conf by the Name parameter of the Storage resource for the autochanger device. 
-Default: ​none +  * "​**baculasd_user**"​ (Default: ​bacula) ​ ​Specifies the user that the Bacula Storage Daemon bacula-sd runs as. 
- +  * "​**bconsole**"​ (Default: ​/etc/bacula/bconsolePath to the bconsole executable. 
-baculasd_user ​ ​Specifies the user that the Bacula Storage Daemon bacula-sd runs as.\\  +  * "​**magslots**"​ (Default: ​10) The number of slots in each magazine. 
-Default: bacula +  * "​**maxdrive**"​ (Default: ​0 (which defines 1 virtual drive)) ​The maximum zero-based drive index number to use. This defines the number of virtual drives the autochanger uses. Multiple drives allow Bacula to concurrently access multiple volumes. The number of virtual drives used must be less than or equal to the number of slots in a magazine. 
- +  * "**mountpoint**" ​[Required] ​(Default: none) Path to where the magazine partitions get mounted by autofs. 
-bconsole ​         Path to the bconsole executable\\  +  * "​**purgepool**"​ (Default: ​Scratch) ​Specifies the pool that all volumes will be placed in following a purge command that deletes and then re-creates a magazine'​s volumes. 
-Default: ​/​etc/​bacula/​bconsole +  * "**statedir**" ​[Required] ​(Default: none) Path to the working directory for this autochanger.
- +
-magslots ​         ​The number of slots in each magazine\\  +
-Default: ​10 +
- +
-maxdrive ​        The maximum zero-based drive index number to use. This defines the number of virtual drives the autochanger uses. Multiple drives allow Bacula to concurrently access multiple volumes. The number of virtual drives used must be less than or equal to the number of slots in a magazine.\\  +
-Default: 0 (which defines 1 virtual drive) +
- +
-mountpoint ​     [Required] Path to where the magazine partitions get mounted by autofs\\  +
-Default: ​none +
- +
-purgepool ​       ​Specifies the pool that all volumes will be placed in following a purge command that deletes and then re-creates a magazine'​s volumes.\\  +
-Default: Scratch +
- +
-statedir ​           [Required] Path to the working directory for this autochanger\\  +
-Default: none+
  
 For example, let's say we have two USB disk drives, each of which has been initialized as in [[#​preparing_usb_disk_drives|section 6]] above to contain a single large ext3 filesystem with filesystem label '​usbchanger1'​ that gets mounted at /​mnt/​usbchanger1/​magazine. The following vchanger configuration file defines an autochanger that has 20 slots in a magazine, two virtual drives, and its state information stored in /​var/​bacula/​usbchanger1:​ For example, let's say we have two USB disk drives, each of which has been initialized as in [[#​preparing_usb_disk_drives|section 6]] above to contain a single large ext3 filesystem with filesystem label '​usbchanger1'​ that gets mounted at /​mnt/​usbchanger1/​magazine. The following vchanger configuration file defines an autochanger that has 20 slots in a magazine, two virtual drives, and its state information stored in /​var/​bacula/​usbchanger1:​
Line 310: Line 297:
 ===10.1 Labeling Volumes In New Magazines=== ===10.1 Labeling Volumes In New Magazines===
  
-Plug in one of the newly prepared USB drives from [[#​preparing_usb_disk_drives|section 6]] above, then from bconsole execute the command 'label barcodes'​. ​ When prompted for the pool to place the newly labeled volumes into, select the Scratch pool. Bacula will ask the vchanger script for the barcodes of the “tapes&​rdquo; ​in each of the  magazine'​s ​“slots&​rdquo; ​and use those barcodes will be used as the volume label names for the virtual tapes. The first magazine added to the autochanger will be given magazine index 1. The next will be given index 2, and so on.+Plug in one of the newly prepared USB drives from [[#​preparing_usb_disk_drives|section 6]] above, then from bconsole execute the command 'label barcodes'​. ​ When prompted for the pool to place the newly labeled volumes into, select the Scratch pool. Bacula will ask the vchanger script for the barcodes of the "tapes" ​in each of the  magazine'​s ​"slots" ​and use those barcodes will be used as the volume label names for the virtual tapes. The first magazine added to the autochanger will be given magazine index 1. The next will be given index 2, and so on.
  
 ==10.2 Unloading Magazines== ==10.2 Unloading Magazines==
Line 322: Line 309:
 ===10.4 Adding New Magazines=== ===10.4 Adding New Magazines===
  
-You can add up to 99 magazines to an existing autochanger. Just prepare a new USB drive as described in [[#​preparing_usb_disk_drives|section 6]] above and then label its volumes as in <a href="#labeling_volumes">​9.1</​a> ​above. A new magazine will be created using the next available magazine index number.+You can add up to 99 magazines to an existing autochanger. Just prepare a new USB drive as described in [[#​preparing_usb_disk_drives|section 6]] above and then label its volumes as in [[#labeling_volumes_in_new_magazines|section 10.1]] above. A new magazine will be created using the next available magazine index number.
  
 ===10.5 Purging All Volumes In a Magazine=== ===10.5 Purging All Volumes In a Magazine===
Line 399: Line 386:
 # Return length of string $1 # Return length of string $1
 # #
-function strlen () +if [ `uname` = "​FreeBSD"​ ] 
-+then 
-   ​expr length $1 +        ​function strlen () 
-}+        
 +                expr -- "​$1"​ : "​.*"​ 
 +        } 
 +else 
 +        function strlen () 
 +        { 
 +                ​expr length $1 
 +        } 
 +fi 
  
 # #
removable_disk.1248114097.txt.gz · Last modified: 2009/07/20 19:21 by sathe