man-pages/man4/sd.4.html
2021-03-31 01:06:50 +01:00

201 lines
4.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of SD</TITLE>
</HEAD><BODY>
<H1>SD</H1>
Section: Linux Programmer's Manual (4)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
sd - driver for SCSI disk drives
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
<B>#include &lt;<A HREF="file:///usr/include/linux/hdreg.h">linux/hdreg.h</A>&gt; </B>/* for HDIO_GETGEO */
<B>#include &lt;<A HREF="file:///usr/include/linux/fs.h">linux/fs.h</A>&gt; </B>/* for BLKGETSIZE and BLKRRPART */
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>CONFIGURATION</H2>
The block device name has the following form:
<B>sd</B><I>lp,</I>
where
<I>l</I>
is a letter denoting the physical drive, and
<I>p</I>
is a number denoting the partition on that physical drive.
Often, the partition number,
<I>p</I>,
will be left off when the device corresponds to the whole drive.
<P>
SCSI disks have a major device number of 8, and a minor device number of
the form (16 *
<I>drive_number</I>) + <I>partition_number</I>,
where
<I>drive_number</I>
is the number of the physical drive in order of detection, and
<I>partition_number</I>
is as follows:
<DL COMPACT>
<DT id="1">+3<DD>
partition 0 is the whole drive
<DT id="2"><DD>
partitions 1-4 are the DOS &quot;primary&quot; partitions
<DT id="3"><DD>
partitions 5-8 are the DOS &quot;extended&quot; (or &quot;logical&quot;) partitions
</DL>
<P>
For example,
<I>/dev/sda</I>
will have major 8, minor 0, and will refer to all of the first SCSI drive
in the system; and
<I>/dev/sdb3</I>
will have major 8, minor 19, and will refer to the third DOS &quot;primary&quot;
partition on the second SCSI drive in the system.
<P>
At this time, only block devices are provided.
Raw devices have not yet been implemented.
<A NAME="lbAE">&nbsp;</A>
<H2>DESCRIPTION</H2>
The following
<I>ioctl</I>s
are provided:
<DL COMPACT>
<DT id="4"><B>HDIO_GETGEO</B>
<DD>
Returns the BIOS disk parameters in the following structure:
</DL>
<P>
struct hd_geometry {
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;char&nbsp;&nbsp;heads;
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;char&nbsp;&nbsp;sectors;
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;short&nbsp;cylinders;
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;long&nbsp;&nbsp;start;
};
<DL COMPACT>
<DT id="5"><DD>
A pointer to this structure is passed as the
<B><A HREF="/cgi-bin/man/man2html?2+ioctl">ioctl</A></B>(2)
parameter.
<DT id="6"><DD>
The information returned in the parameter is the disk geometry of the drive
<I>as understood by DOS!</I>
This geometry is
<I>not</I>
the physical geometry of the drive.
It is used when constructing the
drive's partition table, however, and is needed for convenient operation
of
<B><A HREF="/cgi-bin/man/man2html?1+fdisk">fdisk</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?1+efdisk">efdisk</A></B>(1),
and
<B><A HREF="/cgi-bin/man/man2html?1+lilo">lilo</A></B>(1).
If the geometry information is not available, zero will be returned for all
of the parameters.
<DT id="7"><B>BLKGETSIZE</B>
<DD>
Returns the device size in sectors.
The
<B><A HREF="/cgi-bin/man/man2html?2+ioctl">ioctl</A></B>(2)
parameter should be a pointer to a
<I>long</I>.
<DT id="8"><B>BLKRRPART</B>
<DD>
Forces a reread of the SCSI disk partition tables.
No parameter is needed.
<DT id="9"><DD>
The SCSI
<B><A HREF="/cgi-bin/man/man2html?2+ioctl">ioctl</A></B>(2)
operations are also supported.
If the
<B><A HREF="/cgi-bin/man/man2html?2+ioctl">ioctl</A></B>(2)
parameter is required, and it is NULL, then
<B><A HREF="/cgi-bin/man/man2html?2+ioctl">ioctl</A></B>(2)
fails with the error
<B>EINVAL</B>.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>FILES</H2>
<DL COMPACT>
<DT id="10"><I>/dev/sd[a-h]</I>
<DD>
the whole device
<DT id="11"><I>/dev/sd[a-h][0-8]</I>
<DD>
individual block partitions
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>COLOPHON</H2>
This page is part of release 5.05 of the Linux
<I>man-pages</I>
project.
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="12"><A HREF="#lbAB">NAME</A><DD>
<DT id="13"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="14"><A HREF="#lbAD">CONFIGURATION</A><DD>
<DT id="15"><A HREF="#lbAE">DESCRIPTION</A><DD>
<DT id="16"><A HREF="#lbAF">FILES</A><DD>
<DT id="17"><A HREF="#lbAG">COLOPHON</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:02 GMT, March 31, 2021
</BODY>
</HTML>