Tech:Bacula

Bacula is an open source backup automation software in use by Miraheze to run automated 'offsite' (off host / country / networking / power grid) backups of critical data in the infrastructure.

Backup Schedules
Miraheze runs two backup schedules in production:
 * WeeklyCycle - A full backup every Sunday of the month.
 * BiWeeklyCycle - A full backup on the 1st Sunday of every month with a differential backup on the 3rd Sunday of every month.

Backup jobs we run operate on different cycles as listed below:
 * WeeklyCycle - Private Git (puppet1), Grafana (misc2).
 * BiWeeklyCycle - Databases (db4), Static (lizardFS*), Phabricator Static (misc4).

Adding New Backups
The process gets more complicated the more "new" you mean by Backups:
 * You may need to define a new file set if there has never been a backup of the service before, see the databases file store.
 * You may need to define a new client if the server if new - see db4-fd for an example and remember to include bacula::client on the server!
 * You will need to define a new pool and new backup and restore jobs.

Restoring a Backup
Backups should *only* be restored when absolutely necessary because of network transfer and space limitations on receiving servers. If you need to do this, open up the bconsole on the bacula server by running `bconsole`.


 * 1) Check there is enough space on the receiving server, you can do this by running `list volume`, finding the volume and checking the "VolBytes" value for the volume.
 * 2) If there is enough space, run `restore` on the console and select 5 (Select by client), and select the client you wish to run the backup to.
 * 3) Run "mark *" or "mark [directory/file]" you wish to restore and then run "done" when done.
 * 4) You will be given a list of restore jobs, select the job relevant for the service you are restoring.
 * 5) You will then be given the option of saying, yes, no, mod to the job. Say yes and the job will be queued and ran on the client server.
 * 6) The backup will be in the /bacula/restore directory on the server.

Operation
The below covers operations that you may need to run in the bconsole and exist wholly for general reference. Any common (or complicated) procedures will be documented above in more detail.

cancel
The command allows canceling a planned or running job. It's an interactive command that can be ran by typing 'cancel' and selecting the job to cancel numerically.

delete
The command allows deleting a job, pool or volume and is an interactive command that can be started by typing 'delete' and following the prompts. Deleting pools is strongly discouraged as they contain all volumes associated with a backup. They should only be deleted once their use has gone and the relevant references in Bacula are removed. Delete volumes is discouraged but can and should be done for technical reasons (e.g. retention fall through causing jobs to stick).

estimate
The command allows estimating the files and storage that will be used by a particular job when it is ran. It is an interactive command which can ran by typing 'estimate' and following the prompts for the relevant job(s).

exit / quit
The command terminates the console window.

list
The command lists object data from the Bacula database. The command is not interactive and must be ran as below:
 * list volumes - lists all volumes and information associated with the volumes grouped by pools.
 * list pools - lists all pools with information on volume contents and maximum size.
 * list jobs - lists all information about every job ran.
 * list jobtotals - lists statistical information about every job ran grouped by 'all' and 'pools'.

messages
The command displays the messages internally produced by Bacula to inform the administrator on changes in the install.

memory
The command lists current memory usage information of the process.

prune
The command allows pruning of all expired objects in the database. This is not necessary to run as it is automated.

restore
The command allows the restoring of a backup to the relevant server in the /bacula/restore directory. The command is interactive and can be accessed by typing 'restore'.

run
The command allows running of jobs. It is an interactive command and can be accessed by typing 'run'.

status
The command shows status information such as running jobs and volume status. It is an interactive command and can be ran by typing 'status'.

time
Does what it says on the tin.

version
Does what it says on the tin.