Russell -

Long winded response that hopefully clears up a little bit of confusion around 
this thread ... hopefully doesn't add more.

I'm the one that posted the bareos bug that you linked to.  You are correct 
that you shouldn't have to run a script to resolve the issue, but that's why I 
opened the bug.  The posted script is a workaround that I've had in production 
for a over a year.  It will keep you going until the bug is resolved.  With 
that as the backdrop ...

1) When a volume is deleted via bconsole, it is removed from the database and 
all related data (files, jobs, etc.) are also removed from the database.  The 
volume on the filesystem is not touched.  The volume still contains the full 
set of backup data written to it and can be imported back into Bareos as long 
as it is left intact.  If the administrator wants it gone, then it has to be 
manually deleted from the filesystem.  As pointed out by Bruno, this is the 
same treatment assigned to tape cartridges.

2.) When a volume is purged by Bareos, the volume remains in the database and 
all related data (files, jobs, etc.) are removed from the database.  The 
default action is to leave the volume intact.  The volume still contains the 
full set of backup data written to it and can be imported back into Bareos as 
long as it is left intact.  If the pool is set to 'Recycle = yes', then Bareos 
will truncate the file (to ZERO bytes plus the label) when it is reused.  Until 
that time that it is reused it will remain intact and use up the space on the 
file system.  Bruno pointed out the 'Action On Purge=Truncate' option for a 
storage pool.  If that is set, then Bareos will truncate the volume (to ZERO 
bytes plus the label) at the time the volume is purged rather than waiting for 
it to be recycled.  This obviously frees up the space sooner.  The gotcha here 
is that this will work only for volumes that are created AFTER you change that 
property of the pool.  Already existing volumes will have to be updated wither 
via console or directly in the database.

3.) When a volume is pruned by Bareos, the volume remains in the database and 
all related EXPIRED data (files, jobs, etc.) are removed from the database.  
The volume itself is left intact.  This is considered the safest of the 
operations because it honors retention periods and prevents inadvertent removal 
of 'god' backup data from the system.  When leaves a volume with no more 
related jobs, then the volume is purged per the above paragraph.

So the default action for all of the above is to leave the file volume fully 
intact on the file system.  In the case of deletion the volume will remain 
there forever, taking up space, until the admin manually deletes it.  In the 
case of pruning/purging the volume will remain there and take up the space only 
until it it recycled, at which point it will be truncated.  If there is a need 
to reclaim the space more quickly, then the 'Action On Purge=Truncate' will 
cause the volume to truncate immediately when purged instead of waiting to be 
recycled.

The problem pointed out in the bug that you referenced is that the Consolidate 
job is not pruning the volumes in the AI-Consolidated pool as the documentation 
says that it should.  The script that I provided, and am pasting again below, 
can be run after a Consolidate job to prune the affected volumes and make them 
available to be recycled.

Dan

--------------------
#!/bin/bash
# grab the database credentials from existing configuration files
catalogFile=`find /etc/bareos/bareos-dir.d/catalog/ -type f`
dbUser=`grep dbuser $catalogFile | grep -o '".*"' | sed 's/"//g'`
dbPwd=`grep dbpassword $catalogFile | grep -o '".*"' | sed 's/"//g'`

# Get a list of volumes no longer in use and submit them to the console for 
pruning.  This is to work around a bug where Bareos does not prune volumes 
after a Consolidate action.
# Query for a list of volumes (exclude DR copy volumes)
emptyVols=$(mysql bareos -u $dbUser -p$dbPwd -se "SELECT m.VolumeName FROM 
bareos.Media m where m.VolStatus not in ('Append','Purged') and not exists 
(select 1 from bareos.JobMedia jm where jm.MediaId=m.MediaId);")
# Submit volumes to bconsole for pruning
for volName in $emptyVols
do
 /bin/bconsole << EOD
 prune volume=$volName yes
 quit
EOD
done
exit

-- 
You received this message because you are subscribed to the Google Groups 
"bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to