making a predictable passX name

G. Paul Ziemba pz-freebsd-scsi at ziemba.us
Fri Jun 24 15:20:04 UTC 2011


Is there a way to set up a constant name for a /dev/passX
device? (Or maybe there is a better way to solve the problem)

    % uname -r
    8.2-PRERELEASE

    % pkg_info | grep amanda-server
    amanda-server-3.2.1,1 The Advanced Maryland Automatic Network Disk Archiver (serv)

I'm setting up a Dell Powervault 122T with LTO2 drive to operate
with amanda. I seems to me that chg-robot is the best choice of
changer.

chg-robot uses mtx, which seems to require the name of the /dev/passX
device corresponding to the changer (attached as /dev/ch0).
Therefore, I'm trying to create a link with a constant name
that points to the arbitrary /dev/passX name. I plan to use this
constant name in the amanda config file.

I can manually run "camcontrol periphlist ch0" and obtain the
matching pass device name, so in theory I can write a small
script to create a link such as /dev/ch0.pass -> /dev/passX
and then specify /dev/ch0.pass in the amanda config file.

I wrote the following in /etc/devd.conf:

    attach 100 {
	device-name "ch[0-9]+";
	action "camcontrol periphlist $device-name|grep pass|sed -e 's/:.*\$//'|xargs -I PASS ln -s /dev/PASS /dev/$device-name.pass; logger added ch pass link";
    };

    detach 100 {
	device-name "ch[0-9]+";
	action "rm /dev/$device-name.pass; logger removed ch pass link";
    };

I also tried the above with just the "logger" parts in the actions.

However, the actions do not seem to be invoked when the ch0 device
is attached (power-on + camcontrol rescan + messages in /var/log/messages).
Maybe devd does not get an "attach" event when ch attaches?

Is there another way to trigger on the attach/detach events for /dev/chX?
Or a way to hard-wire assignment of the /dev/passX names?

Many thanks for your advice.


-- 
G. Paul Ziemba
FreeBSD unix:
 7:56AM  up 41 days, 11:37, 34 users, load averages: 0.60, 0.66, 0.63


More information about the freebsd-scsi mailing list