ALT Linux sysadmins discussion
 help / color / mirror / Atom feed
From: Michael Shigorin <mike@osdn.org.ua>
To: sysadmins@lists.altlinux.org
Subject: [Sysadmins] tape changer udev rules
Date: Sat, 11 Dec 2010 22:03:49 +0200
Message-ID: <20101211200349.GJ28013@osdn.org.ua> (raw)

	Здравствуйте.
Вдруг кому сгодится...

Имеется ленточная библиотека Quantum Scalar i500 и желание
зафиксировать соответствие логических устройств в /dev
физическим стримерам, промаркированным от 1 до 4.

По мотивам
http://reactivated.net/writing_udev_rules.html
http://www.listware.net/201004/bacula-users/96528-bacula-users-label-barcodes-on-quantum-scalar-i500.html
нарисованы следующие правила:

--- /etc/udev/rules.d/80-persistent-streamers.rules
# Autochanger
#BUS=="scsi", KERNEL=="sch0", KERNELS=="7:0:0:1",  NAME="%k", SYMLINK="changer"
#BUS=="scsi", KERNEL=="sg7", KERNELS=="9:0:0:1",  NAME="%k", SYMLINK="changer"
BUS=="scsi", KERNEL=="sg7", ATTRS{vendor}=="ADIC    ", NAME="%k", SYMLINK="changer"                                                                
# tape drives don't show up with serials or such,
# and two reboots with these rules resulted in different layouts
# so for the time being we have to:
#   mtx -f /dev/changer status | head
#   mtx load 1 0
# and then figure out which /dev/nst it is:
#   mt -f /dev/nst0 status
# if it's the drive 0 (and rewound tape), then output should end with:
#   BOT ONLINE IM_REP_EN
# if it's not (still empty), then:
#   DR_OPEN IM_REP_EN
# -- mike on 20100822, see also
# http://sourceforge.net/mailarchive/forum.php?thread_name=1272470577.m2f.333703%40www.backupcentral.com&forum_name=bacula-users                   
# Tape Drive 1
BUS=="scsi", KERNEL=="nst*", ENV{ID_SERIAL}=="35001234567893090", NAME="%k", SYMLINK="tape1"
# Tape Drive 2
BUS=="scsi", KERNEL=="nst*", ENV{ID_SERIAL}=="35001234567893094", NAME="%k", SYMLINK="tape2"
# Tape Drive 3
BUS=="scsi", KERNEL=="nst*", ENV{ID_SERIAL}=="35001234567893000", NAME="%k", SYMLINK="tape3"
# Tape Drive 4
BUS=="scsi", KERNEL=="nst*", ENV{ID_SERIAL}=="35001234567893004", NAME="%k", SYMLINK="tape4"
# in case of a bit different udev...
#BUS=="scsi", KERNEL=="nst*", ATTRS{serial}=="35001234567893004", NAME="%k", SYMLINK="tape4"
---

Серийные номера получены следующим образом:

# udevadm info --query=env -p `udevadm info -q path -n /dev/nst0`

Тестирование:

# udevadm test /sys/class/scsi_tape/nst0 2>&1 | less
# udevadm trigger
# ls -l /dev/tape?
lrwxrwxrwx 1 root root 4 Dec 11 22:16 /dev/tape1 -> nst1
lrwxrwxrwx 1 root root 4 Dec 11 22:16 /dev/tape2 -> nst0
lrwxrwxrwx 1 root root 4 Dec 11 22:16 /dev/tape3 -> nst3
lrwxrwxrwx 1 root root 4 Dec 11 22:16 /dev/tape4 -> nst2

PS: можно было воспользоваться /dev/tape/by-id/*, которые создаёт
/lib/udev/rules.d/60-persistent-storage-tape.rules -- но выходит
не так ясно в эксплуатации :)

-- 
 ---- WBR, Michael Shigorin <mike@altlinux.ru>
  ------ Linux.Kiev http://www.linux.kiev.ua/


                 reply	other threads:[~2010-12-11 20:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101211200349.GJ28013@osdn.org.ua \
    --to=mike@osdn.org.ua \
    --cc=shigorin@gmail.com \
    --cc=sysadmins@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux sysadmins discussion

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/sysadmins/0 sysadmins/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 sysadmins sysadmins/ http://lore.altlinux.org/sysadmins \
		sysadmins@lists.altlinux.org sysadmins@lists.altlinux.ru sysadmins@lists.altlinux.com
	public-inbox-index sysadmins

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.sysadmins


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git