How To:Delay writing to tape for better tape utilization: Difference between revisions

From wiki.zmanda.com
Jump to navigation Jump to search
(new stuff)
 
No edit summary
Line 1: Line 1:
{{How To Header}}
{{How To Header}}


= Old School =
= "Old School" (pre-2.6) =
If you want to run most of your backups direct to tape, but spool to holding disk on weekends (perhaps nobody is around to swap tapes), use a crontab such as:
Before Amanda 2.6, there was no way to tell Amanda not to use a tape if a perfectly usable tape is sitting in your tape drive or tape library.  This is more commonly a problem for people with tape libraries where the changer will happily load the next tape Amanda wants to use supposing it is available . . . which it commonly is.  If, for better tape utilization, you want to delay the writing of tapes, there is a way you can prevent Amanda from using the next tape with amdump's -o flag ("o" for options).  Should you rather spool backups to holding disk than use the next available tape, you can use an alternate amdump command such as:
  0 15 * * 1-5 /usr/local/sbin/amcheck -m daily
  amdump daily -o reserve=100 -o tapedev=""
  45 22 * * 1-5 /usr/local/sbin/amdump daily
or if you have a tape changer
45 0 * * 0-1 /usr/local/sbin/amdump daily -o reserve=100 -o tapedev="" -o tpchanger=""
  amdump daily -o reserve=100 -o tapedev="" -o tpchanger=""
The ''-o reserve=100'' causes all backups to drop back to incremental-only should you regularly specify a reserve less than 100% in your amanda.conf.  The ''-o tapedev=""'' and ''-o tpchanger=""'' overrides your usual tape and changer device names with an emptry string ("") preventing Amanda from finding a usable tape.  This forces writing to holding disk even if a usable Amanda-labeled tape is currently sitting in your tape drive.  If you have a tape changer, the override of ''tpchanger=""'' is necessary.  Without this, Amanda will talk to your tape changer to find the actual tape device name.


Since the tapechanger's tape drive is /dev/rmt/1n, the weekend override to an empty string("") results in an error message that there is no tape available. The override to tpchanger="" is necessary, because otherwise the tape changer will talk to amanda and tell it that the tape drive is actually 1n. My daily configuration has reserve=15, so the override to 100 causes all the backups to drop back to incremental only.  The dumps are automatically flushed to tape with the Monday night backups, with the {{man|5|amanda.conf}} parameter ''autoflush''.
Of course, backups spooled to the holding disk will only sit there unless you periodically run {{man|8|amflush}} or set the ''autoflush'' parameter to "yes" in your {{man|5|amanda.conf}}.
 
The days on the crontab entries might initially seem confusing, but the time of day is different, so it works. The weekend runs are just after midnight, but the weekday runs have been moved back to 10:45pm to give them more time to complete. So the "Sunday" run is actually just after midnight on what is then Monday morning. The "Monday" run is 10:45pm Monday evening.


Here is a crontab example which uses a tape each weekday while still performing backups over the weekend (yet without tapes)
45 0 * * 1-5 /usr/local/sbin/amdump daily
45 0 * * 0,6 /usr/local/sbin/amdump daily -o reserve=100 -o tapedev="" -o tpchanger=""
The weekend dumps to holding disk are automatically flushed to tape with the Monday night backups due to the {{man|5|amanda.conf}} parameter ''autoflush''.
(Thanks to [[User:Choogendyk]])
(Thanks to [[User:Choogendyk]])


= New School =
= "New School" (2.6 and later) =


{{XXX|Dustin|Needs expansion}}
{{XXX|Dustin|Needs expansion}}

Revision as of 22:26, 14 November 2008

This article is a part of the How Tos collection.

"Old School" (pre-2.6)

Before Amanda 2.6, there was no way to tell Amanda not to use a tape if a perfectly usable tape is sitting in your tape drive or tape library. This is more commonly a problem for people with tape libraries where the changer will happily load the next tape Amanda wants to use supposing it is available . . . which it commonly is. If, for better tape utilization, you want to delay the writing of tapes, there is a way you can prevent Amanda from using the next tape with amdump's -o flag ("o" for options). Should you rather spool backups to holding disk than use the next available tape, you can use an alternate amdump command such as:

amdump daily -o reserve=100 -o tapedev=""

or if you have a tape changer

amdump daily -o reserve=100 -o tapedev="" -o tpchanger=""

The -o reserve=100 causes all backups to drop back to incremental-only should you regularly specify a reserve less than 100% in your amanda.conf. The -o tapedev="" and -o tpchanger="" overrides your usual tape and changer device names with an emptry string ("") preventing Amanda from finding a usable tape. This forces writing to holding disk even if a usable Amanda-labeled tape is currently sitting in your tape drive. If you have a tape changer, the override of tpchanger="" is necessary. Without this, Amanda will talk to your tape changer to find the actual tape device name.

Of course, backups spooled to the holding disk will only sit there unless you periodically run amflush(8) or set the autoflush parameter to "yes" in your amanda.conf(5).

Here is a crontab example which uses a tape each weekday while still performing backups over the weekend (yet without tapes)

45 0 * * 1-5 /usr/local/sbin/amdump daily
45 0 * * 0,6 /usr/local/sbin/amdump daily -o reserve=100 -o tapedev="" -o tpchanger=""

The weekend dumps to holding disk are automatically flushed to tape with the Monday night backups due to the amanda.conf(5) parameter autoflush. (Thanks to User:Choogendyk)

"New School" (2.6 and later)

XXX User:Dustin: Needs expansion

Other languages: [[::How To:Delay writing to tape for better tape utilization|English]] {{#ifexist: {{#if: | | {{#if: | :}}How To:Delay writing to tape for better tape utilization}}/Fr |  • {{#if: |français| [[::How To:Delay writing to tape for better tape utilization/Fr|français]]}}|}}

{{#ifexist: {{#if: | | {{#if: | :}}How To:Delay writing to tape for better tape utilization}}/Zh-cn |  • {{#if: |中文(中国大陆)| [[::How To:Delay writing to tape for better tape utilization/Zh-cn|中文(中国大陆)]]}}|}}


Amanda version 2.6 and later has a parameter, where you can delay the tape writing until enough data has collected on the holdingdisk. See the parameters flush-threshold-dumped and flush-threshold-scheduled in amanda.conf(5).

Assuming the holdingdisk is large enough, you can add the parameter:

 flush-threshold-dumped 100

This will delay the writing to tape until the amount to fill one whole tape has been collected on the holdingdisk.