jueves, 14 de octubre de 2021

Bacula extract files from a volume with bls and bextract

Have you got a volume in bacula and isn't on the catalog? 

You can see what jobs are in the volume, and extract with these tools.

[root@baculaanexo ~]# bls -j -V Local-1067 /mnt/storage
bls: butil.c:287-0 Using device: "/mnt/storage" for reading.
14-oct 14:30 bls JobId 0: Ready to read from volume "Local-1067" on device "Storage" (/mnt/storage).
Volume Record: File:blk=0:205 SessId=539 SessTime=1563562196 JobId=0 DataLen=170
Begin Job Session Record: File:blk=0:64717 SessId=539 SessTime=1563562196 JobId=5355
   Job=SGE_Prodbd_Auditoria.2019-10-26_12.10.00_59 Date=26-oct-2019 12:10:05 Level=F Type=B
End Job Session Record: File:blk=0:2259408898 SessId=539 SessTime=1563562196 JobId=5355
   Date=26-oct-2019 12:16:52 Level=F Type=B Files=2 Bytes=2,257,729,623 Errors=0 Status=T
Begin Job Session Record: File:blk=0:2259473410 SessId=541 SessTime=1563562196 JobId=5357
   Job=SGE_Prodbd_Auditoria.2019-10-27_12.10.00_01 Date=27-oct-2019 12:10:04 Level=F Type=B
End Job Session Record: File:blk=1:223850295 SessId=541 SessTime=1563562196 JobId=5357
   Date=27-oct-2019 12:17:06 Level=F Type=B Files=2 Bytes=2,257,729,623 Errors=0 Status=T
Begin Job Session Record: File:blk=1:223914807 SessId=543 SessTime=1563562196 JobId=5359
   Job=SGE_Prodbd_Auditoria.2019-10-28_12.10.00_03 Date=28-oct-2019 12:10:03 Level=F Type=B
End Job Session Record: File:blk=1:2483258988 SessId=543 SessTime=1563562196 JobId=5359
   Date=28-oct-2019 12:17:45 Level=F Type=B Files=2 Bytes=2,257,729,623 Errors=0 Status=T
Begin Job Session Record: File:blk=1:2483323500 SessId=550 SessTime=1563562196 JobId=5366
   Job=SGE_Prodbd_Auditoria.2019-10-29_12.10.00_10 Date=29-oct-2019 12:10:04 Level=F Type=B
End Job Session Record: File:blk=2:447700385 SessId=550 SessTime=1563562196 JobId=5366
   Date=29-oct-2019 12:17:41 Level=F Type=B Files=2 Bytes=2,257,729,623 Errors=0 Status=T
Begin Job Session Record: File:blk=2:447764897 SessId=559 SessTime=1563562196 JobId=5375
   Job=SGE_Prodbd_Auditoria.2019-10-30_12.10.00_31 Date=30-oct-2019 12:10:03 Level=F Type=B
End Job Session Record: File:blk=2:2452864311 SessId=559 SessTime=1563562196 JobId=5375
   Date=30-oct-2019 12:17:12 Level=F Type=B Files=2 Bytes=2,003,674,996 Errors=0 Status=T
14-oct 14:32 bls JobId 0: End of Volume at file 2 on device "Storage" (/mnt/storage), Volume "Local-1067"
14-oct 14:32 bls JobId 0: End of all volumes.


[root@baculaanexo ~]# bextract -V Local-1067 /mnt/storage /home/usuario99/restauracion
bextract: butil.c:287-0 Using device: "/mnt/storage" for reading.
14-oct 14:40 bextract JobId 0: Ready to read from volume "Local-1067" on device "Storage" (/mnt/storage).
bextract JobId 0: -rw-r--r--   1 root     root      2282063806 2019-10-25 17:49:18  /home/usuario99/restauracion/bacula/backup/sgecfe_dump_20190906hora1722.sql.gz
bextract JobId 0: drwxr-xr-x   2 root     root            4096 2019-10-25 17:49:11  *none*
bextract JobId 0: -rw-r--r--   1 root     root      2282063806 2019-10-25 17:49:18  /home/usuario99/restauracion/bacula/backup/sgecfe_dump_20190906hora1722.sql.gz
bextract JobId 0: drwxr-xr-x   2 root     root            4096 2019-10-25 17:49:11  *none*
bextract JobId 0: -rw-r--r--   1 root     root      2282063806 2019-10-25 17:49:18  /home/usuario99/restauracion/bacula/backup/sgecfe_dump_20190906hora1722.sql.gz
bextract JobId 0: drwxr-xr-x   2 root     root            4096 2019-10-25 17:49:11  *none*
bextract JobId 0: -rw-r--r--   1 root     root      2282063806 2019-10-25 17:49:18  /home/usuario99/restauracion/bacula/backup/sgecfe_dump_20190906hora1722.sql.gz
bextract JobId 0: drwxr-xr-x   2 root     root            4096 2019-10-25 17:49:11  *none*
bextract JobId 0: -rw-r--r--   1 root     root      2018304477 2019-10-29 13:56:52  /home/usuario99/restauracion/bacula/backup/sgecfe-dump-20191029.sql.gz
bextract JobId 0: drwxr-xr-x   2 root     root            4096 2019-10-29 13:56:45  *none*
14-oct 14:44 bextract JobId 0: End of Volume at file 2 on device "Storage" (/mnt/storage), Volume "Local-1067"
14-oct 14:44 bextract JobId 0: End of all volumes.
10 files restored.
[root@baculaanexo ~]#