Bacula es una colección de herramientas de respaldo capaz de cubrir las necesidades de respaldo de equipos bajo redes IP. Se basa en una arquitectura Cliente-servidor que resulta eficaz y fácil de manejar, dada la amplia gama de funciones y características que brinda; copiar y restaurar ficheros dañados o perdidos. Además, debido a su desarrollo y estructura modular, Bacula se adapta tanto al uso personal como profesional, desde un equipo hasta grandes parques de servidores.
Los componentes de Bacula: generalmente usado en sistemas u organizaciones donde la información es ingresada desde un dispositivo o punto final de red (PC de escritorio), transporta parte de sus datos a un servidor directamente desde la dirección IP. Todo el conjunto de elementos que forman Bacula trabaja en sincronía y es totalmente compatible con bases de datos como MySQL, SQLite y PostgreSQL.
Para la realización del ejercicio utilizaremos 4 maquinas cuyos nombres son backups(debian), barney(debian), homer(ubuntu), lisa(centos) y un volumen en la maquina «barney»
- Backups – Director y consola
- Barney – Cliente
- Homber – Cliente
- Lisa – Cliente
Instalación bacula en backups
En nuestra maquina barney que actuará como director instalaremos previamente la pila LAMP apt install apache2 mysql-server-5.5 mysql-client-5.5 php5
ya que bacula requiere de una base de datos y a continuación bacula apt install bacula bacula-client bacula-common-mysql bacula-director-mysql bacula-sd-mysql bacula-server bacula-traymonitor
.
Durante la instalación de bacula nos solicitara que introduzcamos la contraseña del administrador de mysql, para poder acceder a la base de datos y realizar las modificaciones necesarias.
Y observamos que ha creado una nueva base de datos automáticamente
Configurar ciertos servicios o tareas a veces es un proceso largo, tenemos que editar archivos complejos, dedicar mucho tiempo en aprender como funciona una herramienta desde la consola y como configurar sus ficheros, a veces el software de Linux no cuenta con una interfaces de usuario intuitiva que nos facilite el trabajo.
Webmin es una herramienta que permite la configuración del sistema vía Web para sistemas Linux.
Con Webmin podemos configurar y administrar cualquier cosa referente al sistema, herramientas o servicios.
Quizá configurar y controlar en su totalidad Bacula puede ser algo complejo y poco intuitivo ya que no cuenta con una interface gráfica, por ello la mejor opción para facilitarnos el trabajo con Bacula es usar Webmin.
Instalacion webmin
Para descargar webmin accedemos a la Pagina oficial de Webmin y obtener el enlace del paquete debian:
Una vez tenemos el enlace del paquete procederemos a descargarlo, para ello nos situamos en el directorio por defecto de apache cd /var/www/
y descargamos el paquete wget http://prdownloads.sourceforge.net/webadmin/webmin_1.831_all.deb
Una vez finalizada la descarga, vamos instalar el paquete dpkg -i webmin_1.831_all.deb
puede dar error al instalar:
En ese caso instalamos las siguientes dependencias apt install libauthen-pam-perl libio-pty-perl apt-show-versions
y apt -f install
Y volvemos a instalar el paquete dpkg -i webmin_1.831_all.deb
Y ya podemos acceder [IP_MAQUINA]/
passwd root
.Configuración del director
Por ultimo y para terminar nos queda por configurar el director bacula en nuestra maquina “backups” el cual es el que lleva la mayor parte de la configuración, esto lo configuramos en el fichero /etc/bacula/bacula-dir.conf
y hacemos que le fichero quede así:
# # Default Bacula Director Configuration file # # The only thing that MUST be changed is to add one or more # file or directory names in the Include directive of the # FileSet resource. # # For Bacula release 5.2.6 (21 February 2012) -- debian jessie/sid # # You might also want to change the default email address # from root to your address. See the "mail" and "operator" # directives in the Messages resource. # Director { # define myself Name = backups-dir DIRport = 9101 # where we listen for UA connections QueryFile = "/etc/bacula/scripts/query.sql" WorkingDirectory = "/var/lib/bacula" PidDirectory = "/var/run/bacula" Maximum Concurrent Jobs = 1 Password = "root" # Console password Messages = Daemon DirAddress = 10.0.0.6 } JobDefs { Name = "Homes" Type = Backup Level = Incremental FileSet = "FileHomes" Schedule = "Semanal" Storage = File Messages = Standard Pool = File Priority = 10 Write Bootstrap = "/var/lib/bacula/%c.bsr" } # # Define the main nightly save backup job # By default, this job will back up to disk in /nonexistant/path/to/file/archive/dir Job { Name = "HomeBarney" JobDefs = "Homes" Client = "barney-fd" } Job { Name = "HomeHomer" JobDefs = "Homes" Client = "homer-fd" } Job { Name = "HomeLisa" JobDefs = "Homes" Client = "lisa-fd" } # # Standard Restore template, to be changed by Console program # Only one such job is needed for all Jobs/Clients/Storage ... # # List of files to be backed up FileSet { Name = "FileHomes" Include { Options { signature = MD5 } # # Put your list of files here, preceded by 'File =', one per line # or include an external list with: # # File =\" -s \"Bacula: %t %e of %c %l\" %r" operatorcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula: Intervention needed for %j\" %r" mail = root = all, !skipped operator = root = mount console = all, !skipped, !saved # # WARNING! the following will create a file that you must cycle from # time to time as it will grow indefinitely. However, it will # also keep all your messages if they scroll off the console. # append = "/var/log/bacula/bacula.log" = all, !skipped catalog = all } # # Message delivery for daemon messages (no job). Messages { Name = Daemon mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bacula\) \<%r\>\" -s \"Bacula daemon message\" %r" mail = root = all, !skipped console = all, !skipped, !saved append = "/var/log/bacula/bacula.log" = all, !skipped } # Default pool definition Pool { Name = Default Pool Type = Backup Recycle = yes # Bacula can automatically recycle Volumes AutoPrune = yes # Prune expired volumes Volume Retention = 365 days # one year } # File Pool definition Pool { Name = File Pool Type = Backup Recycle = yes # Bacula can automatically recycle Volumes AutoPrune = yes # Prune expired volumes Volume Retention = 365 days # one year Maximum Volume Bytes = 50G # Limit Volume size to something reasonable Maximum Volumes = 100 # Limit number of Volumes in Pool } # Scratch pool definition Pool { Name = Scratch Pool Type = Backup } # # Restricted console used by tray-monitor to get the status of the director # Console { Name = backups-mon Password = "root" CommandACL = status, .status }
Instalación de nodo de almacenamiento
Añadimos un volumen a nuestra maquina que hace de director, el cual vamos a particionar fdisk /dev/vdb
lo particionamos con una única partición y primaria.
Y le damos un formato «ext4» mkfs.ext4 /dev/vdb1
Lo mas recomendable es asociar este volumen a un directorio concreto en el cual queramos que se almacenen las copias en mi caso crear el directorio mkdir -p /opt/bacula/backup
y ha de tener permisos 755 chmod 755 /opt/bacula/backup
y como propietario bacula chown bacula:bacula /opt/bacula/backup
Para que siempre se encuentre montado ante cualquier reinicio o apagado, vamos a modificar el fichero /etc/fstab
en el cual añadimos la siguiente linea
/dev/vdb1 /opt/bacula/backup ext4 defaults 0 0
Montamos la partición creada mount -a
y comprobamos que ya se encuentra montada con la salida de lsblk
root@backups:/home/debian# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vda 254:0 0 10G 0 disk └─vda1 254:1 0 10G 0 part / vdb 254:16 0 18G 0 disk └─vdb1 254:17 0 18G 0 part /opt/bacula/backup
Con esto ya tendríamos nuestro nodo de almacenamiento preparado para incrustarlo con la configuración de bacula.
Ahora accedemos a la configuración del almacenamiento de bacula /etc/bacula/bacula-sd.conf
y editamos los siguientes parámetros para que queden asi:
# Storage Storage { # definition of myself Name = backups-sd SDPort = 9103 # Director's port WorkingDirectory = "/var/lib/bacula" Pid Directory = "/var/run/bacula" Maximum Concurrent Jobs = 20 SDAddress = 10.0.0.6 } # Le decimos a bacula-sd el nombre de su director y su contraseña. Director { Name = backups-dir Password = "root" } #También le decimos a bacula-sd el nombre de la consola del director y su contraseña. Director { Name = backups-mon Password = "root" Monitor = yes } #Por ultimo configuramos el “Dispositivo” que se utilizará para almacenar las copias Device { Name = FileStorage Media Type = File Archive Device = /opt/bacula/backup LabelMedia = yes; # lets Bacula label unlabeled media Random Access = Yes; AutomaticMount = yes; # when device opened, read it RemovableMedia = no; AlwaysOpen = no; }
Configuración fichero bconsole en backups
Debemos tambien modificar el fichero /etc/bacula/bconsole.conf
en el cual vamos a modificar para que quede asi, vuelvo a recordar que las IP’s pueden variar según nuestra red.
# # Bacula User Agent (or Console) Configuration File # Director { Name = backups-dir DIRport = 9101 address = 10.0.0.6 Password = "root" }
Instalación y configuración de los clientes
En nuestras maquinas «barney», «homer» y «lisa» instalaremos el software de bacula para las maquinas que van a ser respaldadas.
Y configuraremos el cliente instalado en el servidor y en los clientes en el archivo bacula-fd.conf
Ahora procederemos a configurar nuestros clientes de bacula, para configurar el cliente bacula vamos a modificar el fichero /etc/bacula/bacula-fd.conf
de cada uno de los clientes.
Backups
En el servidor ya se encuentra instalado por lo paquete que bacula-client
no es necsario instalarlo, asi pues, modificamos el fichero /etc/bacula/bacula.fd.conf
para que quede asi:
# # Default Bacula File Daemon Configuration file # # For Bacula release 5.2.6 (21 February 2012) -- debian jessie/sid # # There is not much to change here except perhaps the # File daemon Name to # # # List Directors who are permitted to contact this File daemon # Director { Name = backups-dir Password = "root" } # # Restricted Director, used by tray-monitor to get the # status of the file daemon # Director { Name = backups-mon Password = "root" Monitor = yes } # # "Global" File daemon configuration specifications # FileDaemon { # this is me Name = backups-fd FDport = 9102 # where we listen for the director WorkingDirectory = /var/lib/bacula Pid Directory = /var/run/bacula Maximum Concurrent Jobs = 20 FDAddress = 10.0.0.6 } # Send all messages except skipped files back to Director Messages { Name = Standard director = backups-dir = all, !skipped, !restored }
Reiniciamos el servicio systemctl restart bacula-fd
Barney
Instalamos bacula-client en debian apt install bacula-client
# # Default Bacula File Daemon Configuration file # # For Bacula release 5.2.6 (21 February 2012) -- debian jessie/sid # # There is not much to change here except perhaps the # File daemon Name to # # # List Directors who are permitted to contact this File daemon # Director { Name = backups-dir Password = "root" } # # Restricted Director, used by tray-monitor to get the # status of the file daemon # Director { Name = backups-mon Password = "root" Monitor = yes } # # "Global" File daemon configuration specifications # FileDaemon { # this is me Name = barney-fd FDport = 9102 # where we listen for the director WorkingDirectory = /var/lib/bacula Pid Directory = /var/run/bacula Maximum Concurrent Jobs = 20 FDAddress = 10.0.0.8 } # Send all messages except skipped files back to Director Messages { Name = Standard director = backups-dir = all, !skipped, !restored }
Reiniciamos el servicio systemctl restart bacula-fd
Homer
Instalamos bacula-client en ubuntu, al estar en ubuntu xenial el paquete que viene por defecto cuando instalas de los repositorios oficiales es la version «7.0.5» por tanto vamos a descargar los paquete en la version «5.2.6»:
apt install libpython2.7 wget http://launchpadlibrarian.net/160302336/bacula-client_5.2.6+dfsg-9.1ubuntu3_all.deb wget http://launchpadlibrarian.net/185288798/bacula-common_5.2.6+dfsg-9.1ubuntu4_amd64.deb wget http://launchpadlibrarian.net/185288854/bacula-console_5.2.6+dfsg-9.1ubuntu4_amd64.deb wget http://launchpadlibrarian.net/185288834/bacula-fd_5.2.6+dfsg-9.1ubuntu4_amd64.deb dpkg -i bacula-console_5.2.6+dfsg-9.1ubuntu4_amd64.deb dpkg -i bacula-common_5.2.6+dfsg-9.1ubuntu4_amd64.deb dpkg -i bacula-fd_5.2.6+dfsg-9.1ubuntu4_amd64.deb dpkg -i bacula-client_5.2.6+dfsg-9.1ubuntu3_all.deb aptitude hold bacula-console aptitude hold bacula-common aptitude hold bacula-fd aptitude hold bacula-client
# # Default Bacula File Daemon Configuration file # # For Bacula release 5.2.6 (21 February 2012) -- ubuntu 14.10 # # There is not much to change here except perhaps the # File daemon Name to # # # List Directors who are permitted to contact this File daemon # Director { Name = backups-dir Password = "root" } # # Restricted Director, used by tray-monitor to get the # status of the file daemon # Director { Name = backups-mon Password = "root" Monitor = yes } # # "Global" File daemon configuration specifications # FileDaemon { # this is me Name = homer-fd FDport = 9102 # where we listen for the director WorkingDirectory = /var/lib/bacula Pid Directory = /var/run/bacula Maximum Concurrent Jobs = 20 FDAddress = 10.0.0.14 } # Send all messages except skipped files back to Director Messages { Name = Standard director = backups-dir = all, !skipped, !restored }
Reiniciamos el servicio systemctl restart bacula-fd
Lisa
Instalamos bacula-client en CentOS yum install bacula-client
# # Default Bacula File Daemon Configuration file # # For Bacula release 5.2.13 (19 February 2013) -- redhat (Core) # # There is not much to change here except perhaps the # File daemon Name to # # # List Directors who are permitted to contact this File daemon # Director { Name = backups-dir Password = "root" } # # Restricted Director, used by tray-monitor to get the # status of the file daemon # Director { Name = backups-mon Password = "root" Monitor = yes } # # "Global" File daemon configuration specifications # FileDaemon { # this is me Name = lisa-fd FDport = 9102 # where we listen for the director WorkingDirectory = /var/spool/bacula Pid Directory = /var/run Maximum Concurrent Jobs = 20 } # Send all messages except skipped files back to Director Messages { Name = Standard director = backups-dir = all, !skipped, !restored }
Reiniciamos el servicio systemctl restart bacula-fd
Y ya tenemos nuestros clientes bacula preparados.
Comprobamos que puertos están escuchando, y filtramos por el puerto que escucha bacula netstat -putan | grep 9102
root@bacula2:/home/usuario# netstat -putan | grep 9102 tcp 0 0 0.0.0.0:9102 0.0.0.0:* LISTEN 814/bacula-fd
Y reiniciamos todos los servicios correspondientes en la maquina backups:
root@backups:/home/debian# /etc/init.d/bacula-sd restart [ ok ] Restarting bacula-sd (via systemctl): bacula-sd.service. root@backups:/home/debian# /etc/init.d/bacula-director restart [ ok ] Restarting bacula-director (via systemctl): bacula-director.service. root@backups:/home/debian# /etc/init.d/bacula-fd restart [ ok ] Restarting bacula-fd (via systemctl): bacula-fd.service.
Acceso mediante webadmin
Para ello una vez instalado el paquete, vamos a acceder mediante la ip de la maquina https://[IP_Maquina]:10000
, una vez ahi nos dirigimos a System> Bacula Backup System
, no pedirá que configuremos la Base de Datos, que esta en «mysql» y cuya contraseña nos pidió al principio de la instalación del paquete bacula-director-mysql
Añadimos los clientes y podemos ver que ya los tenemos añadidos
Añadir volumen en bconsole
Bacula nos proporciona una consola “bconsole” la cual nos permite gestionar muchas de las funcionalidades de bacula tanto la gestión de volúmenes como llevar a cabo un seguimiento de las copias programadas el estado etc…
Previamente y para que las copias funcionen correctamente deberemos desde la consola asociar el volumen de nuestro nodo de almacenamiento a bacula para que este lo reconozca como tal.
root@backups:/etc/bacula# bconsole Connecting to Director 10.0.0.6:9101 1000 OK: backups-dir Version: 5.2.6 (21 February 2012) Enter a period to cancel a command. *label Automatically selected Catalog: MyCatalog Using Catalog "MyCatalog" Automatically selected Storage: File Enter new Volume name: backups Defined Pools: 1: Default 2: File 3: Scratch Select the Pool (1-3): 2 Connecting to Storage daemon File at 10.0.0.19:9103 ... Sending label command for Volume "backups" Slot 0 ... 3000 OK label. VolBytes=214 DVD=0 Volume="backups" Device="FileStorage" (/opt/bacula/backup) Catalog record for Volume "backups", Slot 0 successfully created. Requesting to mount FileStorage ... 3906 File device ""FileStorage" (/opt/bacula/backup)" is always mounted.
Hacer copia de seguridad programadas
root@backups:/home/debian# bconsole Connecting to Director 10.0.0.6:9101 1000 OK: backups-dir Version: 5.2.6 (21 February 2012) Enter a period to cancel a command. *status Status available for: 1: Director 2: Storage 3: Client 4: All Select daemon type for status (1-4): 4 backups-dir Version: 5.2.6 (21 February 2012) x86_64-pc-linux-gnu debian jessie/sid Daemon started 23-Jan-17 16:14. Jobs: run=0, running=3 mode=0,0 Heap: heap=405,504 smbytes=96,387 max_bytes=96,643 bufs=342 max_bufs=347 Scheduled Jobs: Level Type Pri Scheduled Name Volume =================================================================================== Incremental Backup 10 23-Jan-17 16:20 HomeBarney backups Incremental Backup 10 23-Jan-17 16:20 HomeHomer backups Incremental Backup 10 23-Jan-17 16:20 HomeLisa backups ==== Running Jobs: Console connected at 23-Jan-17 16:17 JobId Level Name Status ====================================================================== 32 Full HomeBarney.2017-01-23_16.17.00_02 has terminated 33 Full HomeHomer.2017-01-23_16.17.00_03 is waiting execution 34 Full HomeLisa.2017-01-23_16.17.00_04 is waiting execution ====
Y ya podemos observar que se han realizado las copias y se encuentran programadas para mañana las nuevas copias incrementales:
*status director backups-dir Version: 5.2.6 (21 February 2012) x86_64-pc-linux-gnu debian jessie/sid Daemon started 23-Jan-17 16:14. Jobs: run=6, running=0 mode=0,0 Heap: heap=405,504 smbytes=103,484 max_bytes=119,508 bufs=281 max_bufs=360 Scheduled Jobs: Level Type Pri Scheduled Name Volume =================================================================================== Incremental Backup 10 24-Jan-17 16:20 HomeBarney backups Incremental Backup 10 24-Jan-17 16:20 HomeHomer backups Incremental Backup 10 24-Jan-17 16:20 HomeLisa backups ==== Running Jobs: Console connected at 23-Jan-17 16:17 No Jobs running. ==== Terminated Jobs: JobId Level Files Bytes Status Finished Name ==================================================================== 32 Full 58 62.10 K OK 23-Jan-17 16:17 HomeBarney 33 Full 36 780.3 K OK 23-Jan-17 16:17 HomeHomer 34 Full 73 1.364 M OK 23-Jan-17 16:17 HomeLisa 35 Incr 0 0 OK 23-Jan-17 16:20 HomeBarney 36 Incr 0 0 OK 23-Jan-17 16:20 HomeHomer 37 Incr 0 0 OK 23-Jan-17 16:20 HomeLisa ====
Borrar backups o restore desde bconsole
Para borrar las copias de seguridad realizadas mal o por error ejecutamos bconsole
y ejecutamos un list jobs
y podremos observar las copias realizadas.
Para eliminar bastara con poner delete jobs
nos solicitara el id del jobs y se eliminara:
root@backups:/etc/bacula# bconsole Connecting to Director 10.0.0.6:9101 1000 OK: backups-dir Version: 5.2.6 (21 February 2012) Enter a period to cancel a command. *list jobs +-------+---------------+---------------------+------+-------+----------+----------+-----------+ | JobId | Name | StartTime | Type | Level | JobFiles | JobBytes | JobStatus | +-------+---------------+---------------------+------+-------+----------+----------+-----------+ | 30 | RestoreBarney | 2017-01-23 09:59:37 | R | F | 58 | 62,079 | T | | 31 | RestoreHomer | 2017-01-23 10:03:07 | R | F | 36 | 780,382 | T | +-------+---------------+---------------------+------+-------+----------+----------+-----------+ *delete jobs In general it is not a good idea to delete either a Pool or a Volume since they may contain data. You have the following choices: 1: volume 2: pool 3: jobid Choose catalog item to delete (1-3): 3 Enter JobId to delete: 30
Copia de seguridad de ficheros de configuración
Ahora procedemos a añadir una nueva tarea para realizar la copia de los ficheros de configuración también para ello añadiremos lo siguiente justo detrás de la tarea descrita antes:
#Definicion de JobDefs para los ficheros de configuracion. JobDefs { Name = "Conf_Clientes" Type = Backup Level = Incremental FileSet = "ConfClientes" Schedule = "CopiaConf" Storage = File Messages = Standard Pool = File Priority = 10 Write Bootstrap = "/var/lib/bacula/%c.bsr" } #Definición de trabajos para los clientes Job { Name = "ConfBarney" JobDefs = "Conf_Clientes" Client = "barney-fd" } Job { Name = "ConfHomer" JobDefs = "Conf_Clientes" Client = "homer-fd" } Job { Name = "ConfLisa" JobDefs = "Conf_Clientes" Client = "lisa-fd" } #Definimos el FileSet y establecemos de que va a hacer la copia # List of files to be backed up FileSet { Name = "ConfClientes" Include { Options { signature = MD5 } # # Put your list of files here, preceded by 'File =', one per line # or include an external list with: # # File = <file-name # # Note: / backs up everything on the root partition. # if you have other partitions such as /usr or /home # you will probably want to add them too. # # By default this is defined to point to the Bacula binary # directory to give a reasonable FileSet to backup to # disk storage during initial testing. # File = /etc File = /var } #Definimos los ficheros que vamos a excluir. Exclude { File = /var/cache File = /var/tmp } } Schedule { Name = "CopiaConf" Run = Full mon at 16:50 Run = Incremental mon-sun at 16:55 }
Y ya se encuentran programadas:
Scheduled Jobs: Level Type Pri Scheduled Name Volume =================================================================================== Full Backup 10 23-Jan-17 16:50 ConfBarney backups Full Backup 10 23-Jan-17 16:50 ConfLisa backups Full Backup 10 23-Jan-17 16:50 ConfHomer backups Incremental Backup 10 23-Jan-17 16:55 ConfBarney backups Incremental Backup 10 23-Jan-17 16:55 ConfLisa backups Incremental Backup 10 23-Jan-17 16:55 ConfHomer backups ====
Al pasar un rato ya podemos observar que se han realizado las copias:
root@backups:/home/debian# bconsole Connecting to Director 10.0.0.6:9101 1000 OK: backups-dir Version: 5.2.6 (21 February 2012) Enter a period to cancel a command. *status director Terminated Jobs: JobId Level Files Bytes Status Finished Name ==================================================================== 31 36 780.3 K OK 23-Jan-17 10:03 RestoreHomer 32 Full 58 62.10 K OK 23-Jan-17 16:17 HomeBarney 33 Full 36 780.3 K OK 23-Jan-17 16:17 HomeHomer 34 Full 73 1.364 M OK 23-Jan-17 16:17 HomeLisa 35 Incr 0 0 OK 23-Jan-17 16:20 HomeBarney 36 Incr 0 0 OK 23-Jan-17 16:20 HomeHomer 37 Incr 0 0 OK 23-Jan-17 16:20 HomeLisa 38 Full 4,465 139.8 M OK 23-Jan-17 16:50 ConfBarney 39 Full 5,040 332.1 M OK 23-Jan-17 16:51 ConfHomer 40 Full 6,622 109.1 M OK 23-Jan-17 16:52 ConfLisa 41 Incr 24 412.4 K OK 23-Jan-17 16:55 ConfBarney 42 Incr 3 1.196 K OK 23-Jan-17 16:55 ConfHomer 43 Incr 3 1.396 K OK 23-Jan-17 16:55 ConfLisa ====
Restaurar copias de seguridad
Primero definimos los nuevos Jobs
:
#Homes Job { Name = "RestoreBarney" Type = Restore Client=barney-fd FileSet="FileHomes" Storage = File Pool = Default Messages = Standard } Job { Name = "RestoreHomer" Type = Restore Client=homer-fd FileSet="FileHomes" Storage = File Pool = Default Messages = Standard } Job { Name = "RestoreLisa" Type = Restore Client=lisa-fd FileSet="FileHomes" Storage = File Pool = Default Messages = Standard } #ficheros configuración Job { Name = "RestoreBarneyConf" Type = Restore Client=barney-fd FileSet="ConfClientes" Storage = File Pool = Default Messages = Standard } Job { Name = "RestoreHomerConf" Type = Restore Client=homer-fd FileSet="ConfClientes" Storage = File Pool = Default Messages = Standard } Job { Name = "RestoreLisaConf" Type = Restore Client=lisa-fd FileSet="ConfClientes" Storage = File Pool = Default Messages = Standard }
Vamos a restaurar desde bconsole
asi podemos seleccionar o un fichero o una carpeta, una vez dentro de «bconsole» escribimos restore
presionamos en la opcion 5
y seleccionamos el cliente y definimos el FileSet
:
Una vez ahi ya podremos interaccionar como si fuera una shell, podemos ejecutar cd, ls
, aqui dejo los comandos que puedes utilizar:
Command Description ======= =========== cd change current directory count count marked files in and below the cd dir long list current directory, wildcards allowed done leave file selection mode estimate estimate restore size exit same as done command find find files, wildcards allowed help print help ls list current directory, wildcards allowed lsmark list the marked files in and below the cd mark mark dir/file to be restored recursively in dirs markdir mark directory name to be restored (no files) pwd print current working directory unmark unmark dir/file to be restored recursively in dir unmarkdir unmark directory name only no recursion quit quit and do not do restore ? print help
Por lo tanto una vez seleccionado el cliente y seleccionado el FileSet
nos movemos por los directorios en los cuales tenemos realizado el backup.
En la maquina cliente Homer
vamos a eliminar un fichero de la carpeta /home/ubuntu
, por ejemplo los paquetes descargados para instalar el cliente bacula rm -rf bacula-client_5.2.6+dfsg-9.1ubuntu3_all.deb
.
En la ultima copia de seguridad dicho paquete esta presente, por tanto ahora solo tendremos que marcarlo y restaurarlo:
cwd is: / $ cd home/ubuntu cwd is: /home/ubuntu/ $ ls .bash_history .bash_logout .bashrc .cache/ .profile .ssh/ .sudo_as_admin_successful 5.2.6+dfsg-9.1ubuntu4 bacula-client_5.2.6+dfsg-9.1ubuntu3_all.deb bacula-common_5.2.6+dfsg-9.1ubuntu4_amd64.deb bacula-console_5.2.6+dfsg-9.1ubuntu4_amd64.deb bacula-fd.conf bacula-fd_5.2.6+dfsg-9.1ubuntu4_amd64.deb bacula_5.2.6+dfsg-9.1ubuntu4_all.deb bacula_5.2.6+dfsg-9.1ubuntu4_all.deb.1 clave-openstack.pub claveCarmenVera.pub id_rsa.pub rafa.pub $ mark bacula-client_5.2.6+dfsg-9.1ubuntu3_all.deb 1 file marked. $ done Bootstrap records written to /var/lib/bacula/backups-dir.restore.2.bsr The job will require the following Volume(s) Storage(s) SD Device(s) =========================================================================== backups File FileStorage Volumes marked with "*" are online. 1 file selected to be restored. The defined Restore Job resources are: 1: RestoreBarney 2: RestoreHomer 3: RestoreLisa Select Restore Job (1-3): 2 Run Restore job JobName: RestoreHomer Bootstrap: /var/lib/bacula/backups-dir.restore.2.bsr Where: *None* Replace: always FileSet: FileHomes Backup Client: homer-fd Restore Client: homer-fd Storage: File When: 2017-01-23 19:32:14 Catalog: MyCatalog Priority: 10 Plugin Options: *None* OK to run? (yes/mod/no): yes Job queued. JobId=48 You have messages.
Y podemos observar que en la maquina «homer» se ha restaurado el paquete eliminado anteriormente:
No se han encontrado comentarios