psql/bcan error - get back volume to catalog with bscan

71 views
Skip to first unread message

Tom Deak

unread,
Apr 16, 2025, 4:44:11 AM4/16/25
to bareos-users
Hello, 

For testing purposes, I'm trying to restore an existing volume on a backup server to the catalog using bscan. 

The initial situation is: I've set up a new Bareos Director and restored the configuration files in /etc/bareos, so all clients, storage daemons and devices, etc. are back. Everything's working perfectly. 

The director is running in a Proxmox VM. 
The storage is a backup server on which the volumes are located. 
The remote connection to the PostgreSQL database on the director also seems to be working.

However, I think there's a version issue and I don't know how to fix it. 

Here's my (partial) output:

sudo bscan -D bareos-dir -o <bareos_dir_ip> -t 5432 -P <my_db_password> FileStorageCluster00 -V Backup-Cluster-Archive-Full-0 -s -S -d 200

---
Volume Label:
Id                : Bareos 2.0 immortal
VerNo             : 20
VolName           : Backup-Cluster-Archive-Full-0
PrevVolName       :
VolFile           : 0
LabelType         : VOL_LABEL
LabelSize         : 221
PoolName          : Cluster-Archive-Full
MediaType         : FileCluster
PoolType          : Backup
HostName          : backup01
Date label written: 28-Nov-2024 15:45
bscan (130): stored/label.cc:213-0 Compare Vol names: VolName=Backup-Cluster-Archive-Full-0 hdr=Backup-Cluster-Archive-Full-0

Volume Label:
Id                : Bareos 2.0 immortal
VerNo             : 20
VolName           : Backup-Cluster-Archive-Full-0
PrevVolName       :
VolFile           : 0
LabelType         : VOL_LABEL
LabelSize         : 221
PoolName          : Cluster-Archive-Full
MediaType         : FileCluster
PoolType          : Backup
HostName          : backup01
Date label written: 28-Nov-2024 15:45
bscan (130): stored/label.cc:232-0 Leave ReadVolumeLabel() VOL_OK
bscan (100): stored/label.cc:243-0 Call reserve_volume=Backup-Cluster-Archive-Full-0
bscan (150): stored/vol_mgr.cc:357-0 enter reserve_volume=Backup-Cluster-Archive-Full-0 drive="FileStorageCluster00" (/mnt/backup/bareos/cluster)
bscan (150): stored/vol_mgr.cc:271-0 new Vol=Backup-Cluster-Archive-Full-0 at 5575bc64c700 dev="FileStorageCluster00" (/mnt/backup/bareos/cluster)
bscan (150): stored/vol_mgr.cc:515-0 === set in_use. vol=Backup-Cluster-Archive-Full-0 dev="FileStorageCluster00" (/mnt/backup/bareos/cluster)
bscan (150): stored/vol_mgr.cc:550-0 Inc walk_start UseCount=2 volname=Backup-Cluster-Archive-Full-0
bscan (150): stored/vol_mgr.cc:250-0 List end new volume: Backup-Cluster-Archive-Full-0 in_use=1 swap=0 on device "FileStorageCluster00" (/mnt/backup/bareos/cluster)
bscan (100): stored/dev.cc:375-0 Device "FileStorageCluster00" (/mnt/backup/bareos/cluster) has dev->device->max_block_size of 0 and dev->max_block_size of 64512, dcr->VolMaxBlocksize is 0
bscan (100): stored/dev.cc:423-0 set minblocksize to 64512, maxblocksize to 64512 on device "FileStorageCluster00" (/mnt/backup/bareos/cluster)
bscan (100): stored/acquire.cc:298-0 Got correct volume.
16-Apr 10:11 bscan JobId 0: Ready to read from volume "Backup-Cluster-Archive-Full-0" on device "FileStorageCluster00" (/mnt/backup/bareos/cluster).
bscan (100): stored/acquire.cc:394-0 dcr=5575bc6571a0 dev=5575bc65ba80
bscan (100): stored/acquire.cc:396-0 MediaType dcr= dev=FileCluster
bscan: stored/bscan.cc:323-0 First Volume Size = 102067830806314
bscan (100): cats/cats_backends.cc:75-0 db_init_database: Trying to find mapping of given interfacename postgresql to mapping interfacename dbi, partly_compare = true
bscan (100): cats/cats_backends.cc:75-0 db_init_database: Trying to find mapping of given interfacename postgresql to mapping interfacename mysql, partly_compare = false
bscan (100): cats/cats_backends.cc:75-0 db_init_database: Trying to find mapping of given interfacename postgresql to mapping interfacename postgresql, partly_compare = false
bscan (100): cats/cats_backends.cc:217-0 db_init_database: checking backend /usr/lib/bareos/backends/libbareoscats-postgresql.so
bscan (100): cats/cats_backends.cc:240-0 db_init_database: loaded backend /usr/lib/bareos/backends/libbareoscats-postgresql.so
bscan (100): cats/postgresql.cc:958-0 db_init_database first time
bscan (50): cats/postgresql.cc:223-0 pg_real_connect ok
bscan (50): cats/postgresql.cc:225-0 db_user=bareos db_name=bareos db_password=<my_db_password>
16-Apr 10:11 bscan JobId 0: Fatal error: Version error for database "bareos". Wanted 2210, got 2240
bscan (10): stored/bscan.cc:338-0 ERROR TERMINATION: Version error for database "bareos". Wanted 2210, got 2240
bscan: ERROR TERMINATION at stored/bscan.cc:338
Version error for database "bareos". Wanted 2210, got 2240
---

I hope someone can help me figure out where to start to solve the problem. 
Thanks in advance.

Best regards 
Tom

Bruno Friedmann (bruno-at-bareos)

unread,
Apr 16, 2025, 9:00:55 AM4/16/25
to bareos-users
. Wanted 2210, got 2240

Not same bareos major version, you need to upgrade your catalog with /usr/lib/bareos/scripts/update-bareos-table then replay the grant-bareos-privilege

Tom Deak

unread,
Apr 17, 2025, 4:35:46 AM4/17/25
to bareos-users
Hi Bruno,
I thank you for your immediate response. My director and catalog is always the new version. I think the problem is at the storage daemon (Backup Server on different Hardware) which runs at debian 10 where i cannot install latest bareos version because its not available.
I managed to get the latest community version from here: https://download.bareos.org/experimental/PR-2190/Debian_10 which runs at the storage daemon. Is there another possibility because the Volume was created with the bareos-dir vm which was on version 23.<somewhat> at this time..
Why it does now this database version comparison?

Bruno Friedmann (bruno-at-bareos)

unread,
Apr 17, 2025, 4:49:02 AM4/17/25
to bareos-users
Since ages (in fact always) Bareos DIR and Bareos SD have to share the same major,minor version. We even recommend to always keep them synchronised.
Anything else is really not supported, can eat cats :-)
Using something from experimental (which is master -> so next version) can even be more disastrous for your valuable data.

Maybe for your use case you can request a quote to sales at Bareos to get a subscription so you will get working packages for your systems.
They're not so expensive.

Bareos DIR has always compared the DB version and its expected level. Which change only during major release, not always but can happen.

Tom Deak

unread,
Apr 17, 2025, 6:41:25 AM4/17/25
to bareos-users
Thank you so much, Bruno.
Things are a lot clearer to me now.
Unfortunately, the official documentation doesn't provide any information on setting up external storage, as is done for a client installation. I was always puzzled as to how to install bscan on this external storage. During my research, I discovered that bscan is installed with the bareos-database-tools package, which, as the name suggests, depends on a database.
It would, of course, be much more elegant and logical,  if you could initiate the import of the volume into the catalog directly from the director.

Best Regards.
Tom

Bruno Friedmann (bruno-at-bareos)

unread,
Apr 17, 2025, 7:27:21 AM4/17/25
to bareos-users
Hi Tom, 

If you find a better place for bscan than in bareos-database-tools because the job of bscan is to read data from a volume and send it to the catalog database, please open a bug report, or even more useful a PR.
For request like : 
> It would, of course, be much more elegant and logical,  if you could initiate the import of the volume into the catalog directly from the director.
You can also contact the sale department to get a quote to develop and add this feature to the product.

Beware of the following fact, even if bscan seems to be the silver bullet magical unicorn, there's a lots of cases where data are not recorded inside the volume and as such can't be restored from scanning a volume.

The only real full protection is to keep the catalog up to date and resilient. bscan is has to be considered as an emergency tool.
Reply all
Reply to author
Forward
0 new messages