2001-09-22 20:21:42 +04:00
|
|
|
.\" $NetBSD: sd.4,v 1.13 2001/09/22 16:21:42 wiz Exp $
|
1996-10-21 03:15:21 +04:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 1996
|
|
|
|
.\" Julian Elischer <julian@freebsd.org>. All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\"
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
1996-08-13 07:13:30 +04:00
|
|
|
.Dd January 18, 1996
|
|
|
|
.Dt SD 4
|
1999-03-16 04:19:14 +03:00
|
|
|
.Os
|
1996-08-13 07:13:30 +04:00
|
|
|
.Sh NAME
|
|
|
|
.Nm sd
|
1998-06-10 15:15:20 +04:00
|
|
|
.Nd SCSI and ATAPI disk driver
|
1996-08-13 07:13:30 +04:00
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Cd sd* at scsibus? target ? lun ?
|
|
|
|
.Cd sd3 at scsibus0 target 3 lun 0
|
1998-12-02 14:05:59 +03:00
|
|
|
.Cd "sd* at atapibus? drive ? flags 0x0000"
|
1996-08-13 07:13:30 +04:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
1998-04-30 12:50:03 +04:00
|
|
|
.Nm
|
2001-09-12 02:52:52 +04:00
|
|
|
driver provides support for
|
1996-08-13 07:13:30 +04:00
|
|
|
.Tn SCSI
|
1998-06-10 15:15:20 +04:00
|
|
|
bus and Advanced Technology Attachment Packet Interface
|
|
|
|
.Pq Tn ATAPI
|
|
|
|
disks.
|
1998-04-30 12:50:03 +04:00
|
|
|
It allows the disk to be divided up into a set of pseudo devices called
|
1996-08-13 07:13:30 +04:00
|
|
|
.Em partitions .
|
1998-04-30 12:50:03 +04:00
|
|
|
In general the interfaces are similar to those described by
|
1996-08-13 07:13:30 +04:00
|
|
|
.Xr wd 4 .
|
|
|
|
.Pp
|
1998-04-30 12:50:03 +04:00
|
|
|
Where the
|
1996-08-13 07:13:30 +04:00
|
|
|
.Xr wd 4
|
1998-04-30 12:50:03 +04:00
|
|
|
device has a fairly low level interface to the system,
|
1996-08-13 07:13:30 +04:00
|
|
|
.Tn SCSI
|
1998-04-30 12:50:03 +04:00
|
|
|
devices have a much higher level interface and talk to the system via a
|
1996-08-13 07:13:30 +04:00
|
|
|
.Tn SCSI
|
|
|
|
host adapter
|
|
|
|
(e.g.,
|
|
|
|
.Xr ahc 4 ) .
|
|
|
|
A
|
|
|
|
.Tn SCSI
|
|
|
|
adapter must also be separately configured into the system
|
|
|
|
before a
|
|
|
|
.Tn SCSI
|
|
|
|
disk can be configured.
|
|
|
|
.Pp
|
|
|
|
When the
|
|
|
|
.Tn SCSI
|
1998-04-30 12:50:03 +04:00
|
|
|
adapter is probed during boot, the
|
1996-08-13 07:13:30 +04:00
|
|
|
.Tn SCSI
|
1998-04-30 12:50:03 +04:00
|
|
|
bus is scanned for devices.
|
|
|
|
Any devices found which answer as
|
1996-08-13 07:13:30 +04:00
|
|
|
.Sq Em Direct
|
1998-04-30 12:50:03 +04:00
|
|
|
type devices will be attached to the
|
1996-08-13 07:13:30 +04:00
|
|
|
.Nm
|
|
|
|
driver.
|
1998-12-02 14:05:59 +03:00
|
|
|
.Pp
|
|
|
|
For the use of flags with ATAPI devices, see
|
|
|
|
.Xr wd 4 .
|
1998-04-30 12:50:03 +04:00
|
|
|
.\"In
|
1996-08-13 07:13:30 +04:00
|
|
|
.\".Tn FreeBSD
|
|
|
|
.\"releases prior to 2.1, the first found was attached as
|
|
|
|
.\".Li sd0 ,
|
|
|
|
.\"the second
|
|
|
|
.\".Li sd1 ,
|
|
|
|
.\"and so on.
|
|
|
|
.\"Beginning in 2.1 it became possible to lock down the assignment of
|
|
|
|
.\"devices on the
|
|
|
|
.\".Tn SCSI
|
|
|
|
.\"bus to particular units of the
|
|
|
|
.\".Nm
|
|
|
|
.\"device; refer to
|
|
|
|
.\".Xr scsi 4
|
|
|
|
.\"for details on kernel configuration.
|
|
|
|
.Sh PARTITIONING
|
1998-04-30 12:50:03 +04:00
|
|
|
.\"The
|
1996-08-13 07:13:30 +04:00
|
|
|
.\".Nm
|
|
|
|
.\"driver allows the disk to have two levels of partitioning.
|
|
|
|
.\"One layer, called the
|
|
|
|
.\".Dq slice layer ,
|
|
|
|
.\"is used to separate the
|
|
|
|
.\".Tn FreeBSD
|
|
|
|
.\"areas of the disk from areas used by other operating systems.
|
|
|
|
.\"The second layer is the native
|
|
|
|
.\".Bx 4.4
|
|
|
|
.\"partitioning scheme,
|
|
|
|
.\".Xr disklabel 5 ,
|
|
|
|
.\"which is used to subdivide the
|
|
|
|
.\".Tn FreeBSD
|
|
|
|
.\"slices into areas for individual filesystems and swap spaces.
|
|
|
|
.\"For more information, see
|
|
|
|
.\".Xr fdisk 8
|
|
|
|
.\"and
|
|
|
|
.\".Xr disklabel 8 ,
|
|
|
|
.\"respectively.)
|
1998-04-30 12:50:03 +04:00
|
|
|
On many systems
|
1996-08-13 07:13:30 +04:00
|
|
|
.Xr disklabel 8
|
1998-04-30 12:50:03 +04:00
|
|
|
is used to partition the drive into filesystems.
|
|
|
|
On some systems the
|
1998-02-06 08:54:12 +03:00
|
|
|
.Nx
|
|
|
|
portion of the disk resides within a native partition, and another
|
|
|
|
program is used to create the
|
|
|
|
.Nx
|
|
|
|
portion.
|
1996-08-13 07:13:30 +04:00
|
|
|
.Pp
|
|
|
|
For example, the i386 port uses
|
|
|
|
.Xr fdisk 8
|
1998-04-30 12:50:03 +04:00
|
|
|
to partition the disk into a
|
|
|
|
.Tn BIOS
|
|
|
|
level partition.
|
|
|
|
This allows sharing the disk with other operating systems.
|
1996-08-13 07:13:30 +04:00
|
|
|
.Pp
|
|
|
|
.\"If an uninitialized disk is opened, the slice table will be
|
|
|
|
.\"initialized with a fictitious
|
|
|
|
.\".Tn FreeBSD
|
|
|
|
.\"slice spanning the entire disk. Similarly, if an uninitialized
|
|
|
|
.\"(or
|
|
|
|
.\".No non- Ns Tn FreeBSD )
|
|
|
|
.\"slice is opened, its disklabel will be initialized with parameters returned
|
|
|
|
.\"by the drive and a single
|
|
|
|
.\".Sq Li c
|
|
|
|
.\"partition encompassing the entire slice.
|
|
|
|
.\".Sh KERNEL CONFIGURATION
|
|
|
|
.\"It is only necessary to explicitly configure one
|
|
|
|
.\".Nm
|
|
|
|
.\"device; data structures are dynamically allocated as disks are found
|
|
|
|
.\"on the
|
|
|
|
.\".Tn SCSI
|
|
|
|
.\"bus.
|
2001-05-23 02:59:38 +04:00
|
|
|
.Sh CONFIGURATION OPTIONS
|
|
|
|
The following
|
|
|
|
.Xr config 8
|
|
|
|
options may be applied to
|
|
|
|
.Tn SCSI
|
|
|
|
disks as well as to other disks.
|
|
|
|
.Pp
|
|
|
|
.Bl -tag -width SD_IO_TIMEOUT
|
|
|
|
.It Dv SDRETRIES
|
|
|
|
Set the number of retries that will be performed for operations it
|
|
|
|
makes sense to retry (e.g., normal reads and writes). The default
|
|
|
|
is four (4).
|
|
|
|
.It Dv SD_IO_TIMEOUT
|
|
|
|
Set amount of time, in milliseconds, a normal read or write is expected
|
|
|
|
to take. The defaults is sixty seconds (60000 milliseconds). This is used
|
|
|
|
to set watchdog timers in the
|
|
|
|
.Tn SCSI
|
|
|
|
HBA driver to catch commands that might have died on the device.
|
2001-06-26 04:14:32 +04:00
|
|
|
.El
|
1996-08-13 07:13:30 +04:00
|
|
|
.Sh IOCTLS
|
1998-04-30 12:50:03 +04:00
|
|
|
The following
|
1996-08-13 07:13:30 +04:00
|
|
|
.Xr ioctl 2
|
1998-04-30 12:50:03 +04:00
|
|
|
calls apply to
|
1996-08-13 07:13:30 +04:00
|
|
|
.Tn SCSI
|
1998-04-30 12:50:03 +04:00
|
|
|
disks as well as to other disks.
|
|
|
|
They are defined in the header file
|
1996-08-13 07:13:30 +04:00
|
|
|
.Aq Pa disklabel.h .
|
|
|
|
.Pp
|
|
|
|
.Bl -tag -width DIOCSDINFO
|
|
|
|
.\".It Dv DIOCSBAD
|
1998-04-30 12:50:03 +04:00
|
|
|
.\"Usually used to set up a bad-block mapping system on the disk.
|
1996-08-13 07:13:30 +04:00
|
|
|
.\".Tn SCSI
|
|
|
|
.\"drive incorporate their own bad-block mapping so this command is not
|
|
|
|
.\"implemented.
|
|
|
|
.It Dv DIOCGDINFO
|
1998-04-30 12:50:03 +04:00
|
|
|
Read, from the kernel, the in-core copy of the disklabel for the drive.
|
|
|
|
This may be a fictitious disklabel if the drive has never
|
1996-08-13 07:13:30 +04:00
|
|
|
been initialized, in which case it will contain information read
|
|
|
|
from the
|
|
|
|
.Tn SCSI
|
|
|
|
inquiry commands.
|
|
|
|
.It Dv DIOCSDINFO
|
1998-04-30 12:50:03 +04:00
|
|
|
Give the driver a new disklabel to use.
|
|
|
|
The driver
|
1996-08-13 07:13:30 +04:00
|
|
|
.Em will not
|
|
|
|
write the new
|
|
|
|
disklabel to the disk.
|
1999-12-24 00:23:19 +03:00
|
|
|
.It Dv DIOCKLABEL
|
|
|
|
Keep or drop the in-core disklabel on the last close.
|
1996-08-13 07:13:30 +04:00
|
|
|
.It Dv DIOCWLABEL
|
|
|
|
Enable or disable the driver's software
|
|
|
|
write protect of the disklabel on the disk.
|
|
|
|
.It Dv DIOCWDINFO
|
1998-04-30 12:50:03 +04:00
|
|
|
Give the driver a new disklabel to use.
|
|
|
|
The driver
|
1996-08-13 07:13:30 +04:00
|
|
|
.Em will
|
|
|
|
write the new disklabel to the disk.
|
|
|
|
.It Dv DIOCLOCK
|
|
|
|
Lock the media cartridge into the device, or unlock a cartridge previously
|
1998-04-30 12:50:03 +04:00
|
|
|
locked.
|
|
|
|
Used to prevent user and software eject while the media is in use.
|
1996-08-13 07:13:30 +04:00
|
|
|
.It Dv DIOCEJECT
|
|
|
|
Eject the media cartridge from a removable device.
|
|
|
|
.El
|
|
|
|
.Pp
|
1998-04-30 12:50:03 +04:00
|
|
|
In addition, the
|
1996-08-13 07:13:30 +04:00
|
|
|
.Xr scsi 4
|
|
|
|
general
|
|
|
|
.Fn ioctl
|
1998-04-30 12:50:03 +04:00
|
|
|
commands may be used with the
|
1996-08-13 07:13:30 +04:00
|
|
|
.Nm
|
1998-04-30 12:50:03 +04:00
|
|
|
driver, but only against the
|
1996-08-13 07:13:30 +04:00
|
|
|
.Sq Li c
|
|
|
|
(whole disk) partition.
|
|
|
|
.Sh NOTES
|
1998-04-30 12:50:03 +04:00
|
|
|
If a removable device is attached to the
|
1996-08-13 07:13:30 +04:00
|
|
|
.Nm
|
|
|
|
driver, then the act of changing the media will invalidate the
|
1998-04-30 12:50:03 +04:00
|
|
|
disklabel and information held within the kernel.
|
|
|
|
To avoid corruption, all accesses to the device will be discarded
|
|
|
|
until there are no more open file descriptors referencing the
|
|
|
|
device.
|
|
|
|
During this period, all new open attempts will be rejected.
|
|
|
|
When no more open file descriptors reference the device, the first
|
|
|
|
next open will load a new set of parameters (including disklabel)
|
|
|
|
for the drive.
|
1996-08-13 07:13:30 +04:00
|
|
|
.Sh FILES
|
|
|
|
.Bl -tag -width /dev/rsdXXXXX -compact
|
|
|
|
.It Pa /dev/sd Ns Ar u Ns Ar p
|
|
|
|
block mode
|
|
|
|
.Tn SCSI
|
|
|
|
disk unit
|
|
|
|
.Ar u ,
|
|
|
|
partition
|
|
|
|
.Ar p
|
|
|
|
.It Pa /dev/rsd Ns Ar u Ns Ar p
|
|
|
|
raw mode
|
|
|
|
.Tn SCSI
|
|
|
|
disk unit
|
|
|
|
.Ar u ,
|
|
|
|
partition
|
|
|
|
.Ar p
|
|
|
|
.Sm off
|
|
|
|
.El
|
|
|
|
.Sh DIAGNOSTICS
|
|
|
|
None.
|
|
|
|
.Sh SEE ALSO
|
1998-06-10 15:15:20 +04:00
|
|
|
.Xr ioctl 2 ,
|
|
|
|
.Xr intro 4 ,
|
|
|
|
.Xr scsi 4 ,
|
1996-08-13 07:13:30 +04:00
|
|
|
.Xr wd 4 ,
|
|
|
|
.Xr disklabel 5 ,
|
|
|
|
.Xr disklabel 8 ,
|
|
|
|
.Xr fdisk 8
|
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
driver was originally written for
|
|
|
|
.Tn Mach
|
|
|
|
2.5, and was ported to
|
1998-02-06 08:54:12 +03:00
|
|
|
.Fx
|
1996-08-13 07:13:30 +04:00
|
|
|
by Julian Elischer.
|
|
|
|
It was later ported to
|
1998-02-06 08:54:12 +03:00
|
|
|
.Nx .
|