Adolfo Pachón wrote:

> Hi,
> 
> How can I use, for exmple, the "/mnt/backups" path for storing backups,
> instead of a tape?
> 
> Thanks.

In simple terms: specify /mnt/backups as your holding disk.

Make sure you have set your reserve option in configuration, otherwise 
amanda will not make level 0 backups to holding disk.
And specify a tapetype that suits your needs. Amanda will take the 
tapetype to balance and plan your backups, but the free space on 
"/mnt/backups" as a typetype wont do any good to amanda. Take one that 
is higher than your biggest level 0 dump.

Amrecover has no problems restoring from your holding disk, but you have 
to make sure there is enough room for the backups.

(but perhaps i missunderstood you and you want to mount something other 
than a harddisk under /mnt/backups)

I had this problem, cause there was intended to keep lev0 on tape and 
lev1 on hard disk.

There is this two-configuration setting wich are using the same dirs in 
the FAQ, but i didn't want to flush the incrementals, so i wrote a shell 
script to delete the backup files along with their indexes and logs.

(i hope there is no "flush-to-dev-null-on-demand-option" or 
"clean-up-holding-disk" somewere that i have missed ... )

The script is based on determining the size of backups in the holding 
disk and if necessary deleting some of them. I modified it a little bit 
to post it on the list and added a testing option which causes it to 
_not_ delete anything by default.

It is currently only tested and used on a SuSE 7.0 Linux System.

The Script could also come handy as a fall-back to ensure the space left 
in the holding disk if there's no tape online.
(imagine a little test if there is a tape available and if not, make 
some room in the holding disk, so the backups could be done)

Now I do sometimes flush the backups, as the level 0 backups sometimes 
don't fit on one tape and I _have_ to flush manually ;-)

Simon Mayr

PS
Great new "incronly" option! Very good for a two-configuration setting.
#!/bin/sh
#
# author: simon mayr
# email : [EMAIL PROTECTED]
#
# purpose: make room in the holding disk without flushing the backups to tape
#
# usage: define all the parameters in the script
#        place it in front of amanda in your cronjob, so that in
#        worst case it can not delete the backup you've just made
#        !!! test before real use
#
# needed: some sanity checking, so you should really test before use!
#         perhaps some usefull return values
#         command line parameters
#
# Use at your own risk.
# I am NOT responsible for anything YOU do with this script
# feel free to modify and copy , bla bla ...
#

#
# how it works:
#
# find out how much space we occupy in the holding disk
#       is it too much?
#       no
#       -> end script
#       yes
#       -> find the oldest amanda dir in holding disks
#          delete it
#          delete corresponding indexfiles&logfiles
#          start over again ( with a maximum of trys to avoid infinity loops)

# CONFIGURATION (parameters):

# on or off
# turn off when you are sure nothing bad will happen
TESTING=on

# your configuration (directoryname) for the not-going-to-tape-backups
CONFDIR=DailySet1

# the holding disk(s) (seperate with "\ ")
# eg HOLDING=/disk1/\ /path/to/disk2/\ /disk3/
HOLDING=/holding_disk/

# this is the main option in this script,
# it controls if anything at all will be done
# adjust to this value:
# allowed_usage_of_the_holding_disk(s) - desired_min_free_space_for_one_backup
# eg  40gig holdingdisk, 12gig backup, 4gig for safety
# means 40-(12+4)=24gigs=24000 in mbytes
MAXMB=24000

# maximum number of deleted dates
# if anything is in your holding disk, that can not be deleted
# the script will try again and again
# OR if your MAXMB is too low you would possibly loose all your backups
MAXWHILE=8

# END OF CONFIGURATION

# use du to get the size of our images
# this will NOT work, if your du produces other output than
# number [directory]
# with this options
COUNT=0
for VAR in `du $HOLDING -ms | cut -f 1`
   do COUNT=$(($VAR+$COUNT))
done

# this is for testing, because
# the while loop only produces output if there is anything to do
# so you get only mail from your cronjob, when something was deleted
if ! test "off" = "$TESTING"
   then echo $COUNT MB used, $MAXMB allowed
fi

# the main loop
while test $MAXWHILE -gt 0 && test $COUNT -gt $MAXMB
do
   echo $COUNT MB used, $MAXMB allowed

# DELDATE contain the oldest date from your backups in the
# holding disks
# (a bit clumsy, but it works for me )
   DELDATE=99999999
   for DIRNAME in $HOLDING
      do cd $DIRNAME
      for VAR in `ls -d [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] 2> /dev/null`
         do test $VAR -lt $DELDATE && DELDATE=$VAR
      done
   done

   if test $DELDATE = 99999999
      then echo and there is nothing I could delete to lower the disk usage
      echo Terminating now!
      exit 0
   fi
   
# tell what to do
  echo removing $DELDATE

# remove DELDATE in all the holding disks
   if test "off" = "$TESTING"
      then find $HOLDING -type d -name $DELDATE |\
      xargs -n 1 --no-run-if-empty -- rm -r -f --verbose

      else find $HOLDING -type d -name $DELDATE |\
      xargs -n 1 --no-run-if-empty -- echo rm -r -f
   fi

# remove corresponding files in configdir
# this will leave the amdump.## files, but i think amanda herself
# will take care of them
   if test "off" = "$TESTING"
      then find /var/lib/amanda/$CONFDIR/ -type f -name "*$DELDATE*" |\
      xargs -n 1 --no-run-if-empty -- rm -f --verbose

      else find /var/lib/amanda/$CONFDIR/ -type f -name "*$DELDATE*" |\
      xargs -n 1 --no-run-if-empty -- echo rm -f
   fi

# if you remove one of your disklistentrys this one could come handy
# cause there will be empty dirs if the backups are removed
# find /var/lib/amanda/$CONFDIR/ -empty -type d |\
# xargs -n 1 --no-run-if-empty -- rmdir --verbose

# recalculate disk usage
   COUNT=0
   for VAR in `du $HOLDING -ms | cut -f 1`
      do COUNT=$(($VAR+$COUNT))
   done

# we do not want an infinity loops and we also do not want to
# kill more than MAXWHILE backups in a row
MAXWHILE=$(($MAXWHILE-1))

done
exit 0

Reply via email to