Hi folks, I just found out about these sg_utils which may be helpful for folks running amanda on Linux systems, especially for debugging tapedrive and changer problems... http://gear.torque.net/sg/#Utilities: sg_utils and sg3_utils -- "Jonathan F. Dill" ([EMAIL PROTECTED]) CARB Systems and Network Administrator Home Page: http://www.umbi.umd.edu/~dillTitle: The Linux SCSI Generic (sg) Driver
The Linux SCSI Generic (sg) DriverBackground Features SG device driver downloads Utilities: sg_utils and sg3_utils Sg related pages External references SG in Redhat 6.2, 7.0 and Mandrake 7.1 IntroductionThe Linux sg driver is a upper level SCSI subsystem device driver that is used primarily to handle devices _not_ covered by the other upper level drivers: sd (disks), st (tapes) and sr (CDROMs). The sg driver is used by scanners, cd writers and applications that read cd audio digitally. Sg can also be used for less usual tasks performed on disks, tapes and cdroms. Sg is a character device which, in some contexts, gives it some advantages over sd and sr which are block devices. The interface of sg is at the level of SCSI command requests and their associated responses.BackgroundThe original driver was written by Lawrence Foard in 1992 and remained unchanged for several years. In August 1998 Heiko Eissfeldt and Joerg Schilling started working on enhancements to this driver. Soon after, the author became involved and these efforts culminated in a new sg driver being placed in Linux kernel 2.2.6 which was released on 16th April 1999. It contains the first major upgrade to the SCSI generic packet device driver ("sg") since 1992. This new driver has a super-set of the original interface and the semantics of the implementation are very similar. Hence it offers a high degree of backward compatibility with the original driver.The major reason for introducing a new sg driver into the 2.2 series of kernels was the problem that the original device driver was having trouble finding memory. This driver improves the situation by using scatter gather, memory above the 16 Mbytes level and memory from the scsi dma pool as appropriate. Other drivers were affected by these memory problems (especially those associated with ISA hardware). In kernel 2.2.10 H.J. Lu introduced a new kernel memory allocator that alleviated many of these memory problems. On 4th January 2001 the Linux 2.4.0 kernel was introduced and it contained a "version 3" sg driver that is described below. FeaturesThe following enhancements have been added: scatter gather, command queuing, per file descriptor sequencing (was per device) and asynchronous notification. Scatter gather allows large buffers (previously limited to 128 KB on i386) to be used. Scatter gather is also a lot more "kernel friendly". The original driver used a single large buffer which made it impossible to run 2 or more sg-based applications at the same time. With the new driver a buffer is reserved for each file descriptor guaranteeing that at least that buffer size will be available for each request on the file descriptor. A user may request a larger buffer size on any particular request but runs the (usually remote) risk of an out of memory (ENOMEM) error.A "version 3" sg driver is now available. It adds a new interface that allows more control over SCSI commands and returns more information about their performance. This driver is present in Linux kernel 2.4.0 . A separate version with reduced capabilities is available for the 2.2 series kernels. Features include: larger sense buffer, residual DMA count, 16 byte commands, direct IO support, command duration timing and a "proc_fs" interface. Naturally it is backward compatible with applications based on the sg interface in the lk 2.2 series and earlier. SG device driver downloadsThe following table summarizes the different versions of the sg device driver that are available. If you wish to use one of these tarballs then untar it in /usr/src/linux (or wherever the top of your kernel tree is). As a precaution you may wish to copy the files include/scsi/sg.h and drivers/scsi/sg.c to other names. This will facilitate reversing the patch if required. For information about the differences between versions see the history section at the top of the include/scsi/sg.h file.
For the Linux kernel 2.2 series, the current production version of the sg driver is 2.1.39 . All sg drivers for the 2.2 series of kernels (including the original) are interchangeable (but see final section on this page about Redhat 6.2 and Mandrake 7.1). So, for example, sg22orig.tgz can be put in lk 2.2.17 while, on the other hand, sg2139.tgz can be put in lk 2.2.0 . For the Linux kernel 2.4 series, the current production version of sg is 3.1.17 . Older versions can be obtained from this directory. A sub directory called "original" contains the original driver (i.e. prior to linux kernel 2.2.6) and its HOWTO document. Utilities: sg_utils and sg3_utilsThese are a set of utilities and test programs that use sg and associated interfaces. This utility description page contains more details. There are 2 separate groupings of these utilities as explained below.The first is called sg_utils and it uses the sg version 2 interface found from lk 2.2.6 and onward. Over half of those utilities will also work on the original sg device driver (at least back to the lk 2.0 series). If required, "make common" will produce the subset that will work on the whole lk 2.x series. Since the sg "version 3" device driver still maintains the original interface, the sg_utils package will continue to work in lk 2.4 . The other is called sg3_utils and it assumes (and checks at runtime) that it is using the sg "version 3" device driver (as found in lk 2.4.0). Apart from a few extra features (e.g. ability to select direct IO), the functionality offered is essentially the same as the programs in sg_utils. The latest versions, packaged in tarballs, source and binary rpms are
given in the following table. They contain README and CHANGELOG files and
some man pages.
The above rpms have been rebuilt in RPM v3 (with RH 6.2) to make them easier to load. Sg related pagesFollowing are some links to related pages on this site:
External referencesHere are some useful links to related information held at other sites:
Sg in Redhat 6.2, 7.0 and Mandrake 7.1It has come to my attention that these distributions have slightly modified sg drivers in the lk 2.2 series. The change arises due to a "sigio" patch that has been applied. [The sigio patch backports some new lk 2.4 functionality for POSIX real time signals into the lk 2.2 series.] This patch effects sg because it changes the number of arguments to the kill_fasync() call. This call is found at line 834 in sg version 2.1.39 and looks like this in the standard kernels:kill_fasync(sfp->async_qp, SIGPOLL); If compiling this line gives an error (usually "too few arguments to kill_fasync") then it can safely be changed to this: kill_fasync(sfp->async_qp, SIGPOLL, POLL_IN); This problem only impacts sg 2.1.x versions retrieved from this page
(and sg version 3.0.17).
Douglas Gilbert can be emailed
at this address (also at [EMAIL PROTECTED]).
|
