I've just upgraded to Fedora 15. I've used Bacula for backup for some years now, and it works fine. But now I've just run into a problem, probably because Bacula is now running as user bacula rather than as root.
My backup media is two USB disk drives (I keep one offsite and swap them over once a month or so). However Fedora auto-mounts the USB drive with its mount point owned by my UID with mode 700, presumably because I am logged in and this would be the Right Thing for most USB storage. However in this case it is not because Bacula can't access it.
If I understand the sequence of events correctly, udev creates the /dev/sdb and /dev/sdb1 device nodes, and these are then automounted by udisk (which is a Gnome component). It's udisk that decides what the mount parameters are.
What I want is for any disk labelled "BACKUP*" to be mounted with its mount point owned by bacula:bacula, mode 700. I think I need a custom udev rule file in /etc/udev/rules.d. I've read the udev(7) page and "Writing udev rules". Here is what I have come up with so far, in a file called "10-backup-disk.rules". It's being parsed by udev OK, but isn't working: the disk still winds up being owned by me. Can someone tell me what I am doing wrong?
Thanks.
KERNEL!="sd[a-z][0-9]", GOTO="backup-disk_auto_mount_end"
ENV{ID_FS_LABEL}!="BACKUP*", GOTO="backup-disk_auto_mount_end"
# Import FS infos
IMPORT{program}="/sbin/blkid -o udev -p %N"
# Get disk label
ENV{dir_name}="%E{ID_FS_LABEL}"
# Global mount options
ACTION=="add", ENV{mount_options}="relatime,rw"
# Filesystem-specific mount options
ACTION=="add", ENV{mount_options}="$env{mount_options}"
# Mount the device
ACTION=="add", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/bin/mount -o $env{mount_options} /dev/%k /media/%E{dir_name}"
# Clean up after removal
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l /media/%E{dir_name}", RUN+="/bin/rmdir /media/%E{dir_name}"
# Exit
LABEL="backup-disk_auto_mount_end"