1SD(4) Linux Programmer's Manual SD(4)
2
3
4
6 sd - driver for SCSI disk drives
7
9 #include <linux/hdreg.h> /* for HDIO_GETGEO */
10 #include <linux/fs.h> /* for BLKGETSIZE and BLKRRPART */
11
13 The block device name has the following form: sdlp, where l is a letter
14 denoting the physical drive, and p is a number denoting the partition
15 on that physical drive. Often, the partition number, p, will be left
16 off when the device corresponds to the whole drive.
17
18 SCSI disks have a major device number of 8, and a minor device number
19 of the form (16 * drive_number) + partition_number, where drive_number
20 is the number of the physical drive in order of detection, and parti‐
21 tion_number is as follows:
22
23 +3 partition 0 is the whole drive
24
25 partitions 1–4 are the DOS "primary" partitions
26
27 partitions 5–8 are the DOS "extended" (or "logical") partitions
28
29 For example, /dev/sda will have major 8, minor 0, and will refer to all
30 of the first SCSI drive in the system; and /dev/sdb3 will have major 8,
31 minor 19, and will refer to the third DOS "primary" partition on the
32 second SCSI drive in the system.
33
34 At this time, only block devices are provided. Raw devices have not
35 yet been implemented.
36
38 The following ioctls are provided:
39
40 HDIO_GETGEO
41 Returns the BIOS disk parameters in the following structure:
42
43 struct hd_geometry {
44 unsigned char heads;
45 unsigned char sectors;
46 unsigned short cylinders;
47 unsigned long start;
48 };
49
50 A pointer to this structure is passed as the ioctl(2) parameter.
51
52 The information returned in the parameter is the disk geometry
53 of the drive as understood by DOS! This geometry is not the
54 physical geometry of the drive. It is used when constructing
55 the drive's partition table, however, and is needed for conve‐
56 nient operation of fdisk(1), efdisk(1), and lilo(1). If the ge‐
57 ometry information is not available, zero will be returned for
58 all of the parameters.
59
60 BLKGETSIZE
61 Returns the device size in sectors. The ioctl(2) parameter
62 should be a pointer to a long.
63
64 BLKRRPART
65 Forces a reread of the SCSI disk partition tables. No parameter
66 is needed.
67
68 The SCSI ioctl(2) operations are also supported. If the
69 ioctl(2) parameter is required, and it is NULL, then ioctl(2)
70 fails with the error EINVAL.
71
73 /dev/sd[a-h]
74 the whole device
75
76 /dev/sd[a-h][0-8]
77 individual block partitions
78
80 This page is part of release 5.10 of the Linux man-pages project. A
81 description of the project, information about reporting bugs, and the
82 latest version of this page, can be found at
83 https://www.kernel.org/doc/man-pages/.
84
85
86
87Linux 2017-09-15 SD(4)