Re: changer for more than one usb disk device

"Stefan G. Weichinger" <[email protected]> Sun, 19 Nov 2023 13:00:43 +0100
Newsgroups gmane.comp.archivers.amanda.user
Message-ID <[email protected]>
On 16.11.23 22:08, Moritz Both wrote:
> Greetings,
> 
> we use amanda with usb disks and manually change them every day. I 
> configured udev to create a symlink to /dev/amanda-vtape when the disk 
> is plugged in.
> 
> In /etc/fstab I configured this device so it can be mounted to 
> /mnt/amanda-vtape by the amanda user. This works for many years very 
> well. Changer configuration is:
> 
> define changer mnt-amanda-vtape {
>         tpchanger "chg-disk:/mnt/amanda-vtape"
>         property "num-slot" "1"
>         property "auto-create-slot" "yes"
>         property "removable" "yes"
>         property "mount" "yes"
>         property "umount" "yes"
>         property "umount-lockfile" "/var/lib/amanda/amanda-vtape.lock"
>         property "umount-idle" "1"
>         device-property "ENFORCE_MAX_VOLUME_USAGE" "false"
> }
> 
> Nowerdays the people changing the disks frequently work at home. So it 
> would be nice to plug in more than one disk and have a tape changer scan 
> for more than one disk. I understand there is no changer included in 
> amanda which is directly capable of that.
> 
> I tried to use chg-aggregate, duplicated the above changer, but changed 
> the mount point and lock file, and created this changer:
> 
> define changer mnt-amanda-morethanone-vtape {
>          tpchanger "chg-aggregate:{mnt-amanda-vtape,mnt-amanda-vtape2}"
>          property "state-filename" "/var/lib/amanda/aggregate-state"
> }
> 
> Experiments with this suggest that on failure to mount a disk for the 
> first chg-disk, it aborts with error and does not try the other one:
> 
> root@peapod:~# su backup -s /bin/bash -c "/usr/sbin/amcheck DailySet1"
> Amanda Tape Server Host Check
> -----------------------------
> NOTE: Holding disk '/mnt/amandaholdingdisk/hd/DailySet1': 2960 MB disk 
> space available, using 2960 MB
> mount: /mnt/amanda-vtape2: must be superuser to use mount.
> ERROR: mnt-amanda-vtape2: No removable disk mounted on '/mnt/amanda-vtape2'
> Server check took 0.349 seconds
> 
> Shoudn't the aggregate changer try the next changer in this case? (The 
> error message "must be superuser" can be ignored, when the device 
> symlink from udev exists, it works.)
> 
> Also, I cannot think of a way to tell udev to create stable distinct 
> device symlinks for more than one arbitrary usb disk. I could use 
> /dev/sdc, /dev/sdd... but this is not very reliable if someone adds a 
> disk to the system. It would be possible to create nodes like 
> /dev/amanda-vdisk-3.1.2-0... or so (using the linux system device path) 
> but how could amanda find these? After all, chg-disk needs the mount 
> point, not the device node.
> 
> Current amanda version: 3.5.1
> System: Debian bullseye
> 
> udev config:
> KERNEL=="sd[a-z]", SUBSYSTEMS=="usb", DRIVERS=="usb-storage", 
> SYMLINK+="amanda-vtape-disk", OWNER="backup", GROUP="backup
> 
> /etc/fstab:
> /dev/amanda-vtape       /mnt/amanda-vtape       ext4 
> noauto,owner,nofail     0 2
> 
> 
> Any hints? Thanks in advance.

just a quick reply without details:

I use chg-aggregate with multiple external USB drives for years now

I don't do udev here ... I create fstab-entries with the fs-UUIDs

If needed I can provide more details.