| 1 |
.\" Copyright 1992, Rickard E. Faith <[email protected]> |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 5 |
.\" |
| 6 |
.TH sd 4 2026-02-08 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
sd \- driver for SCSI disk drives |
| 9 |
.SH SYNOPSIS |
| 10 |
.nf |
| 11 |
.BR "#include <linux/hdreg.h> " "/* for HDIO_GETGEO */" |
| 12 |
.BR "#include <linux/fs.h> " "/* for BLKGETSIZE and BLKRRPART */" |
| 13 |
.fi |
| 14 |
.SH CONFIGURATION |
| 15 |
The block device name has the following form: |
| 16 |
.BI sd lp, |
| 17 |
where |
| 18 |
.I l |
| 19 |
is a letter denoting the physical drive, and |
| 20 |
.I p |
| 21 |
is a number denoting the partition on that physical drive. |
| 22 |
Often, the partition number, |
| 23 |
.IR p , |
| 24 |
will be left off when the device corresponds to the whole drive. |
| 25 |
.P |
| 26 |
SCSI disks have a major device number of 8, and a minor device number of |
| 27 |
the form (16 * |
| 28 |
.IR drive_number ") + " partition_number , |
| 29 |
where |
| 30 |
.I drive_number |
| 31 |
is the number of the physical drive in order of detection, and |
| 32 |
.I partition_number |
| 33 |
is as follows: |
| 34 |
.IP \[bu] 3 |
| 35 |
partition 0 is the whole drive |
| 36 |
.IP \[bu] |
| 37 |
partitions 1\[en]4 are the DOS "primary" partitions |
| 38 |
.IP \[bu] |
| 39 |
partitions 5\[en]8 are the DOS "extended" (or "logical") partitions |
| 40 |
.P |
| 41 |
For example, |
| 42 |
.I /dev/sda |
| 43 |
will have major 8, minor 0, |
| 44 |
and will refer to all of the first SCSI drive in the system; |
| 45 |
and |
| 46 |
.I /dev/sdb3 |
| 47 |
will have major 8, minor 19, |
| 48 |
and will refer to the third DOS "primary" partition |
| 49 |
on the second SCSI drive in the system. |
| 50 |
.P |
| 51 |
At this time, |
| 52 |
only block devices are provided. |
| 53 |
Raw devices have not yet been implemented. |
| 54 |
.SH DESCRIPTION |
| 55 |
The following |
| 56 |
.IR ioctl s |
| 57 |
are provided: |
| 58 |
.TP |
| 59 |
.B HDIO_GETGEO |
| 60 |
Returns the BIOS disk parameters in the following structure: |
| 61 |
.P |
| 62 |
.in +4n |
| 63 |
.EX |
| 64 |
struct hd_geometry { |
| 65 |
unsigned char heads; |
| 66 |
unsigned char sectors; |
| 67 |
unsigned short cylinders; |
| 68 |
unsigned long start; |
| 69 |
}; |
| 70 |
.EE |
| 71 |
.in |
| 72 |
.IP |
| 73 |
A pointer to this structure is passed as the |
| 74 |
.BR ioctl (2) |
| 75 |
parameter. |
| 76 |
.IP |
| 77 |
The information returned in the parameter is the disk geometry of the drive |
| 78 |
.I "as understood by DOS!" |
| 79 |
This geometry is |
| 80 |
.I not |
| 81 |
the physical geometry of the drive. |
| 82 |
It is used when constructing the |
| 83 |
drive's partition table, however, and is needed for convenient operation |
| 84 |
of |
| 85 |
.BR fdisk (1), |
| 86 |
.BR efdisk (1), |
| 87 |
and |
| 88 |
.BR lilo (1). |
| 89 |
If the geometry information is not available, zero will be returned for all |
| 90 |
of the parameters. |
| 91 |
.TP |
| 92 |
.B BLKGETSIZE |
| 93 |
Returns the device size in sectors. |
| 94 |
The |
| 95 |
.BR ioctl (2) |
| 96 |
parameter should be a pointer to a |
| 97 |
.IR long . |
| 98 |
.TP |
| 99 |
.B BLKRRPART |
| 100 |
Forces a reread of the SCSI disk partition tables. |
| 101 |
No parameter is needed. |
| 102 |
.IP |
| 103 |
The SCSI |
| 104 |
.BR ioctl (2) |
| 105 |
operations are also supported. |
| 106 |
If the |
| 107 |
.BR ioctl (2) |
| 108 |
parameter is required, and it is NULL, then |
| 109 |
.BR ioctl (2) |
| 110 |
fails with the error |
| 111 |
.BR EINVAL . |
| 112 |
.SH FILES |
| 113 |
.TP |
| 114 |
.I /dev/sd[a\-h] |
| 115 |
the whole device |
| 116 |
.TP |
| 117 |
.I /dev/sd[a\-h][0\-8] |
| 118 |
individual block partitions |
| 119 |
.\".SH SEE ALSO |
| 120 |
.\".BR scsi (4) |