On 8/8/25 15:02, Rob Gerber wrote:
If you think about the bacula disk "autochangers" as if they were physical tape libraries with many tape drives onside each, it makes more sense.

It would be impossible for Library A to send its robot to retrieve a tape from Library B, since they are two separate units, quite probably at different sites. In bacula, we prevent issues like this by usual different media types for each autochanger.

The big concern I have is that if your inc pool uses either changer 1 or changer 2 for storage, even specifying media types 1 and 2 in the autochanger won't prevent all issues. As it stands, I think once you fix the media type issues, you'll have the jobs randomly choosing to place volumes in changer 1 or changer 2. Sure, it won't ask changer 1 to give it a volume from changer 2, but when you do a restore you will have to retrieve volumes from both changers, which strikes me as odd. I can't imagine it's your goal to randomly interleave your backup jobs onto two different autochangers. I can see wanting your job data to be stored in two places, but not on a random basis.

The problem in a nutshell is that Bacula will choose one autochanger drive (Device) to write to at job start time and will never ever change that for the life of the job. The same applies to the read device for Restore, as well as Copy/Migration/VirtualFull jobs. This method makes it easier for the Bacula code to avoid race conditions when multiple simultaneous jobs are competing for devices. Each autochanger must have a unique media type so that Bacula will not attempt to select a volume from autochanger 2 when the job has been assigned a drive on autochanger 1. That means that although it is possible to specify both autochangers in the same Storage stanza, it is not feasible and will not work as expected.

Also, the same is true for each drive specified in a disk autochanger. Each drive must specify the same ArchiveDevice path in its Device resource, or else it must specify a unique MediaType to prevent impossible volume loading scenarios.

How to solve?

If your goal is multiple jobs simultaneously reading/writing to the same physical disk, then a disk autochanger with multiple virtual drives all specifying the same ArchiveDevice path is perfect. The number of virtual drives is simply the max number of jobs you want to be able to run simultaneously.

If your goal is to have a single pool of volume files that reside on different physical disks, then I suggest using vchanger (https://sourceforge.net/projects/vchanger/), which is designed to treat multiple removable drives (RDX, USB, etc) as a single volume store so that all volumes are available to all virtual drives, but it will also work with fixed disk. Alternatively, use a single LVM volume spread across multiple PVs and then use that as the ArchiveDevice for a disk autochanger.

If the goal is to spread a client's or job's volumes across multiple SDs, then I do not think it is possible, because the volumes would have to have different Media Types and there is no way to assign multiple write devices or read devices to a single job instance.


Do you want job data to be placed in BOTH places for each job? If so, the way to do this is with a copy job ran after the first job, not the way it is now.

Robert Gerber
402-237-8692
r...@craeon.net

On Fri, Aug 8, 2025, 1:53 PM Dragan Milivojević <gali...@pkm-inc.com> wrote:

    I believe the problem is that both have the same mediatype.

    On Fri, 8 Aug 2025 at 20:35, White, Daniel E. (GSFC-764.0)[AEGIS]
    via Bacula-users <bacula-users@lists.sourceforge.net> wrote:

        I know WHAT is happening, just not WHY
        I am hoping someone sees something obviously bogus in here.

        Extract from bacula-dir.conf :

        Autochanger {
          Name = "Disk01-Incremental-Autochanger"
          Address = "<SD Server Address>"
          Autochanger = "Disk01-Incremental-Autochanger"
          Device = "Disk01-Incremental-Autochanger"
          MaximumConcurrentJobs = 10
          MediaType = "DiskVolume"
          Password = <redacted>
          SdPort = 9103
        }

        Autochanger {
          Name = "Disk02-Incremental-Autochanger"
          Address = "<SD Server Address>"
          Autochanger = "Disk02-Incremental-Autochanger"
          Device = "Disk02-Incremental-Autochanger"
          MaximumConcurrentJobs = 10
          MediaType = "DiskVolume"
          Password = <redacted>
          SdPort = 9103
        }

        Pool {
          Name = "Incremental"
          ActionOnPurge = Truncate
          AutoPrune = yes
          LabelFormat = "IncVol-"
          MaximumVolumeBytes = 536870912000
          MaximumVolume = 20
          PoolType = "Backup"
          PurgeOldestVolume = yes
          Recycle = yes
          Storage =
        "Disk01-Incremental-Autochanger","Disk02-Incremental-Autochanger"
          StorageGroupPolicy = "FreeSpace"
          VolumeRetention = 2 weeks
        }

        Extract from bacula-sd.conf :

        Autochanger {
          Name = "Disk01-Incremental-Autochanger"
          ChangerCommand = "/dev/null"
          ChangerDevice = "/dev/null"
          Device =
        
"Disk01-Dev01-Incremental","Disk01-Dev02-Incremental","Disk01-Dev03-Incremental","Disk01-Dev04-Incremental","Disk01-Dev05-Incremental","Disk01-Dev06-Incremental","Disk01-Dev07-Incremental","Disk01-Dev08-Incremental","Disk01-Dev09-Incremental","Disk01-Dev10-Incremental"
        }

        Autochanger {
          Name = "Disk02-Incremental-Autochanger"
          ChangerCommand = "/dev/null"
          ChangerDevice = "/dev/null"
          Device =
        
"Disk02-Dev01-Incremental","Disk02-Dev02-Incremental","Disk02-Dev03-Incremental","Disk02-Dev04-Incremental","Disk02-Dev05-Incremental","Disk02-Dev06-Incremental","Disk02-Dev07-Incremental","Disk02-Dev08-Incremental","Disk02-Dev09-Incremental","Disk02-Dev10-Incremental"
        }

        Device {
          Name = "Disk01-Dev01-Incremental"
          AlwaysOpen = yes
          ArchiveDevice = "/backups/Disk01/INCREMENTAL"
          AutomaticMount = yes
          DeviceType = File
          LabelMedia = yes
          MaximumConcurrentJobs = 5
          MediaType = "DiskVolume"
          RandomAccess = yes
          RemovableMedia = no
        }
        ... repeat 39 for times changing Name and ArchiveDevice as needed

        Finally, the bacula.log extract showing the error:


        30-Jul 03:00 <Bacula Server>-dir JobId 36: Start Backup JobId
        36, Job=<Bacula Server>.2025-07-30_03.00.00_32
        30-Jul 03:00 <Bacula Server>-dir JobId 36: Connected to
        Storage "Disk02-Incremental-Autochanger" at <SD Server
        Address>:9103 with TLS
        30-Jul 03:00 <Bacula Server>-dir JobId 36: Using Device
        "Disk02-Dev05-Incremental" to write.
        ...

        30-Jul 03:00 <Bacula Server>-dir JobId 36: Storage
        "Disk02-Incremental-Autochanger" was selected out of group of
        2 available storages. StorageGroupPolicy "FreeSpace" used
        30-Jul 03:00 <Bacula Server>-dir JobId 36: Connected to Client
        "<Bacula Server>-fd" at <SD Server Address>:9102 with TLS
        30-Jul 03:00 <Bacula Server>-fd JobId 36: Connected to Storage
        at <SD Server Address>:9103 with TLS
        ...
        30-Jul 03:00 <Bacula Server>-dir JobId 36: Created new
        Volume="IncVol-0007", Pool="Incremental",
        MediaType="DiskVolume" in catalog.
        30-Jul 03:00 <Bacula Server>-sd JobId 36: Labeled new Volume
        "IncVol-0007" on File device "Disk02-Dev05-Incremental"
        (/backups/Disk02/INCREMENTAL).
        30-Jul 03:00 <Bacula Server>-sd JobId 36: Wrote label to
        prelabeled Volume "IncVol-0007" on File device
        "Disk02-Dev05-Incremental" (/backups/Disk02/INCREMENTAL)
          Termination:            Backup OK

        Note that Disk02 is used
        Volume "IncVol-0007" created here

        Subsequent jobs run and append to Volume "IncVol-0007"

        03-Aug 03:00 <Bacula Server>-dir JobId 48: Connected to
        Storage "Disk02-Incremental-Autochanger" at <SD Server
        Address>:9103 with TLS
        03-Aug 03:00 <Bacula Server>-dir JobId 48: Using Device
        "Disk02-Dev08-Incremental" to write.
        03-Aug 03:00 <Bacula Server>-dir JobId 48: Storage
        "Disk02-Incremental-Autochanger" was selected out of group of
        2 available storages. StorageGroupPolicy "FreeSpace" used
        ...
        03-Aug 03:00 <Bacula Server>-sd JobId 48: Volume "IncVol-0007"
        previously written, moving to end of data.

        Now we get the error:

        This time, the StorageGroupPolicy of "FreeSpace" picks Disk01 !

        08-Aug 03:00 <Bacula Server>-dir JobId 65: Using Device
        "Disk01-Dev06-Incremental" to write.
        08-Aug 03:00 <Bacula Server>-dir JobId 65: Storage
        "Disk01-Incremental-Autochanger" was selected out of group of
        2 available storages. StorageGroupPolicy "FreeSpace" used
        08-Aug 03:00 <Bacula Server>-sd JobId 65: Warning: mount.c:216
        Open of File device "Disk01-Dev06-Incremental"
        (/backups/Disk01/INCREMENTAL) Volume "IncVol-0007" failed:
        ERR=Could not
        open(/backups/Disk01/INCREMENTAL/IncVol-0007,OPEN_READ_WRITE,0640):
        ERR=No such file or directory
        08-Aug 03:00 <Bacula Server>-sd JobId 65: Marking Volume
        "IncVol-0007" in Error in Catalog.

        =============================

        The volume's path is /backups/Disk02/INCREMENTAL/IncVol-0007
        but Bacula is looking to write to
        /backups/Disk01/INCREMENTAL/IncVol-0007

        Here is the problem.

        The same line
          StorageGroupPolicy = "FreeSpace"
        is in each JobDefs resource in bacula-dir.conf

        Does anyone see a stupid mistake made on my part ?

        Does anyone see a way past this mess ?

        Thanks in advance.


        _______________________________________________
        Bacula-users mailing list
        Bacula-users@lists.sourceforge.net
        https://lists.sourceforge.net/lists/listinfo/bacula-users

    _______________________________________________
    Bacula-users mailing list
    Bacula-users@lists.sourceforge.net
    https://lists.sourceforge.net/lists/listinfo/bacula-users



_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to