Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Jun 2011 14:57:29 +0000 (UTC)
From:      "G. Paul Ziemba" <pz-freebsd-scsi@ziemba.us>
To:        freebsd-scsi@freebsd.org
Subject:   making a predictable passX name
Message-ID:  <iu28kp$dvg$1@hairball.ziemba.us>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?iu28kp$dvg$1>