OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man4 / sd.4
1 .\" sd.4
2 .\" Copyright 1992 Rickard E. Faith (faith@cs.unc.edu)
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
26 .TH SD 4 2012-05-03 "Linux" "Linux Programmer's Manual"
27 .SH NAME
28 sd \- driver for SCSI disk drives
29 .SH SYNOPSIS
30 .nf
31 .BR "#include <linux/hdreg.h>        " "/* for HDIO_GETGEO */"
32 .BR "#include <linux/fs.h>           " "/* for BLKGETSIZE and BLKRRPART */"
33 .fi
34 .SH CONFIGURATION
35 The block device name has the following form:
36 .BI sd lp,
37 where
38 .I l
39 is a letter denoting the physical drive, and
40 .I p
41 is a number denoting the partition on that physical drive.
42 Often, the partition number,
43 .IR p ,
44 will be left off when the device corresponds to the whole drive.
45
46 SCSI disks have a major device number of 8, and a minor device number of
47 the form (16 *
48 .IR drive_number ") + " partition_number ,
49 where
50 .I drive_number
51 is the number of the physical drive in order of detection, and
52 .I partition_number
53 is as follows:
54 .sp
55 partition 0 is the whole drive
56 .br
57 partitions 1-4 are the DOS "primary" partitions
58 .br
59 partitions 5-8 are the DOS "extended" (or "logical") partitions
60
61 For example,
62 .I /dev/sda
63 will have major 8, minor 0, and will refer to all of the first SCSI drive
64 in the system; and
65 .I /dev/sdb3
66 will have major 8, minor 19, and will refer to the third DOS "primary"
67 partition on the second SCSI drive in the system.
68
69 At this time, only block devices are provided.
70 Raw devices have not yet been implemented.
71 .SH DESCRIPTION
72 The following
73 .IR ioctl s
74 are provided:
75 .TP
76 .B HDIO_GETGEO
77 .RS
78 Returns the BIOS disk parameters in the following structure:
79 .in +4n
80 .nf
81
82 struct hd_geometry {
83     unsigned char  heads;
84     unsigned char  sectors;
85     unsigned short cylinders;
86     unsigned long  start;
87 };
88 .fi
89 .in
90
91 A pointer to this structure is passed as the
92 .BR ioctl (2)
93 parameter.
94
95 The information returned in the parameter is the disk geometry of the drive
96 .I "as understood by DOS!"
97 This geometry is
98 .I not
99 the physical geometry of the drive.
100 It is used when constructing the
101 drive's partition table, however, and is needed for convenient operation
102 of
103 .BR fdisk (1),
104 .BR efdisk (1),
105 and
106 .BR lilo (1).
107 If the geometry information is not available, zero will be returned for all
108 of the parameters.
109 .RE
110 .TP
111 .B BLKGETSIZE
112 Returns the device size in sectors.
113 The
114 .BR ioctl (2)
115 parameter should be a pointer to a
116 .IR long .
117 .TP
118 .B BLKRRPART
119 Forces a reread of the SCSI disk partition tables.
120 No parameter is needed.
121
122 The SCSI
123 .BR ioctl (2)
124 operations are also supported.
125 If the
126 .BR ioctl (2)
127 parameter is required, and it is NULL, then
128 .BR ioctl (2)
129 will fail with the error
130 .BR EINVAL .
131 .SH FILES
132 /dev/sd[a\-h]: the whole device
133 .br
134 /dev/sd[a\-h][0\-8]: individual block partitions
135 .\".SH "SEE ALSO"
136 .\".BR scsi (4)
137 .SH COLOPHON
138 This page is part of release 3.79 of the Linux
139 .I man-pages
140 project.
141 A description of the project,
142 information about reporting bugs,
143 and the latest version of this page,
144 can be found at
145 \%http://www.kernel.org/doc/man\-pages/.