3 controller, disk, tape, at, bios, esdi, aha1540, ncr810, dosfile, fatfile \- controllers, disks and tapes
11 family of devices refer to drivers that control disks, disk like devices,
12 and tapes. MINIX 3 contains a number of drivers for several different
13 controllers. These controllers can have disks, cdroms and tapes attached to
14 them. Boot Monitor variables specify which drivers are activated using
18 etc. The names of the devices in
20 that correspond with the driver for controller 0 are all named beginning
24 For each controller, the minor device numbers are organized as follows:
28 .ta +\w'122-127nnmm'u +\w'd0p0s0nnmm'u +\w'disk 0, part 0, subpart 0nnmm'u
30 minor device what? obsolete
33 1 d0p0 disk 0, partition 0 hd1
34 2 d0p1 disk 0, partition 1 hd2
35 3 d0p2 disk 0, partition 2 hd3
36 4 d0p3 disk 0, partition 3 hd4
38 6 d1p0 disk 1, partition 0 hd6
39 7 d1p1 disk 1, partition 1 hd7
40 8 d1p2 disk 1, partition 2 hd8
41 9 d1p3 disk 1, partition 3 hd9
43 39 d7p3 disk 7, partition 3 hd39
45 64 t0n tape 0, non-rewinding
46 65 t0 tape 0, rewind on close
47 66 t1n tape 1, non-rewinding
48 67 t1 tape 1, rewind on close
50 78 t7n tape 7, non-rewinding
51 79 t7 tape 7, rewind on close
53 120 r0 raw access device 0
54 121 r1 raw access device 1
56 127 r7 raw access device 7
58 128 d0p0s0 disk 0, part 0, subpart 0 hd1a
59 129 d0p0s1 disk 0, part 0, subpart 1 hd1b
60 130 d0p0s2 disk 0, part 0, subpart 2 hd1c
61 131 d0p0s3 disk 0, part 0, subpart 3 hd1d
62 132 d0p1s0 disk 0, part 1, subpart 0 hd2a
64 144 d1p0s0 disk 1, part 0, subpart 0 hd6a
66 255 d7p3s3 disk 7, part 3, subpart 3 hd39d
72 also name the controller, of course, so the usual place for the MINIX 3
73 root device, the first subpartition of the second partition of disk 0 on
76 Note that everything is numbered from 0! The first controller is controller
77 0, the first disk is disk 0, etc. So the second partition is
80 The fourth column in the table above shows the disk devices names that were
81 used by previous versions of MINIX 3 for what is now controller 0. These
82 devices are no longer present in
85 Most disks are arrays of 512 byte sectors. The disk devices are normally
86 block devices, which means they are block buffered by the MINIX 3 file system
87 cache using 1024 byte blocks. The FS cache allows I/O at any byte offset,
88 and takes care of cutting and pasting incomplete blocks together. If one
89 creates a character device for a disk device, then I/O must be in multiples
90 of the disk block size.
92 For each disk there is a device that covers the entire disk, these are named
97 for controller 0. If a partition table is placed in the first sector of the
98 disk, then the disk is subdivided into regions named partitions. Up to four
99 partitions may be defined, named
103 for disk 0 on controller 0. To make things interesting you can also place a
104 partition table in the first sector of a MINIX 3 partition, which divides the
105 partition into up to four subpartitions. Normally MINIX 3 is installed into a
106 single partition, with the root, /home, and /usr file systems in subpartitions.
108 If a partition is an extended partition then it contains a linked list of
109 partition tables each of which may specify a logical partition. Up to four
110 of these logical partitions are presented by the driver as subpartitions of
111 the extended partition.
113 A sector containing a partition table starts with 446 bytes of boot code,
114 followed by four partition table entries of 16 bytes each, and ends with
115 the magic number 0xAA55 (little endian, so first 0x55 then 0xAA.) Partition
116 table information is defined in <ibm/partition.h>:
120 /* Description of entry in the partition table. */
123 unsigned char bootind; /* boot indicator 0/ACTIVE_FLAG */
124 unsigned char start_head; /* head value for first sector */
125 unsigned char start_sec; /* sector value + high 2 cyl bits */
126 unsigned char start_cyl; /* low 8 cylinder bits */
127 unsigned char sysind; /* system indicator */
128 unsigned char last_head; /* h/s/c for the last sector */
129 unsigned char last_sec;
130 unsigned char last_cyl;
131 unsigned long lowsec; /* logical first sector */
132 unsigned long size; /* size of partition in sectors */
136 #define ACTIVE_FLAG 0x80 /* value for active in bootind field */
137 #define NR_PARTITIONS 4 /* number of entries in table */
138 #define PART_TABLE_OFF 0x1BE /* offset of table in boot sector */
140 /* Partition types (sysind). */
141 #define NO_PART 0x00 /* unused entry */
142 #define MINIX_PART 0x81 /* MINIX 3 partition type */
145 The cylinder numbers are encoded in a very strange way, bits 8 and 9 are
146 in the high two bits of the sector number. The sector numbers count from 1,
147 not 0! More useful are the lowsec and size fields however, they simply give
148 the location of the partition as an absolute sector offset and length within
151 The partition table entry defined above is specific to IBM type disks. The
152 device drivers use another partition entry structure to pass information on
153 a partition. This is what <minix/partition.h> looks like:
158 u64_t base; /* byte offset to the partition start */
159 u64_t size; /* number of bytes in the partition */
160 unsigned cylinders; /* disk geometry for partitioning */
166 The base and size fields are the byte offset and length of a partition.
167 The geometry of the disk is also given for the benefit of
168 partition table editors. This information can be obtained from an open disk
169 device with the call:
173 ioctl(\fIfd\fP, DIOCGETP, &\fIentry\fP);
177 One can change the placement of the device to the lowsec and size fields of
181 call instead. Only the base and size fields are used for
184 The partition tables when read from disk by the driver are checked and
185 truncated to fit within the primary partition or drive. The first sector
186 is normally left free for the partition table.
188 The partition tables are read when the in-use count (opens and mounts)
189 changes from 0 to 1. So an idle disk is automatically repartitioned on the
190 next access. This means that DIOCSETP only has effect if the disk is in
192 .SS "Disk-like devices"
193 Devices like a CD-ROM are treated as read-only disks, and can be accessed
194 using disk devices. A CD-ROM usually has a block size of 2048 bytes, but
195 the driver knows this, and allows one to read at any byte offset by reading
196 what isn't needed into a scratch buffer.
198 There are two kinds of tape devices: Non-rewinding, and rewind-on-close.
199 The non-rewinding devices treat the tape as a series of files. The
200 rewind-on-close devices look at the tape as a single file, and when you close
201 such a device the tape is told to rewind.
206 for a description of the commands that may be sent to the tape, either from
207 the command prompt or from a program.
209 There are two kinds of tape drives: Fixed and variable block size tape
210 drives. Examples of the first kind are cartridge
211 tapes, with a fixed 512 bytes block size. An Exabyte tape drive has a
212 variable block size, with a minimum of 1 byte and a maximum of 245760 bytes
213 (see the documentation of such devices.)
214 The maximum is truncated to 32767 bytes for Minix-86 and 61440 bytes for
215 Minix-vmd, because the driver can't move more bytes in a single request.
217 A read or write to a fixed block size tape must be a precise multiple of the
218 block size, any other count gives results in an I/O error. A read from a
219 variable block sized tape must be large enough to accept the block that is
220 read, otherwise an I/O error will be returned. A write can be any size
221 above the minimum, creating a block of that size. If the write count is
222 larger than the maximum block size then more blocks are written until the
223 count becomes zero. The last block must be larger than the minimum of
224 course. (This minimum is often as small as 1 byte, as for the Exabyte.)
228 command may be used to select a fixed block size for a variable block sized
229 tape. This will speed up I/O considerably for small block sizes. (Some
230 systems can only use fixed mode and will write an Exabyte tape with 1024
231 byte blocks, which read very slow in variable mode.)
233 A tape is a sequence of blocks and filemarks. A tape may be opened and
234 blocks may be read from it upto a filemark, after that all further reads
235 return 0. After the tape is closed and reopened one can read the blocks
236 following the filemark if using a non-rewinding device. This makes the tape
237 look like a sequence of files.
239 If a tape has been written to or opened in write-only mode, then a filemark
240 is written if the tape is closed or if a space command is issued. No extra
241 filemark is written if the drive is instructed to write filemarks.
243 By setting the Boot variables
251 under Minix-vmd one attaches a set of disk and tape devices to a driver.
254 for a list of boot variables that configure each of these drivers.
255 The following drivers are available:
257 The standard IBM/AT disk driver that also supports IDE disks. This is the
258 default driver for controller 0 on AT class machines. (Most PCs are in that
261 A disk driver that uses BIOS calls to do disk I/O. This is the default
262 driver on anything but an AT. (Old XTs and PS/2s.) On an XT this is the
263 best driver you can use, but on any other machine this driver may be
264 somewhat slow, because the system has to switch out of protected mode to
265 make a BIOS call. On a fast enough machine with a high enough setting of
268 it works well enough.
270 A hard disk driver for use on some PS/2 models.
271 .SS "xt \fR(MINIX 3 only)"
272 A hard disk driver for IBM/XT type hard disks. Useful for old 286 based
273 machines that have such a disk. On XTs you are better off with the
277 A SCSI driver for the Adaptec 1540 host adapter family, which includes the
278 1540, 1540A, 1540B, 1540C, 1540CF, 1640, and 1740. Also supported is the
279 compatible BusLogic 545.
281 This will eventually become a Symbios 810 SCSI driver. (Formerly owned by
282 NCR.) KJB has read the docs on this card three times, but has still done
283 nothing, the lazy bum.
285 The "DOS file as disk" driver that is used when MINIX 3 is running
286 under DOS. It treats a large DOS file as a MINIX 3 disk. Only primary
287 partitions are supported, there are no subpartitions. This is the default
288 driver when MINIX 3 is started under DOS.
290 Uses a large file on a FAT file system as a disk. It needs one of the other
291 disk drivers to do the actual I/O. This driver only knows how to interpret
292 a FAT file system to find the file to use. With a fast native disk driver
293 this driver is much faster than the
307 /dev/c*t*n, /dev/c*t*
325 The subpartitioning is incompatible with the MS-DOS method of extended
326 partitions. The latter does not map well to the sparse minor device number
329 The primary partition table is sorted by lowsec like MS-DOS does, subpartition
330 tables are not. Just think about what happens when you delete a partition in
333 Don't move a partition that is mounted or kept open by some process. The
334 file system may write cached blocks to the new location.
336 The BIOS driver is not slow at all on a buffered disk.
338 Some IDE disks send an interrupt when they spin down under hardware power
339 management. The driver acknowledges the interrupt as it is supposed to do by
340 reading the status register. The disk then spins up again... You have to
341 disable the spin down in the computer setup to fix the problem.
343 Kees J. Bot (kjb@cs.vu.nl)