xref: /freebsd/share/man/man4/da.4 (revision bcd92649c9952c9c9e8845dbd34276a60dd16664)
1.\" Copyright (c) 1996
2.\"	Julian Elischer <julian@freebsd.org>.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\"
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.Dd January 18, 1996
27.Dt SD 4
28.Os FreeBSD
29.Sh NAME
30.Nm sd
31.Nd SCSI disk driver
32.Sh SYNOPSIS
33.Cd disk sd
34.Cd disk sd1 at scbus0 target 4 lun 0
35.Sh DESCRIPTION
36The
37.Nm sd
38driver provides support for a
39.Tn SCSI
40disk. It allows the disk
41to be divided up into a set of pseudo devices called
42.Em partitions .
43In general the interfaces are similar to those described by
44.Xr wd 4 .
45.Pp
46Where the
47.Xr wd 4
48device has a fairly low level interface to the system,
49.Tn SCSI
50devices have a much higher level interface and talk to the system via
51a
52.Tn SCSI
53host adapter
54(e.g.,
55.Xr ahc 4 ) .
56A
57.Tn SCSI
58adapter must also be separately configured into the system
59before a
60.Tn SCSI
61disk can be configured.
62.Pp
63When the
64.Tn SCSI
65adapter is probed during boot, the
66.Tn SCSI
67bus is scanned for devices. Any devices found which answer as
68.Sq Em Direct
69type devices will be attached to the
70.Nm
71driver.
72In
73.Tn FreeBSD
74releases prior to 2.1, the first found was attached as
75.Li sd0 ,
76the second
77.Li sd1 ,
78and so on.
79Beginning in
80.Fx 2.1
81it became possible to lock down the assignment of
82devices on the
83.Tn SCSI
84bus to particular units of the
85.Nm
86device; refer to
87.Xr scsi 4
88for details on kernel configuration.
89.Sh PARTITIONING
90The
91.Nm
92driver allows the disk to have two levels of partitioning.
93One layer, called the
94.Dq slice layer ,
95is used to separate the
96.Tn FreeBSD
97areas of the disk from areas used by other operating systems.
98The second layer is the native
99.Bx 4.4
100partitioning scheme,
101.Xr disklabel 5 ,
102which is used to subdivide the
103.Tn FreeBSD
104slices into areas for individual filesystems and swap spaces.
105For more information, see
106.Xr fdisk 8
107and
108.Xr disklabel 8 ,
109respectively.)
110.Pp
111If an uninitialized disk is opened, the slice table will be
112initialized with a fictitious
113.Tn FreeBSD
114slice spanning the entire disk.  Similarly, if an uninitialized
115(or
116.No non- Ns Tn FreeBSD )
117slice is opened, its disklabel will be initialized with parameters returned
118by the drive and a single
119.Sq Li c
120partition encompassing the entire slice.
121.Sh KERNEL CONFIGURATION
122It is only necessary to explicitly configure one
123.Nm
124device; data structures are dynamically allocated as disks are found
125on the
126.Tn SCSI
127bus.
128.Sh IOCTLS
129The following
130.Xr ioctl 2
131calls apply to
132.Tn SCSI
133disks as well as to other disks.  They are defined in the header file
134.Aq Pa disklabel.h .
135.Pp
136.Bl -tag -width DIOCSDINFO
137.It Dv DIOCSBAD
138Usually used to set up a bad-block mapping system on the disk.
139.Tn SCSI
140drive incorporate their own bad-block mapping so this command is not
141implemented.
142.It Dv DIOCGDINFO
143Read, from the kernel, the in-core copy of the disklabel for the
144drive. This may be a fictitious disklabel if the drive has never
145been initialized, in which case it will contain information read
146from the
147.Tn SCSI
148inquiry commands.
149.It Dv DIOCSDINFO
150Give the driver a new disklabel to use. The driver
151.Em will not
152write the new
153disklabel to the disk.
154.It Dv DIOCWLABEL
155Enable or disable the driver's software
156write protect of the disklabel on the disk.
157.It Dv DIOCWDINFO
158Give the driver a new disklabel to use. The driver
159.Em will
160write the new disklabel to the disk.
161.El
162.Pp
163In addition, the
164.Xr scsi 4
165general
166.Fn ioctl
167commands may be used with the
168.Nm
169driver, but only against the
170.Sq Li c
171(whole disk) partition.
172.Sh NOTES
173If a removable device is attached to the
174.Nm
175driver, then the act of changing the media will invalidate the
176disklabel and information held within the kernel.  To avoid
177corruption, all accesses to the device will be discarded until there
178are no more open file descriptors referencing the device.  During this
179period, all new open attempts will be rejected.  When no more open
180file descriptors reference the device, the first next open will load a
181new set of parameters (including disklabel) for the drive.
182.Sh FILES
183.Bl -tag -width /dev/rsdXXXXX -compact
184.It Pa /dev/rsd Ns Ar u
185raw mode
186.Tn SCSI
187disk unit
188.Ar u ,
189accessed as an unpartitioned device
190.Sm off
191.It Pa /dev/sd Ar u Pa s Ar n
192.Sm on
193block mode
194.Tn SCSI
195disk unit
196.Ar u ,
197slice
198.Ar n ,
199accessed as an unpartitioned device
200.Sm off
201.It Pa /dev/rsd Ar u Pa s Ar n
202.Sm on
203raw mode
204.Tn SCSI
205disk unit
206.Ar u ,
207slice
208.ar n ,
209accessed as an unpartitioned device
210.It Pa /dev/sd Ns Ar u Ns Ar p
211block mode
212.Tn SCSI
213disk unit
214.Ar u ,
215first
216.Tn FreeBSD
217slice, partition
218.Ar p
219.It Pa /dev/rsd Ns Ar u Ns Ar p
220raw mode
221.Tn SCSI
222disk unit
223.Ar u ,
224first
225.Tn FreeBSD
226slice, partition
227.Ar p
228.Sm off
229.It Xo
230.Pa /dev/sd
231.Ar u
232.Pa s
233.Ar n
234.Ar p
235.Xc
236.Sm on
237block mode
238.Tn SCSI
239disk unit
240.Ar u ,
241.No Ar n Ns th
242slice, partition
243.Ar p
244.Sm off
245.It Xo
246.Pa /dev/rsd
247.Ar u
248.Pa s
249.Ar n
250.Ar p
251.Xc
252raw mode
253.Tn SCSI
254disk unit
255.Ar u ,
256.No Ar n Ns th
257slice, partition
258.Ar p
259.El
260.Sh DIAGNOSTICS
261None.
262.Sh SEE ALSO
263.Xr disklabel 8 ,
264.Xr fdisk 8 ,
265.Xr wd 4 ,
266.Xr disklabel 5
267.Sh HISTORY
268The
269.Nm
270driver was originally written for
271.Tn Mach
2722.5, and was ported to
273.Tn FreeBSD
274by Julian Elischer.  Support for slices was written by Bruce Evans.
275