how to remove all backup data, runs, etc...

475 views
Skip to first unread message

Andy Feys

unread,
Jun 21, 2021, 6:52:48 AM6/21/21
to bareos-users
Hi,

what would be the correct way to remove all previously run backupjobs from bareos? I'm changing my backup schedule and want to start 'fresh'. This is for all configured servers, jobs, etc....  I want to keep the job definitions of course, but the database should be cleared.

Is there a command to purge all knowledge about previous runs from bareos?
Deleting the data is easy, that's just rm on a couple of folders on my backup server, but the rest I don't know what the best way is to do that.

best regards,
Andy

Henry Matroé

unread,
Jun 21, 2021, 8:32:32 AM6/21/21
to bareos-users
Hi,

I'm not an expert but i use this bash script to remove all old jobs in my debian Bareos server catalog (work with Mysql only)
You can use Adminer.php or phpmyadmin for manual deleting


This script will remove all you're old jobs => older than 1 hour :)


The script :
____________________________________________________________________________________________
#!/bin/bash

# Change this values to your bareosdatabase's login
userdb='bareos'
passdb='xxxxxxxxxxxxx'



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'`

OldVols=$(mysql bareos -u$userdb -p$passdb -se "SELECT VolumeName FROM Media WHERE LastWritten < (NOW() - INTERVAL 1 HOUR);")


for volName in $OldVols
do
/bin/bconsole << EOD
delete volume=$volName yes
quit
EOD
done
_________________________________________________________________________________

Like I said, I am far from an expert. So wait to see other answers to confirm this.

Good luck.

Andy Feys

unread,
Jun 21, 2021, 2:01:10 PM6/21/21
to bareos-users
Hi Henry,

thank you very much for this info. I've tried it and it seems to have worked.
Had to make some adjustments (did the procedure manually) because I use postgresql, not mysql.

best regards,
Andy

Frank Kohler

unread,
Jun 22, 2021, 2:49:49 PM6/22/21
to bareos...@googlegroups.com
Hi all,

depending on individual goals you may want to have a look at
/usr/lib/bareos/scripts where you can find a couple of drop scripts
independent of db.

Use with care ;-)

Some info:
https://docs.bareos.org/TasksAndConcepts/CatalogMaintenance.html?highlight=drop_bareos_tables#id6


best,
Frank
> --
> 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 bareos-users...@googlegroups.com
> <mailto:bareos-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/bareos-users/f216d7a7-d504-41bd-9863-e73bf1a23fa7n%40googlegroups.com
> <https://groups.google.com/d/msgid/bareos-users/f216d7a7-d504-41bd-9863-e73bf1a23fa7n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
Frank Kohler
Bareos GmbH & Co. KG

Reply all
Reply to author
Forward
0 new messages