This can be done with UDEV. On Fedora Core 3 I created a file under
/etc/udev/rules.d named 20-jumpdrive.rules with the following line:
KERNEL="sd?1*", SYSFS{vendor}="LEXAR", SYSFS{model}="JUMPDRIVE SECURE",
NAME="%k", SYMLINK="jumpdrive%e"
This causes my Lexar JumpDrive (USB thumbdrive device) to be mapped as a
block device at /dev/jumpdrive when it is inserted. When it is
unplugged the /dev/jumpdrive entry is removed. The "%e" in the SYMLINK
entry causes additional JumpDrives to be mapped to /dev/jumpdrive1,
/dev/jumnpdrive2, etc.
FC3 also uses HAL and has an entry in /etc/hal/device.d to run
/usr/sbin/fstab-sync. fstab-sync adds and removes mountpoints under
/media, as well as entries to /etc/fstab, according to HAL policies
stored under /usr/share/hal/fdi. By default, the volume label of the
device will be used to name the mountpoint. I configured HAL to name my
mountpoint "/mount/jumpdrive" by creating an XML file named
jumpdrive.fdi under /usr/share/hal/fdi/95userpolicy. Here is my
jumpdrive.fdi file:
<?xml version="1.0" encoding="ISO-8859-1"?> <!-- -*- SGML -*- -->
<deviceinfo version="0.2">
<device>
<match key="volume.is_partition" bool="true">
<match key="volume.fsusage" string="filesystem">
<match key="volume.fstype" string="vfat">
<match key="@block.storage_device:storage.vendor" string="LEXAR">
<match key="@block.storage_device:storage.model"
string="JUMPDRIVE SECURE">
<merge key="volume.policy.desired_mount_point"
type="string">jumpdrive</merge>
<merge key="volume.policy.mount_filesystem"
type="string">vfat</merge>
<merge key="volume.policy.should_mount" type="bool">true</merge>
<merge
key="volume.policy.mount_option.fscontext=system_u:object_r:removable_t"
type="bool">false</merge>
</match>
</match>
</match>
</match>
</match>
</device>
</deviceinfo>
I obtained the values to use for the <match> tags from the output of the
lshal command.
So, when I insert the JumpDrive its device node is /dev/jumpdrive, its
mountpoint is /mount/jumpdrive, and an entry is added to /etc/fstab so
that I mount it with the command /bin/mount /mount/jumpdrive.
A RunBeforeJob script could mount the device with a simple mount
command. It could also tell if the drive was inserted by testing whether
or not the mountpoint existed. A RunAfterJob could unmount the device
just as easily. Of course, if multiple drives were being used it would
be neccessary to always insert the devices in the correct order so that
the device with a particular bacula volume label was at the correct
device node and mountpoint.
A better approach would be for the RunBeforeJob script to read the
bacula volume label from all inserted devices, find the mountpoint of
the device containing the desired label, mount it, and then create a
symlink to the mountpoint. The bacula job would use the symlink as its
ArchiveDevice. I have not tried this, and I'm not sure if the
RunAfterJob script could then figure out which device to unmount.
Josh Fisher
<[EMAIL PROTECTED]>
Daniel Bloemer wrote:
Hi,
Alan Brown wrote:
On Sun, 7 Aug 2005, Mick wrote:
I use an USB disk as backup target for Bacula. It works fine. But there
is one issue: I want to mount it immediatly before the backup and
unmount it afterwards. There is even a mount option for the config file
(sd.config I think), but this option is not allowed for a harddisk.
Assuming you're using a linux system, why not allow hotplug and subfs
to do this for you automagically?
I am working on a similiar solution here. The problem is, that the
hotplug-agent doesnt mount the USB-Harddisc on a fixed mountpoint.
I tried to define a fixed mountpoint myself, but the hotplug-agent has
avoided all my attempts until now.
Regards Daniel
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users