📄 sd.4
字号:
.TH SD 4.SH NAMEsd, st, sg \- SCSI hard disk / tape / generic.SH DESCRIPTIONThe.BR sd* ,.BR st* ,.B sg*family of devices refer to the SCSI hard disk, tape and generic driver usingthe Adaptec 154x series of controllers. This manual page only describes thedifferences between the sd and hd devices, read.BR hd (4)first..PPThe devices numbers of the SCSI devices are statically mapped onto the SCSItargets 0 to 7. This is done like the hd devices with.B sd[0\-4]referring to target 0,.B sd[5\-9]to target 1, etc. The logical unit number is always 0, because devices withmore than one logical unit are virtually extinct. The mapping may be changedfrom the boot environment however (see.BR boot (8))..PPTapes start at minor device 64, with.B nrst0at minor 64,.B rst0at 65,.B nrst1at 66, etc. The mapping is again static to target (minor \- 64) / 2. The.B rstdevices rewind the tape on close, the.B nrstdevices do not. See.BR mt (1),and.BR mtio (4)for a description of the commands that may be sent to the tape, either fromthe command prompt or from a program..PPThrough the eight raw generic devices.B rsg[0\-7]starting at minor 120, one can send SCSI commands to any SCSI devicefrom user mode. (Minix-vmd only.).PPThe driver returns a drive geometry of 64 heads by 32 sectors per track forsmall disks with the DIOCGETP ioctl. For large disks 255x63 is returned.The size in sectors is usually larger thanthe largest cylinder number indicates, because the disk is not likely toexactly match that faked geometry. Note that DOS may not be able to accessthose last few sectors..SS Disk like devices.Removable disks (floppies), CD-ROM's and WORM disks may also be accessedthrough the.B sddevices. One is not allowed to write a WORM disk however, because it islikely to be taken from an alien operating system, so it seems safer to notallow Minix to stomp over it. One usually needs special O.S. support tokeep one from writing to the same block twice..PPThe.B DIOCEJECTioctl ejects CD-ROMs, floppies, etc. (See.BR eject (1).)A fixed disk spins down if it supports the stop command..SS SCSI TapesThere are two types of SCSI tapes drives supported by the driver: fixed orvariable block size tape drives. Examples of the first kind are cartridgetapes, with a fixed 512 bytes block size. An Exabyte tape drive has avariable block size, with a minimum of 1 byte and a maximum of 245760 bytes(see the documentation of such devices.)The maximum is truncated to 32767 bytes for Minix-86 and 61440 bytes forMinix-vmd, because the driver can't move more bytes in a single request..PPA read or write to a fixed block size tape must be a precise multiple of theblock size, any other count gives results in an I/O error. A read from avariable block sized tape must be large enough to accept the block that isread, otherwise an I/O error will be returned. A write can be any sizeabove the minimum, creating a block of that size. If the write count islarger than the maximum block size then more blocks are written until thecount becomes zero. The last block must be larger than the minimum ofcourse. (This minimum is often as small as 1 byte, as for the Exabyte.).PPThe.B mt blksizecommand may be used to select a fixed block size for a variable block sizedtape. This will speed up I/O considerably for small block sizes. (Somesystems can only use fixed mode and will write an Exabyte tape with 1024byte blocks, which read very slow in variable mode.).PPA tape is a sequence of blocks and filemarks. A tape may be opened andblocks may be read from it upto a filemark, after that all further readsreturn 0. After the tape is closed and reopened one can read the blocksfollowing the filemark if using a non-rewinding device. This makes the tapelook like a sequence of files..PPIf a tape has been written to or opened in write-only mode, then a filemarkis written if the tape is closed or if a space command is issued. No extrafilemark is written if the drive is instructed to write filemarks..SS Raw Generic DevicesUnder Minix-vmd one can use the generic SCSI devices to program a SCSIdevice entirely from user mode. The disk and tape devices probe for deviceswhen opened, start disks and load tapes, but the generic devices do nothingof this. Given an open file descriptor to any SCSI character device (notjust the generic devices) one can use the following ioctl:.PP.RSioctl(fd, SCIOCCMD, &scsicmd).RE.PPThe structure whose address is passed as the third argument is definedin <sys/scsi.h> as follows:.PP.RS.nfstruct scsicmd { void *cmd; size_t cmdlen; void *buf; size_t buflen; void *sense; size_t senselen; int dir;};.fi.RE.PP.B Cmdand.B cmdlenhold the address and length of an object holding a Group 0 or Group 1SCSI command. The next two fields describe a buffer of at most 8 kilobytesused in the data in or out phase..B Diris 0 if data is to be read from the device, 1 if data is written to thedevice. If the ioctl succeeds then 0 is returned, otherwise -1 with.B errnoset to.B EIOand the request sense info returned in the buffer described by the sense andsenselen fields. If the sense key is zero on error then a host adaptererror occurred, this means that the device is most likely turned off or notpresent..SH FILES.TP 40/dev/sd[0\-9], /dev/sd[1\-46\-9][a\-d]Usual disk devices..TP/dev/rst4, /dev/nrst4Usual tape device..TP/dev/rsg[0\-7]Raw generic devices..SH "SEE ALSO".BR hd (4),.BR mt (1),.BR eject (1),.BR mtio (4),.BR dd (1)..SH AUTHORKees J. Bot (kjb@cs.vu.nl)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -