← Documents Documentation/scsi/scsi-changer.rst GitHub 원문 ↗

Linux 6.18.37 · SCSI

SCSI media changer 드라이버

SCSI jukebox의 element model, character device 사용법, module option과 문제 해결 절차를 설명합니다.

Source pathDocumentation/scsi/scsi-changer.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

scsi-changer.rst:1-184

SCSI jukebox의 element model, character device 사용법, module option과 문제 해결 절차를 설명합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 =========================
4 SCSI media changer driver
5 =========================
6
7 This is a driver for SCSI Medium Changer devices, which are listed
8 with "Type: Medium Changer" in /proc/scsi/scsi.
9
10 This is for *real* Jukeboxes. It is *not* supported to work with
11 common small CD-ROM changers, neither one-lun-per-slot SCSI changers
12 nor IDE drives.
13
14 Userland tools available from here:
15 http://linux.bytesex.org/misc/changer.html
16
17
18 General Information
19 -------------------
20
21 First some words about how changers work: A changer has 2 (possibly
22 more) SCSI ID's. One for the changer device which controls the robot,
23 and one for the device which actually reads and writes the data. The
24 later may be anything, a MOD, a CD-ROM, a tape or whatever. For the
25 changer device this is a "don't care", he *only* shuffles around the
26 media, nothing else.
27
28
29 The SCSI changer model is complex, compared to - for example - IDE-CD
30 changers. But it allows to handle nearly all possible cases. It knows
31 4 different types of changer elements:
32
33 =============== ==================================================
34 media transport this one shuffles around the media, i.e. the
35 transport arm. Also known as "picker".
36 storage a slot which can hold a media.
37 import/export the same as above, but is accessible from outside,
38 i.e. there the operator (you !) can use this to
39 fill in and remove media from the changer.
40 Sometimes named "mailslot".
41 data transfer this is the device which reads/writes, i.e. the
42 CD-ROM / Tape / whatever drive.
43 =============== ==================================================
44
45 None of these is limited to one: A huge Jukebox could have slots for
46 123 CD-ROM's, 5 CD-ROM readers (and therefore 6 SCSI ID's: the changer
47 and each CD-ROM) and 2 transport arms. No problem to handle.
48
49
50 How it is implemented
51 ---------------------
52
53 I implemented the driver as character device driver with a NetBSD-like
54 ioctl interface. Just grabbed NetBSD's header file and one of the
55 other linux SCSI device drivers as starting point. The interface
56 should be source code compatible with NetBSD. So if there is any
57 software (anybody knows ???) which supports a BSDish changer driver,
58 it should work with this driver too.
59
60 Over time a few more ioctls where added, volume tag support for example
61 wasn't covered by the NetBSD ioctl API.
62
63
64 Current State
65 -------------
66
67 Support for more than one transport arm is not implemented yet (and
68 nobody asked for it so far...).
69
70 I test and use the driver myself with a 35 slot cdrom jukebox from
71 Grundig. I got some reports telling it works ok with tape autoloaders
72 (Exabyte, HP and DEC). Some People use this driver with amanda. It
73 works fine with small (11 slots) and a huge (4 MOs, 88 slots)
74 magneto-optical Jukebox. Probably with lots of other changers too, most
75 (but not all :-) people mail me only if it does *not* work...
76
77 I don't have any device lists, neither black-list nor white-list. Thus
78 it is quite useless to ask me whenever a specific device is supported or
79 not. In theory every changer device which supports the SCSI-2 media
80 changer command set should work out-of-the-box with this driver. If it
81 doesn't, it is a bug. Either within the driver or within the firmware
82 of the changer device.
83
84
85 Using it
86 --------
87
88 This is a character device with major number is 86, so use
89 "mknod /dev/sch0 c 86 0" to create the special file for the driver.
90
91 If the module finds the changer, it prints some messages about the
92 device [ try "dmesg" if you don't see anything ] and should show up in
93 /proc/devices. If not.... some changers use ID ? / LUN 0 for the
94 device and ID ? / LUN 1 for the robot mechanism. But Linux does *not*
95 look for LUNs other than 0 as default, because there are too many
96 broken devices. So you can try:
97
98 1) echo "scsi add-single-device 0 0 ID 1" > /proc/scsi/scsi
99 (replace ID with the SCSI-ID of the device)
100 2) boot the kernel with "max_scsi_luns=1" on the command line
101 (append="max_scsi_luns=1" in lilo.conf should do the trick)
102
103
104 Trouble?
105 --------
106
107 If you insmod the driver with "insmod debug=1", it will be verbose and
108 prints a lot of stuff to the syslog. Compiling the kernel with
109 CONFIG_SCSI_CONSTANTS=y improves the quality of the error messages a lot
110 because the kernel will translate the error codes into human-readable
111 strings then.
112
113 You can display these messages with the dmesg command (or check the
114 logfiles). If you email me some question because of a problem with the
115 driver, please include these messages.
116
117
118 Insmod options
119 --------------
120
121 debug=0/1
122 Enable debug messages (see above, default: 0).
123
124 verbose=0/1
125 Be verbose (default: 1).
126
127 init=0/1
128 Send INITIALIZE ELEMENT STATUS command to the changer
129 at insmod time (default: 1).
130
131 timeout_init=<seconds>
132 timeout for the INITIALIZE ELEMENT STATUS command
133 (default: 3600).
134
135 timeout_move=<seconds>
136 timeout for all other commands (default: 120).
137
138 dt_id=<id1>,<id2>,... / dt_lun=<lun1>,<lun2>,...
139 These two allow to specify the SCSI ID and LUN for the data
140 transfer elements. You likely don't need this as the jukebox
141 should provide this information. But some devices don't ...
142
143 vendor_firsts=, vendor_counts=, vendor_labels=
144 These insmod options can be used to tell the driver that there
145 are some vendor-specific element types. Grundig for example
146 does this. Some jukeboxes have a printer to label fresh burned
147 CDs, which is addressed as element 0xc000 (type 5). To tell the
148 driver about this vendor-specific element, use this::
149
150 $ insmod ch \
151 vendor_firsts=0xc000 \
152 vendor_counts=1 \
153 vendor_labels=printer
154
155 All three insmod options accept up to four comma-separated
156 values, this way you can configure the element types 5-8.
157 You likely need the SCSI specs for the device in question to
158 find the correct values as they are not covered by the SCSI-2
159 standard.
160
161
162 Credits
163 -------
164
165 I wrote this driver using the famous mailing-patches-around-the-world
166 method. With (more or less) help from:
167
168 - Daniel Moehwald <moehwald@hdg.de>
169 - Dane Jasper <dane@sonic.net>
170 - R. Scott Bailey <sbailey@dsddi.eds.com>
171 - Jonathan Corbet <corbet@lwn.net>
172
173 Special thanks go to
174
175 - Martin Kuehne <martin.kuehne@bnbt.de>
176
177 for a old, second-hand (but full functional) cdrom jukebox which I use
178 to develop/test driver and tools now.
179
180 Have fun,
181
182 Gerd
183
184 Gerd Knorr <kraxel@bytesex.org>
185

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

실제 jukebox용 media changer

1-17

이 드라이버는 `/proc/scsi/scsi`에 `Type: Medium Changer`로 표시되는 SCSI Medium Changer 장치를 위한 것이다. 실제 jukebox를 대상으로 하며, slot마다 LUN 하나를 쓰는 소형 SCSI CD-ROM changer나 IDE drive 같은 일반 소형 changer는 지원하지 않는다.

User space 도구는 `http://linux.bytesex.org/misc/changer.html`에서 구할 수 있다.

.. SPDX-License-Identifier: GPL-2.0

=========================
SCSI media changer driver
=========================

This is a driver for SCSI Medium Changer devices, which are listed
with "Type: Medium Changer" in /proc/scsi/scsi.

This is for *real* Jukeboxes.  It is *not* supported to work with
common small CD-ROM changers, neither one-lun-per-slot SCSI changers
nor IDE drives.

Userland tools available from here:
        http://linux.bytesex.org/misc/changer.html

Changer의 SCSI ID와 네 가지 element

18-49

Changer에는 보통 SCSI ID가 둘 이상 있다. 하나는 robot을 제어하는 changer 장치용이고 다른 하나는 실제 데이터를 읽고 쓰는 drive용이다. 후자는 MOD, CD-ROM, tape 등 무엇이든 될 수 있다. Changer 장치는 media를 옮기기만 하며 그 내용을 읽거나 쓰지 않는다.

SCSI changer model은 IDE-CD changer보다 복잡하지만 거의 모든 구성을 표현할 수 있다. 각 element 종류의 개수는 하나로 제한되지 않는다. 예를 들어 CD-ROM slot 123개, reader 5개, transport arm 2개인 jukebox는 changer와 reader를 합쳐 SCSI ID 6개를 사용해도 처리할 수 있다.

SCSI changer element
Element역할
media transportMedia를 옮기는 transport arm, 즉 picker
storageMedia를 보관하는 slot
import/export외부에서 media를 넣고 빼는 slot, mailslot이라고도 함
data transferCD-ROM, tape 등 실제 읽기·쓰기를 수행하는 drive

Changer가 구분하는 네 element 유형이다.

General Information
-------------------

First some words about how changers work: A changer has 2 (possibly
more) SCSI ID's. One for the changer device which controls the robot,
and one for the device which actually reads and writes the data. The
later may be anything, a MOD, a CD-ROM, a tape or whatever. For the
changer device this is a "don't care", he *only* shuffles around the
media, nothing else.


The SCSI changer model is complex, compared to - for example - IDE-CD
changers. But it allows to handle nearly all possible cases. It knows
4 different types of changer elements:

  ===============   ==================================================
  media transport   this one shuffles around the media, i.e. the
                    transport arm.  Also known as "picker".
  storage           a slot which can hold a media.
  import/export     the same as above, but is accessible from outside,
                    i.e. there the operator (you !) can use this to
                    fill in and remove media from the changer.
                    Sometimes named "mailslot".
  data transfer     this is the device which reads/writes, i.e. the
                    CD-ROM / Tape / whatever drive.
  ===============   ==================================================

None of these is limited to one: A huge Jukebox could have slots for
123 CD-ROM's, 5 CD-ROM readers (and therefore 6 SCSI ID's: the changer
and each CD-ROM) and 2 transport arms. No problem to handle.

Character device와 NetBSD 호환 ioctl

50-63

드라이버는 NetBSD와 비슷한 ioctl interface를 가진 character device driver로 구현됐다. NetBSD header와 다른 Linux SCSI device driver를 출발점으로 삼았으며 source code 수준에서 NetBSD와 호환되는 것을 목표로 한다. BSD 계열 changer driver를 지원하는 software라면 이 드라이버에서도 동작해야 한다.

시간이 지나며 NetBSD ioctl API에 없던 volume tag 지원 등 몇 가지 ioctl이 추가됐다.

How it is implemented
---------------------

I implemented the driver as character device driver with a NetBSD-like
ioctl interface. Just grabbed NetBSD's header file and one of the
other linux SCSI device drivers as starting point. The interface
should be source code compatible with NetBSD. So if there is any
software (anybody knows ???) which supports a BSDish changer driver,
it should work with this driver too.

Over time a few more ioctls where added, volume tag support for example
wasn't covered by the NetBSD ioctl API.

지원 상태와 장치 호환성

64-84

Transport arm을 둘 이상 사용하는 기능은 아직 구현되지 않았다. 작성자는 Grundig 35-slot CD-ROM jukebox로 직접 시험했고 Exabyte, HP, DEC tape autoloader, Amanda backup software, 11-slot 소형 장치와 MO drive 4개·slot 88개인 대형 magneto-optical jukebox에서도 동작한다는 보고를 받았다.

Black list나 white list 형태의 장치 목록은 없다. 원칙적으로 SCSI-2 media changer command set을 지원하는 모든 changer가 별도 설정 없이 동작해야 한다. 동작하지 않는다면 driver 또는 changer firmware의 bug다.

Current State
-------------

Support for more than one transport arm is not implemented yet (and
nobody asked for it so far...).

I test and use the driver myself with a 35 slot cdrom jukebox from
Grundig.  I got some reports telling it works ok with tape autoloaders
(Exabyte, HP and DEC).  Some People use this driver with amanda.  It
works fine with small (11 slots) and a huge (4 MOs, 88 slots)
magneto-optical Jukebox.  Probably with lots of other changers too, most
(but not all :-) people mail me only if it does *not* work...

I don't have any device lists, neither black-list nor white-list.  Thus
it is quite useless to ask me whenever a specific device is supported or
not.  In theory every changer device which supports the SCSI-2 media
changer command set should work out-of-the-box with this driver.  If it
doesn't, it is a bug.  Either within the driver or within the firmware
of the changer device.

Device node 생성과 LUN 1 검색

85-103

이 character device의 major number는 86이다. `mknod /dev/sch0 c 86 0`으로 특수 파일을 만든다. Module이 changer를 발견하면 장치 정보를 kernel log에 남기고 `/proc/devices`에도 나타나야 하므로 보이지 않으면 `dmesg`를 확인한다.

일부 changer는 drive를 LUN 0, robot mechanism을 LUN 1에 둔다. Linux는 고장 난 장치가 많다는 이유로 기본적으로 0 이외 LUN을 찾지 않는다. 이때 `echo "scsi add-single-device 0 0 ID 1" > /proc/scsi/scsi`로 LUN 1을 추가하거나 kernel command line에 `max_scsi_luns=1`을 지정한다. `lilo.conf`에서는 `append="max_scsi_luns=1"`을 사용할 수 있다.

LUN 1 changer 검색
Changer가 LUN 1을 사용/proc/scsi/scsi에 add-single-device 기록 또는 max_scsi_luns=1로 boot/dev/sch0에서 changer 사용

Robot mechanism이 기본 scan에 나타나지 않을 때의 두 경로다.

Using it
--------

This is a character device with major number is 86, so use
"mknod /dev/sch0 c 86 0" to create the special file for the driver.

If the module finds the changer, it prints some messages about the
device [ try "dmesg" if you don't see anything ] and should show up in
/proc/devices. If not....  some changers use ID ? / LUN 0 for the
device and ID ? / LUN 1 for the robot mechanism. But Linux does *not*
look for LUNs other than 0 as default, because there are too many
broken devices. So you can try:

  1) echo "scsi add-single-device 0 0 ID 1" > /proc/scsi/scsi
     (replace ID with the SCSI-ID of the device)
  2) boot the kernel with "max_scsi_luns=1" on the command line
     (append="max_scsi_luns=1" in lilo.conf should do the trick)

Debug log와 오류 문자열

104-117

`insmod debug=1`로 driver를 넣으면 자세한 정보를 syslog에 기록한다. Kernel을 `CONFIG_SCSI_CONSTANTS=y`로 build하면 error code를 사람이 읽을 수 있는 문자열로 변환하므로 오류 메시지 품질이 크게 좋아진다.

메시지는 `dmesg`나 log file에서 확인한다. Driver 문제를 문의할 때는 이 메시지를 반드시 함께 보낸다.

Trouble?
--------

If you insmod the driver with "insmod debug=1", it will be verbose and
prints a lot of stuff to the syslog.  Compiling the kernel with
CONFIG_SCSI_CONSTANTS=y improves the quality of the error messages a lot
because the kernel will translate the error codes into human-readable
strings then.

You can display these messages with the dmesg command (or check the
logfiles).  If you email me some question because of a problem with the
driver, please include these messages.

Module option과 vendor element

118-161

`debug=0/1`은 debug message를 켜며 기본값은 0이다. `verbose=0/1`은 자세한 출력을 제어하며 기본값은 1이다. `init=0/1`은 module 삽입 때 changer에 `INITIALIZE ELEMENT STATUS` 명령을 보낼지 정하고 기본값은 1이다.

`timeout_init=<seconds>`는 `INITIALIZE ELEMENT STATUS` timeout으로 기본 3600초다. `timeout_move=<seconds>`는 나머지 모든 명령의 timeout이며 기본 120초다. `dt_id`와 `dt_lun`은 data transfer element의 SCSI ID와 LUN을 직접 지정한다. Jukebox가 보통 이 정보를 제공하지만 일부 장치는 제공하지 않는다.

`vendor_firsts`, `vendor_counts`, `vendor_labels`는 vendor 고유 element 유형을 알려 준다. 예를 들어 Grundig jukebox의 새 CD label printer가 type 5, element `0xc000`이면 `vendor_firsts=0xc000 vendor_counts=1 vendor_labels=printer`로 지정한다. 세 option은 쉼표로 나눈 값을 각각 최대 네 개 받아 element type 5~8을 설정한다. 이 값은 SCSI-2 표준 범위 밖이므로 해당 장치의 SCSI 명세가 필요할 수 있다.

Changer module option
Option의미기본값
debugDebug message0
verbose상세 message1
init삽입 때 INITIALIZE ELEMENT STATUS 전송1
timeout_init초기화 명령 timeout3600초
timeout_move기타 명령 timeout120초
dt_id / dt_lunData transfer element 주소장치 제공값
vendor_firsts / counts / labelsVendor element type 5~8없음

Option별 의미와 기본값이다.

Insmod options
--------------

debug=0/1
        Enable debug messages (see above, default: 0).

verbose=0/1
        Be verbose (default: 1).

init=0/1
        Send INITIALIZE ELEMENT STATUS command to the changer
        at insmod time (default: 1).

timeout_init=<seconds>
        timeout for the INITIALIZE ELEMENT STATUS command
        (default: 3600).

timeout_move=<seconds>
        timeout for all other commands (default: 120).

dt_id=<id1>,<id2>,... / dt_lun=<lun1>,<lun2>,...
        These two allow to specify the SCSI ID and LUN for the data
        transfer elements.  You likely don't need this as the jukebox
        should provide this information.  But some devices don't ...

vendor_firsts=, vendor_counts=, vendor_labels=
        These insmod options can be used to tell the driver that there
        are some vendor-specific element types.  Grundig for example
        does this.  Some jukeboxes have a printer to label fresh burned
        CDs, which is addressed as element 0xc000 (type 5).  To tell the
        driver about this vendor-specific element, use this::

                $ insmod ch                        \
                        vendor_firsts=0xc000        \
                        vendor_counts=1                \
                        vendor_labels=printer

        All three insmod options accept up to four comma-separated
        values, this way you can configure the element types 5-8.
        You likely need the SCSI specs for the device in question to
        find the correct values as they are not covered by the SCSI-2
        standard.

개발과 시험에 기여한 사람들

162-184

Gerd Knorr는 여러 지역에서 patch를 우편처럼 주고받는 방식으로 이 driver를 작성했다. Daniel Moehwald, Dane Jasper, R. Scott Bailey, Jonathan Corbet이 도움을 주었다.

Martin Kuehne는 오래된 중고지만 완전히 동작하는 CD-ROM jukebox를 제공했고, 작성자는 이를 driver와 tool 개발·시험에 사용했다.

Credits
-------

I wrote this driver using the famous mailing-patches-around-the-world
method.  With (more or less) help from:

        - Daniel Moehwald <moehwald@hdg.de>
        - Dane Jasper <dane@sonic.net>
        - R. Scott Bailey <sbailey@dsddi.eds.com>
        - Jonathan Corbet <corbet@lwn.net>

Special thanks go to

        - Martin Kuehne <martin.kuehne@bnbt.de>

for a old, second-hand (but full functional) cdrom jukebox which I use
to develop/test driver and tools now.

Have fun,

   Gerd

Gerd Knorr <kraxel@bytesex.org>