640 643




Linux Unleashed, Third Edition:SCSI Device Support





-->















Previous
Table of Contents
Next




SCSI Device Drivers
Every device on the Linux system must have a device file, and SCSI devices are no different. In many cases, Linux is distributed with a complete set of SCSI device files that need only to be configured properly. You should know a little about device drivers, device files, and major and minor device numbers. See Chapter 33, “Devices,” for more information.

Hard Drives
SCSI disk drives are always block devices and should always use major device number 8. No “raw” SCSI devices are usually supported by Linux despite its similarity to BSD UNIX, which does support raw SCSI devices.

Sixteen minor device numbers are allocated to each SCSI disk device. Minor device number 0 represents the whole disk drive, minor numbers 1 through 4 are the four primary partitions, and minor numbers 5 through 15 are used for any extended partitions.
With Linux, SCSI disk minor device numbers are assigned dynamically, starting with the lowest SCSI ID numbers. The standard naming convention for SCSI hard drives is /dev/sd{letter} for the entire disk device (such as /dev/sda or /dev/sdb), and /dev/sd{letter}{partition} for the partitions on that device (such as /dev/sda1 or /dev/sda2).
Linux presents a few problems when partitioning SCSI disks, because Linux talks directly to the SCSI interface. Each disk drive is viewed as the SCSI host sees it, with block numbers from 0 up to the highest block number. They are all assumed to be error-free. This means there is an easy way to get at the disk geometry. (For comparison, DOS requires head-cylinder-sector mapping, which is not as efficient but does allow direct manipulation.)
To partition the drive, you will either have to use the entire disk for Linux (in which case the installation takes care of it), or you can use DOS or Linux’s fdisk program to create partitions for other operating systems first. Also, with systems that support both SCSI hard drives and IDE hard drives, you may have to reconfigure the system in the machine’s BIOS to recognize the SCSI drive as the primary (boot) device.
CD-ROM Devices
SCSI CD-ROM drives with a block size of 512 or 2,048 bytes will work with Linux, but any other block size will not. Because most CD-ROM drives and CD-ROM disks have either 512- or 2,048-byte blocks, this shouldn’t cause a problem unless the drive is from a source where other block sizes are the norm.

CD-ROM disks are offered in several different formats, not all of which are readable on a Linux system. The international standard is called ISO 9660, but not all CD-ROMs conform to this standard because it was adopted long after CD-ROMs became popular.
SCSI CD-ROMs use the major device number 11, and minor device numbers are allocated dynamically. The first CD-ROM drive found is minor 0, the second is minor 1, and so on. The naming convention used with Linux is /dev/sr{digit}, such as /dev/sr0 and /dev/sr1 for the first and second CD-ROM drives installed. Alternatively, some Linux distributions name the devices /dev/scd0, /dev/scd1, and so on.
After you set the CD-ROM SCSI address properly (the system should recognize the device when the SCSI card boots), the CD-ROM device must be mounted. This can be done manually or embedded in the startup sequence so that the drive is always available.
To mount a CD-ROM device, the general command is as follows:


mount /dev/sr0 /mount_point


mount_point is a directory that can be used. You must create the directory beforehand in order for the mount to work. For convenience, most systems that use CD-ROMs should create a directory called /cdrom, which is always the mount point.
If your CD-ROM doesn’t mount properly with this command, the reason may be the disk type or the lack of an entry in the file /etc/fstab which identifies the CD as an ISO 9660 device. The correct syntax to mount an ISO 9660 CD-ROM (also called High-Sierra) is as follows:


mount -t iso9660 /dev/sr0 /mount_point


For this to work correctly, you must have the kernel set to support the ISO 9660 file system. If this hasn’t been done, rebuild the kernel with this option added.

Linux attempts to lock the CD-ROM drive door when a disk is mounted. This is done to prevent file system confusion from a media change. Not all CD-ROM drives support door locking, but if you find yourself unable to eject a CD-ROM, it is probably because the disk is mounted (it doesn’t have to be in use).
Tape Drives
Linux supports several SCSI tape drives. You should check the hardware configuration guide before purchasing one, though, to ensure compatibility. The most popular SCSI tape models, including the Archive Viper QIC drives, Exabyte 8mm drives, and Wangtek 5150S and DAT tape drives, are all known to work well.

SCSI tapes use character device major number 9 and the minor numbers are assigned dynamically. Usually, rewinding tape devices are numbered from 0, so the first tape drive is /dev/rst0 (character mode, major number 9, minor number 0), the second device is /dev/rst1 (character mode, major number 9, minor number 1), and so on. Nonrewinding devices have the high bit set in the minor number so that the first nonrewinding tape drive is /dev/nrst0 (character mode, major device 9, minor device 128).
The standard naming convention for SCSI tape drives is /dev/nrst{digit} for nonrewinding devices (such as /dev/nrst0, /dev/nrst1, and so on), and /dev/rst{digit} for rewinding devices (such as /dev/rst0 and /dev/rst1).
Generally, Linux supports tape devices that use either fixed- or variable-length blocks, as long as the block length is smaller than the driver buffer length, which is set to 32K in most Linux distribution sources (although this can be changed). Tape drive parameters such as block size, buffering process, and tape density are set with ioctls, which can be issued by the mt program.
Other Devices
Many other SCSI devices are available, such as scanners, printers, removable cartridge drives, and so on. These are handled by the Linux generic SCSI device driver. The generic SCSI driver provides an interface for sending commands to all SCSI devices.

SCSI generic devices use character mode and major number 21. The minor device numbers are assigned dynamically from 0 for the first device, and so on. The generic devices have the names /dev/sg0, /dev/sg1, /dev/sg2, and so on.



Previous
Table of Contents
Next














Wyszukiwarka

Podobne podstrony:
641 643
CCNA 640 802 DOC 4976 CO NA EGZAMIN
643 644
625 640
index (640)
Nuestro Círculo 640 CARLSEN CAMPEÓN
20125id 640
TK Cisco CCNA Security IINS 640 553
638 640
589 640 (2)

więcej podobnych podstron