Bacula still has some difficulties handing removable disk drives as a backup medium. Josh Fisher released the free Vchanger add-on to resolve all of these and reliably handles the mounting of disks and making backup volumes available to Bacula though its autochanger interface.
In this article we explore the concepts, installation and configuration of Vchanger on a new RPi 5 running Ubuntu 24.04 and Bacula 13 which completes the build of BaculaPi 5.
Bacula, Disks and Virtual Tape
Bacula is based on the concept of backing up to tape drives, which are still in widespread use as they provide cheap and reliable bulk storage for data that is not frequently needed such as backups which ideally you never actually need to use in real life. The other advantage of tape is the backup media can be taken offline and locked away somewhere safe and out of harms way until it's needed, or more likely, it's time to reuse it for the latest backup.
Of course we now have low cost disk storage in huge capacities and cloud storage options too where storage is only limited by the size of your wallet. The original design of Bacula hasn't changed though and it doesn't need to as it actually helps to manage general backups if we still think in terms of tapes although a lot of the documentation now refers to volumes instead as this covers tape, disk and object stores like ceph and S3.
In a tape-based scenario each volume is a tape. It keeps things simple and it's easy enough to find the right tape when you need it, providing you've labeled it properly and not forgotten where you've put it.
In a disk-based scenario a volume is a file on the disk containing backup data. We can't just copy files across as we need a way to maintain versions by date/time and also by source.I will have some files with the same name on different hosts, some might be identical such as programs, others will be different such as config. So we need to package the files from each backup together into volumes, and each volume is a file on a backup disk.
You need to make sure that you have enough space on the disk though, and that old volumes get deleted. If you need to restore, you need to make sure that file can be found in exactly the same place that Bacula expects. Things can very quickly get messy.
To help manage this you can create the backup volumes, which are just files, on the disk first and then tell Bacula to limit their size. Backups are then written to the volumes and when one fills it starts on the next. Instead of deleting old volumes you reuse them for new backups, which could mean you have a much longer backup history as the content of expired volumes marked for recycling isn't wiped until they actually get reused.
I've settled on 16GB as a maximum volume size, based on the average size of my weekly backups and how much data could be lost if something bad happened and something corrupted. I also set the volumes to be marked as used after a week so when that disk is next used the new backups will go to new volumes - a volume cannot be recycled until all the jobs within have expired. Some of the backups span multiple volumes of course so it's a trade-off between the number of volumes and how much unused space could be left at the end of a week.
Allowing for some free space by taking say 95% of the formatted data disk size and dividing that by the maximum volume size you'll know how many volume you can fit on your disk. For example I get 110 volumes of 16 GB on a 2TB disk.
If you want to get clever you can over-allocate based on the fact that not every volume will reach it's full size but remember this is a backup solution and your get-out-of-jail-free card for when something bad has happened so you really don't want to take risks.
Regardless of the strategy chosen you still need to make sure that the backup volume files appear in the place Bacula expects. And with removable media this can vary depending on what was plugged in at the time the host started and what's happened since. Your backup disk could appear as /dev/sdb1 one day and /dev/sdc1 another day, which is not helpful.
Vchanger handles this by mounting the disks in a location it controls and informing Bacula of all the volume files defined on the disk which it sees as being volumes in an autochanger. When a volume is needed vChanger creates a symlink from a location Bacula is configured to use for a backup device to the required volume file and Bacula can then use that volume.

In the example above, Bacula see an autochanger with 3 drives, and volume Vol-002 is mounted in drive 1. It is Vchanger that has mounted the USB drive USB-1 to /mnt/vchanger/d15c0001 and created a symlink from /var/spool/vchanger/1 to /mnt/vchanger/d15c001/vol-002. Bacula also knows there are volumes vol-001 and vol-003 available too as Vchanger gave it that information in an update slots command when it mounted the USB drive.
Preparation
Before we get to setting up Vchanger there's a couple of things to think about first.
Backup Data Disks
The disks I use for holding the backup data are a pair of Transcend 2TB ruggedised portable USB hard disks. I originally started out with a pair of 1TB disks but got close to the capacity limit so upgraded during a sale. I'm currently using 700 GB on the first disk and 623 GB on the second but I'm staying with the 2TB disks now that I have them.
There's two reasons I use removable hard drives:
1. If something really bad happens I still have a recent backup held in a separate building. And if something bad enough to take out both house and garage happens then it's a good chance I'll be beneath the rubble of at least one of them so probably not caring.
2. An offline disk should not be affected by any software nasties. It's hard to wipe or encrypt a disk that's not plugged in.
Most portable USB disks are supplied pre-formatted as NTFS so they'll need to be reformatted as something more Linux friendly. I use a single XFS partition and GParted or Partition Manager are the easiest way to do this, although the fdisk and parted command line tools work well. Just be sure you pick the correct disks to work on as these tools need root privileges and will quite happily wipe your PC if you tell them to. It will also help you to identify the disks later if you apply a label to the filesystem such as Bacula1, Bacula2 and so on.
Since each host is configured to encrypt data before sending it to Bacula I've not felt the need to encrypt the backup disks themselves but I guess you could set up something like LUKS to do this if needed, but you would need to make sure the disk is unlocked before Bacula tries to use it.
While large Solid State Disks (SSDs) are now available you're still looking at three times the price of "spinning rust" hard drives. SSD's are also lifed, not only in the amount of data than can be written before it starts to degrade but also how long they can be left disconnected before the data starts to fade. With magnetic disks this can be in excess of 10 years, some SSD's struggle if left unused for a year especially if kept somewhere warm. While backup and archiving should be treated as two separate needs, using disks for longer term archive storage storage is reasonable for a typical small office or home although I personally prefer to use good quality DVD+R for that. And keep a copy with trusted family too.
On the other hand, as well as being faster SSD's can be much more resilient to mechanical shock such as dropping it (and being lighter they hurt less if it lands on your foot). And as to your typical USB stick don't even think about it - far too slow and not reliable at all for even medium term storage.
At least one disk will be needed, we'll repeat the configuration process as many times as needed.
UDev v Automount
The technical issue with using removable disks is their filesystem needs to mounted on the host to make it usable once it's connected, and also nicely dismounted when removed. With Ubuntu there's two main ways of doing that, both of which are supported by Vchanger but need a little bit of configuration. We need to pick one.
Udev uses rules triggered by the connection and disconnection of USB devices to run scripts that do stuff. In this case Vchanger generates rules from its config to run scripts that mount the backup disks to a given location such as /mnt/vchange/[UUID] and then trigger a call to Bacula to scan for backup volumes. I have been using the Udev rules for years now and it pretty much just works. The configuration can be changed at any time without other disruption. The downside is the unmount script is only called once the drive has been removed so it can do little more than clean up after the detach.
Automount can be done two ways, either by the autofs package or via systemd using configuration in /etc/fstab and rebooting. The filesystem is mounted the moment a request is made to it, and it can also be automatically dismounted after a timeout. While I've not used this productively I've found that while it can mount disks present at boot, disks added later are not known to Vchanger and attempts to access them result in a disk not ready. The disks don't mount until accessed, and Vchanger doesn't access them until mounted. Ouch. If you enable the auto-dismount to make it safer to disconnect without manually issuing an umount first then Vchanger does not trigger a remount so again doesn't know about it and will say no backup available. Now I suspect I'm doing it wrong but this seems to be a pretty major issue for disks you'll be adding and removing on a regular basis.
While removing a disk without unmounting is generally considered A Bad Thingtm, I've yet to have a problem by following a simple rule: If the disk activity light on is glowing then don't touch. I personally like the concept of systemd automount with the timeout but until I can make it work I'm going to stick with Udev. I'm also thinking it would be an interesting project to have a eject button wired to a GPIO pin that triggers a umount command for the data disks. One for the winter methinks.
Download VChanger
The final bit of preparation is to download Vchanger at https://sourceforge.net/projects/vchanger. The HowTo.html document is very useful to have and for Ubuntu we want the vchanger-1.0.3.tar.gz from the vchanger/1.0.3 directory. There are two separate copies also available on github if you prefer. VChanger hasn't been updated since 2020 and since it still works with Ubuntu 24.04 LTS I guess there's probably no need.
Vchanger Installation
While there are RPMs available for (now-discontinued!) RHEL-family X86 distributions, for Ubuntu we need to compile from source. This is not as bad as it sounds on the second attempt.
Prerequisites
The Ubuntu image for RPI already has a lot of the packages you'll need to compile and install from source code and with an RPi 5 it doesn't take too long either. We will need to install the g++ compiler and to enable Vchanger to work with UDev rules based on UUIDs we also need to install the developer headers for libudev and libblkid which also bring in the headers for uuid (uuid-dev) too. While we're doing installs we'll also need the at command for the Udev scripts.
sudo apt install g++ make
sudo apt install libblkid-dev libudev-dev at
These are all in the standard Ubuntu repositories and take just a few minutes.
Compile Vchanger
Note: If this compile process fails it's better to either delete and start again or run a make distclean and then fix the issue, otherwise make will probably repeat what it did last time ignoring the changes. There's no dependency checks so working out why things fail can be frustrating. Hopefully this works perfectly for you as I've already gone though that pain.
The first step is to copy the installation file vchanger-1.0.3.tar.gz somewhere convenient on the RPi 5 and extract it. I just create a vchanger folder on my home directory and copied it there
#> tar -xvf ./vchanger-1.0.3.tar.gz
vchanger/vchanger/ReleaseNotes
...
This will create a vchanger directory with all the resources needed. We need to run three command to configure the build of the application, then to run the compile process and finally install the compiles program. As a normal user do a cd vchanger command
The first step is to run a configure command and check the output has everything we need selected. It must be able to find the gcc and g++ compilers and will generate five pages of checking...yes output if successful.
#> ./configure
...
checking for gcc... gcc
checking whether the C compiler works... yes
...
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
...checking for library containing shm_open... none required
checking for library containing udev_new... -ludev
checking libudev.h usability... yes
checking libudev.h presence... yes
checking for libudev.h... yes
checking blkid/blkid.h usability... yes
checking blkid/blkid.h presence... yes
checking for blkid/blkid.h... yes
checking for library containing blkid_evaluate_tag... -lblkid
checking for dirent.h that defines DIR... yes
...
The six lines that mention udev and blkid all need to be set to yes, which they will be if you've installed the developer headers.
The next step is to run make to actually compile the Vchanger executables
#> make
...g++ -DLOCALSTATEDIR='"/usr/local/var"' -g -O2 -o vchanger getline.o gettimeofday.o readlink.o semaphore.o symlink.o sleep.o syslog.o win32_util.o uuidlookup.o bconsole.o tstring.o inifile.o mymutex.o mypopen.o vconf.o loghandler.o errhandler.o util.o changerstate.o diskchanger.o vchanger.o -lblkid -ludev
...
This will produce two more pages similar to the line above and is compiles everything. The final g++ command needs to mention -lblkid and -ludev
The final step is to install Vchanger with a make install command
#> sudo make install-strip
This produces a final two pages of output as it copies all the executables, scripts, man pages and documents to their runtime locations which needs root permissions so needs to be run as sudo.
Create Symlinks
Some of the files are installed to non-standard places (at least as far as Ubuntu is concerned) which interestingly don't align with the udev scripts either. You can either move them, modify the scripts or create symlinks to the actual locations. I prefer to create the symlinks as a quick and easy compromise that also saves having to repeat if I ever need to redeploy or a new version comes out.
| Directory | Target | Link Name | Comment |
| /usr/bin | /usr/local/bin/vchanger | vchanger | Vchanger executable |
| /usr/libexec | /usr/local/libexec/vchanger | vchanger | Udev scripts directory |
Create the links using the ln command by either ln -s [Target] [Directory]/[Link Name] or doing a cd into the directory and creating the link via ln -s [Target] [Link Name]. Changing to the directory first is better in my opinion as a ls -l afterwards will let you check you did it right.
Create Directories
We need to create some additional directories and assign the required permissions
| Directory | Owner | Group | Permission | Purpose |
| /mnt/vchanger | bacula | tape | 750 | Data disks will be mounted underneath this directory |
| /var/spool/vchanger | bacula | tape | 750 | Working location that Bacula will use to access data disks via links managed by Vchanger |
| /var/log/vchanger | bacula | tape | 775 | Vchanger logging |
| /etc/vchanger | root | root | 755 | Vchanger configurations |
Edit Udev Scripts
UDev rules are created for each of the data disks and they call either a mount or a umount launcher with the ID of the disk to mounted or unmounted. The launchers then trigger the actual script via an at now command and return immediately to avoid timeout issue while the actual mount or dismount script runs.
Unfortunately something changed in Ubuntu between 20.04 and 23.10 so that if a mounted device is removed and then a script checks to see if the directory it was mounted to exists then an error is returned. This breaks the umount script which results in the old mount point still being left in an error state and the next time the disk is mounted it fails. The workaround is to simply disable the check so it always does a cleanup. This probably doesn't count as a proper fix but it works.
Open the unmount script in /usr/local/libexec/vchanger/vchanger-umount-uuid.sh if you favourite / least hated edit and scroll down to line 68
# Unmount from configured MOUNT_DIR
# [ -d $MOUNT_DIR/$uuid ] || exit 0 # mountpoint not found
umount $MOUNT_DIR/$uuid &>/dev/null
rmdir $MOUNT_DIR/$uuid &>/dev/null
/usr/bin/vchanger $cf refresh
exit 0
Comment out the mountpoint not found line shown in bold above by placing a # at the start. The disables the check for if the $uuid directory exists or not which is now confused by a badly dismounted filesystem and the script will always attempt to unmount any filesystem there and then remove the directory, which is what we want to happen
Configure Vchanger
Vchanger needs two configuration files for itself. The first sets the location where data disks will actually be mounted to and on Ubuntu this is held in file /etc/defaults/vchanger. I'm using /mnt/vchanger for this and can either create the file in your favourite editor or create it from the console. You'll need to be root to do this.
echo "MOUNT_DIR=/mnt/vchanger" >/etc/default/vchanger
echo "MOUNT_OPTIONS=" >>/etc/default/vchanger
For the next config file we need the UUID of each data disk.#
Find Backup Disk UUIDs
We need to identify each disk we'll be using with Vchanger and this is done using the UUID that is generated when the disk is partitioned. If you didn't make a note of it at the time you can find it using the blkid command by simply plugging the drives in one at a time and noting the UUID for each one.
localadmin@mavis:~$ blkid
/dev/nvme0n1p5: LABEL="root" UUID="2ec4a94c-...
/dev/nvme0n1p3: UUID="a68d8947-...
/dev/nvme0n1p1: LABEL_FATBOOT="system-boot" LABEL="system-boot" UUID="F526-...
/dev/nvme0n1p4: UUID="414f9ca6-...
/dev/nvme0n1p2: LABEL="writable" UUID="1305c13b...
/dev/loop1: BLOCK_SIZE="131072" TYPE="squashfs"
/dev/loop0: BLOCK_SIZE="131072" TYPE="squashfs"
/dev/sda1: LABEL="bacula1" UUID="f80dd731-1234-abcd-5678-0123456789ab" BLOCK_SIZE="512" TYPE="xfs" PARTUUID="1234abcd-01"
I built BaculaPi with five partitions on the SSD which are named /dev/nvme0n1p1 to /dev/nvme0n1p5, a couple of /dev/loop devices used by Ubuntu itself and no other disks so /dev/sda1 has to be the first Bacula data disk. I also gave it a label of bacula1 when I formatted to also help identify it, along with a nice big 1 in permanent marker on the case.
Create Vchanger config file
Each Vchanger you define needs its own configuration file. On a Raspberry Pi I would be surprised if you have more than one but providing you don't try to connect too many disks directly to the USB connection at once it should work fine.
The configuration file should be created in /etc/vchanger and the file can have any name you like but typically ends in .conf so for initial configuration testing I'm using vcTest.conf. The file needs to be readable by vchanger so give it 644 permissions.
The file contains information about both Vchanger itself, the backup disks which are called magazines and some info about Bacula.
User = bacula
Group = tape
Logfile = /var/log/vchanger/vcTest.log
Log Level = 7
Work Dir = /var/spool/vchanger
bconsole = /usr/sbin/bconsole
bconsole config = /etc/bacula/bconsole.conf
Storage Resource = vChangerTest
Default Pool = Scratch
# Test disk 1
magazine = uuid:f80dd731-1234-abcd-5678-0123456789ab
# Test disk 2
magazine = uuid:feedf00d-d15c-beef-2263-baddab1mb0m
Vchanger starts as root but then drops to an unprivileged user which is set in the user and group parameters. The user is the same as used by Bacula itself, which by default is bacula. The group should be tape, and Bacula should also be a member of the tape group too.
We can specify a separate log file for each Vchanger instance using the Logfile parameter and control the amount of info collected in the logs with the log level parameter. The default is 3 which if fine for normal operation. Turning it up to 7 during initial config can help identify any issues.
The Work Dir is the location that Vchanger uses to create the links that will point to the actual data files in the mounted backup disks. We set the disk mount location in /etc/defaults/vchanger and this setting is global to all Vchanger instances on the host.
The next set of parameters control the interaction with Bacula itself. The bconsole parameter is the location of the bconsole program and bconsole config is the config file for it. These are both the defaults although this gives you the option to have a special bconsole config for Vchanger to use if you need.
The storage resource is the name Bacula will use to identify the Vchanger instance in the Autochanger definition section in both the Bacula Directors bacula-dir.conf and Storage Daemons bacula-sd.conf file
Finally we add each disk we will be using to the file. It's useful to add a comment above each one so you know what it is. Each disk definition starts on a new line with the magazine parameter with a value of uuid: followed by the partition UUID of the disk itself. In theory you could have two separate partitions on a disk in which case you'd have two magazine entries for that disk. Make sure the UUID value is correct otherwise it won't be recognised.
Note: If you're using autofs then you can use the file path to where the disks are mounted, but as we discussed above that's not helpful for removable disks.
Generate udev rules
The final step is to create the rules that UDev will use to mount the disks in the right place when they're plugged in. While you can create these entirely by hand yourself if you really insist, Vchanger supplies a helpful utility that will read the UUID's we've just specified in the Vchanger config file and use this to generate the rules for us.
#> vchanger-genudevrules >/etc/udev/rules.d/96-vchanger.rules
#> udevadm control --reload-rules
If you have additional Vchanger instances use a unique .rules filename for each set.
The generated rules will be something like this:
# This file contains udev rules to launch mount and umount scripts
# for magazines defined by filesystem UUID in the autochanger configuration
# files under /etc/vchanger.
#
# This file was generated by the vchanger-genudevrules script.
#
ACTION=="add",SUBSYSTEM=="block", ENV{ID_FS_UUID}=="f80dd731-1234-abcd-5678-0123456789ab", RUN+="/usr/libexec/vchanger/vchanger-launch-mount.sh f80dd731-1234-abcd-5678-0123456789ab"
ACTION=="remove",SUBSYSTEM=="block", ENV{ID_FS_UUID}=="f80dd731-1234-abcd-5678-0123456789ab", RUN+="/usr/libexec/vchanger/vchanger-launch-umount.sh f80dd731-1234-abcd-5678-0123456789ab"
...
Vchanger Configuration Test
At this point we should be able test the basic functionaliy of Vchanger. Connect the backup data disk and then check the /mnt/vchanger directory
#> ls -l /mnt/vchanger/
total 0
drwxrwxr-x 2 bacula tape 54 Jul 27 10:36 f80dd731-cbe2-4ecb-8a93-47f640ef9790
You should be able to see a directory named for the UUID of the backup disk specifed on a magazine = line in the config file. And inside that directory you should be able to see some Bacula volume files from the installation testing, assuming you used this disk in testing of course. You did test the Bacula install before attempting the Vchanger installation didn't you?
When you remove the disk the directory should disappear if you've fixed the scripts.
When the disk is connected you should also be able to see a bay_state file in the directory you specied as Work Dir such as /var/spool/vchanger which also containst the UUID of the disk.
The final check is the logfile you specified, such as /var/log/vchanger/vcTest.log which should show something like this a log level = 7
Sep 03 22:29:41: [1051]: restored state of magazine 0
Sep 03 22:29:42: [1051]: filesystem f80dd731-1234-abcd-5678-0123456789ab has udev assigned device /dev/sda1
Sep 03 22:29:42: [1051]: filesystem f80dd731-1234-abcd-5678-0123456789ab (device /dev/sda1) mounted at /mnt/vchanger/f80dd731-1234-abcd-5678-0123456789ab
Sep 03 22:29:42: [1051]: magazine 0 has 3 volumes on /mnt/vchanger/f80dd731-1234-abcd-5678-0123456789ab
Sep 03 22:29:42: [1051]: 3 volumes on magazine 0 assigned slots 1-3
Sep 03 22:29:42: [1051]: saved state of magazine 0
Sep 03 22:29:42: [1051]: saved dynamic configuration (max used slot: 10)
Sep 03 22:29:42: [1051]: drive 0 previously unloaded
Sep 03 22:29:42: [1051]: ==== preforming REFRESH command
At lower log levels you'll get less information, which is perfectly OK once everything is running as it should.
If you're getting errors then it's better to fix them now before continuing. Unless the error mentions it cannot connect to Bacula. in which case carry on and complete the Bacula connection.
Configure Bacula
Now that Vchanger itself is working we need to add the details of our virtual autochanger to Bacula itself. This needs to be done in both the Bacula Director and the Storage Daemon.
Bacula Director
We need to add an autochanger{} section to the configuration file for the Bacula Director which by default is /etc/bacula/bacula-dir.conf. This file is owned by root so you'll need root or sudo permissions to edit.
Autochanger {
Name = vChangerTest
# Do not use "localhost" here
Address = localhost # N.B. Use a fully qualified name here
SDPort = 9103
Password = "SD-Autochanger-Password"
Device = vChangerTest
Media Type = File1
Autochanger = vChangerTest # point to ourself
Maximum Concurrent Jobs = 10 # run up to 10 jobs a the same time
}
A new Bacula installation will already have an Autochanger definition for FileChgr1 so just copy that and change the name and autochanger parameters to vChangerTest, or whatever you set as the Storage Resource in the Vchanger config file. I like they way the address is set to localhost immediately below the comment of # Do not use "localhost" here.
Bacula Storage Daemon
For the Storage Daemon configuration we also need to add an Autochanger{} section and at least one device section to define a virtual drive within the autochanger.
# Test autochanger
Autochanger {
Name = vChangerTest
Device = vChangerTest-A, vChangerTest-B
Changer Command = "vchanger %c %o %S %a %d"
Changer Device = "/etc/vchanger/vcTest.conf"
}
While we can copy the format from FileChgr1 all the parameters need to be changed. The name must be what you set in the Vchanger config file and this will also be the same name set for the Autochanger in the bacula-dir.conf too. The device must list all the devices that will be part of this autochanger and we'll define them next.
The changer command is the command Bacula will use to control vchanger and this uses parameters in the sequence shown. That's a capital S by the way.
| Bacula variable | %c | %o | %S | %a | %d |
|---|---|---|---|---|---|
| Parameter Name | Changer Device | Command | Library Slot | Archive Device | Drive Index |
The changer device is the config file for the Vchanger instance we configured earlier.
Device {
Name = vChangerTest-A
Media Type = File1
Drive Index = 0
Device Type = File
Archive Device = /var/spool/vchanger/0
LabelMedia = no; # lets Bacula label unlabeled media
Random Access = Yes;
AutomaticMount = yes; # when device opened, read it
RemovableMedia = yes;
AlwaysOpen = no;
Maximum Concurrent Jobs = 5
}
Device {
Name = vChangerTest-B
Media Type = File1
Drive Index = 1
Device Type = File
Archive Device = /var/spool/vchanger/1
LabelMedia = no; # lets Bacula label unlabeled media
Random Access = Yes;
AutomaticMount = yes; # when device opened, read it
RemovableMedia = yes;
AlwaysOpen = no;
Maximum Concurrent Jobs = 5
}
For the virtual tape drives each one needs a unique name and the autochanger name with a suitable suffix is a good way to do this. The drive index parameter must be unique within the autochanger starting from 0. The Archive Device is the path Bacula will use to access the volume files on the disk via Vchanger. This is the path as set in the Work Dir parameter of the Vchanger config file with an additional identifier for the drive on the and using the drive index is convenient for this.
The remaining settings are typical for a disk based backup and tell Bacula that it's not to add media as needed - we'll create them ourselves to manage the disk space, that it can mount them as needed, these are removable disks and being disk file they're random access unlike tapes which are sequential.
It's safest to do a full stop and start of both the Bacula Director and Bacula Storage Daemon for big changes like this, although triggering a reload from Bat is usually OK.
Vchanger Integration Test
We can do a quick check of the connection between Bacula and Vchanger from the command line by sending a command to bconsole. You'll need to be a member of the bacula group for this
#> echo "status slots storage=vChangerTest drive=0" | bconsole
Connecting to Director localhost:9101
1000 OK: 10002 mavis-dir Version: 13.0.4 (12 February 2024)
Enter a period to cancel a command.
status slots storage=vChangerTest drive=0
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
Connecting to Storage daemon vChangerTest at localhost:9103 ...
3306 Issuing autochanger "slots" command.
Device "vChangerTest" has 10 slots.
Connecting to Storage daemon vChangerTest at localhost:9103 ...
3306 Issuing autochanger "list" command.
Slot | Volume Name | Status | Media Type | Pool |
------+------------------+-----------+----------------------+--------------------|
1 | Vol-0018 | Append | File1 | Default |
2 | Vol-0019 | Append | File1 | Default |
3 | Vol-0020 | Append | File1 | File |
4*| | ? | ? | ? |
5*| | ? | ? | ? |
6*| | ? | ? | ? |
7*| | ? | ? | ? |
8*| | ? | ? | ? |
9*| | ? | ? | ? |
10*| | ? | ? | ? |
This shows I the three volumes I had previously created for the File1 media type being accessible in the first 3 slots and ready for use, which is good. You can look a the same information in Bat

The final check it to run a backup and specify the virtual autochanger as the target.
Completion
At this point we now have Bacula installed and tested, Vchanger installed and tested and we're ready to start the full configuration.
If this is a completely new installation you need to start adding clients, jobs, pools and all the rest of it from scratch. In my case I'm migrating an existing Bacula installation so I already have the configuration ready to copy across, but I will need to to a backup/restore of the Bacula Catalog database and then upgrade that from v9 to v13.
And these will be topics for the next few articles.
Troubleshooting
GetMountPointFromUUID: UUID lookups not supported in this build
If you see this in the Vchanger log:
Aug 31 08:44:34: [1965]: GetMountpointFromUUID: UUID lookups not supported by this build
Aug 31 08:44:34: [1965]: ERROR! system error determining mountpoint from UUID
Aug 31 08:44:34: [1965]: magazine 0 is not mounted
Then it means the header files for for blkid and uuid were not detected during the configure stage of the build process. If you've still got the output of configure you'll probably have seen this in the output:
...
checking libudev.h usability... no
checking libudev.h presence... no
checking for libudev.h... no
checking blkid/blkid.h usability... no
checking blkid/blkid.h presence... no
checking for blkid/blkid.h... no
...
Not good. You will need to install the header packages libblkid-dev libudev-dev and then either delete the compile directory and unpack the tar file again or do a make distclean and then repeat the compile/make/install steps again.
Cannot remount data disks
As noted in the Udev v autofs discussion, something changed between Ubuntu 20.04 and 23.10 so that if you remove a USB disk with unmounting first it leaves the mount point in an error state which prevents you remounting again.
With the disk disconnected:
- Check the disk is not mounted using df -h
- Check the UUID device directory /mnt/vchanger/[UUID] and that if it exists it's an empty directory. If it contains files listed as question marks that indicates it's not happy.
Deleting the bad UUID directory using rm /mnt/vchanger/[ name of bad directory ] clears the problem but you then need to recheck the umount script in /usr/local/libexec/vchanger/vchanger-umount-uuid.sh (or where you copied it to) and make sure it's been corrected to properly clear the leftover directory after a disconnect.
Mount and Dismount scrips don't run
The vchanger-launcher-mount.sh and vchanger-launcher-umount.sh scripts