From owner-freebsd-scsi@FreeBSD.ORG Fri Jun 24 16:30:03 2011 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AEEF1065672 for ; Fri, 24 Jun 2011 16:30:03 +0000 (UTC) (envelope-from bartsch@dssgmbh.de) Received: from mail.incore.de (dss.incore.de [195.145.1.138]) by mx1.freebsd.org (Postfix) with ESMTP id 9E8B28FC13 for ; Fri, 24 Jun 2011 16:30:02 +0000 (UTC) Received: from inetmail.dmz (inetmail.dmz [10.3.0.3]) by mail.incore.de (Postfix) with ESMTP id ED3EC5FD1D; Fri, 24 Jun 2011 18:13:50 +0200 (CEST) X-Virus-Scanned: amavisd-new at incore.de Received: from mail.incore.de ([10.3.0.3]) by inetmail.dmz (inetmail.dmz [10.3.0.3]) (amavisd-new, port 10024) with LMTP id zdfxdiIS0nLs; Fri, 24 Jun 2011 18:13:48 +0200 (CEST) Received: from mail.incore (fwintern.dmz [10.0.0.253]) by mail.incore.de (Postfix) with ESMTP id C53AF5FD16; Fri, 24 Jun 2011 18:13:48 +0200 (CEST) Received: from pcadmin.incore (pcadmin.incore [192.168.0.140]) by mail.incore (Postfix) with ESMTPSA id B132145050; Fri, 24 Jun 2011 18:13:48 +0200 (CEST) Message-ID: <4E04B7BC.6010707@dssgmbh.de> Date: Fri, 24 Jun 2011 18:13:48 +0200 From: Alfred Bartsch User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; de-DE; rv:1.9.1.16) Gecko/20110126 Thunderbird/3.0.11 MIME-Version: 1.0 To: paul+usenet@w6yx.stanford.edu References: In-Reply-To: X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: freebsd-scsi@freebsd.org Subject: Re: making a predictable passX name X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jun 2011 16:30:03 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 24.06.2011 16:57, schrieb G. Paul Ziemba: > 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? > You can achieve this behaviour via editing /boot/device.hints: ... # SCSI tape peripherals # hint.scbus.0.at="mpt0" hint.scbus.0.bus="0" # # Drive hint.sa.0.at="scbus0" hint.sa.0.target="4" hint.sa.0.lun="0" hint.pass.0.at="scbus0" hint.pass.0.target="4" hint.pass.0.lun="0" # Changer hint.ch.0.at="scbus0" hint.ch.0.target="4" hint.ch.0.lun="1" hint.pass.1.at="scbus0" hint.pass.1.target="4" hint.pass.1.lun="1" # all You have to know is: - - the SCSI driver (in our case mpt) with its associated bus number (0) - - target and lun of drive and changer it is then possible to freely choose a pass device number, in this example: SCSI_ID 0:4:0 gets pass0 (drive), SCSI_ID 0:4:1 gets pass1 (changer) changes take effect after reboot, HTH. - -- Alfred Bartsch Data-Service GmbH -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk4Et7wACgkQ5QGe2JdVf3gsrwCguAGB3JaOB2OQA6BQbstwgnaE K8YAn0F+m+S1UN6SR6WlMuPqxQmtktyi =WyTG -----END PGP SIGNATURE-----