Add partition specification files.
[pintos-anon] / specs / partitions / partition_types-2.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2 <HTML>
3 <HEAD>
4  <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
5  <TITLE> Partition types: Properties of partition tables.</TITLE>
6  <LINK HREF="partition_types-1.html" REL=previous>
7  <LINK HREF="partition_types.html#toc2" REL=contents>
8 </HEAD>
9 <BODY>
10 Next
11 <A HREF="partition_types-1.html">Previous</A>
12 <A HREF="partition_types.html#toc2">Contents</A>
13 <HR>
14 <H2><A NAME="s2">2. Properties of partition tables.</A></H2>
15
16 <P>
17 <H2><A NAME="ss2.1">2.1 Why partitions?</A>
18 </H2>
19
20 <P>
21 <P>The partition table of a disk cuts it into 'logical disks'.
22 There are several reasons for wanting to do this.
23 DOS does not support filesystems larger than 2 GB, so
24 partitioning is required to break this '2 GB barrier'.
25 Different partitions may carry different operating systems
26 or different filesystems (FAT, HPFS, NTFS, ext2, ...) to be used by one
27 operating system. Sometimes small partitions are used for special purposes
28 (OS/2 Boot Manager uses a small partition for itself, various laptops
29 have a 'hibernation' partition where the state of the system is stored
30 when it goes asleep). Some 'reliable' systems have backup partitions.
31 For backup purposes, say to tape, it is often convenient to have
32 partitions of a size such that the entire partition can be written
33 to a single tape.
34 <P>It is a good idea to keep your own things (say under /home)
35 and privately installed packages (say under /usr/local)
36 separate from the software installed from a distribution.
37 In case these are on a different partition, it is easier
38 to do a complete reinstall (or switch to a different distribution)
39 without losing your own stuff.
40 <P>For well-designed systems it is often possible to have all basic
41 system software on a read-only partition, thus diminishing the probability
42 of corruption and saving backup time.
43 There is also a security aspect; for example on a Unix system one
44 might mount all filesystems other than the root filesystem 'nosuid,nodev',
45 and have /tmp, /home, /var not on the root filesystem, to minimize the
46 possibility that some suid program is tricked into overwriting a
47 vital system file via a hard link to it.
48 <P>Finally there is the old BIOS problem that can make it impossible to boot
49 a system that lives past cylinder 1024. This may mean that one has to
50 have a partition that ends before the 1024 cylinder limit where the
51 stuff needed at boot time is stored.
52 <P>Some reasons why you want to avoid Disk Managers are given on
53 <A HREF="http://www.morgan-cybersys.com/lcd.html">The Invircible Anti-virus Manual, Appendix C</A>.
54 <P>
55 <H2><A NAME="ss2.2">2.2 What does a partition table look like?</A>
56 </H2>
57
58 <P>
59 <P>One may have an arbitrary number of partitions on a disk.
60 However, the Master Boot Record (MBR, sector 0 of the disk)
61 only holds descriptors for 4 partitions, called the <I>primary</I>
62 partitions. Usually the BIOS can boot only from a primary partition.
63 (Of course it can boot a boot loader that itself is able to access
64 nonprimary partitions or other disks.)
65 The descriptors for the remaining partitions, called <I>logical</I> partitions,
66 are scattered along the disk in a linked list of partition table sectors,
67 starting with the MBR.
68 <P>Each partition table sector contains 4 partition descriptors.
69 A partition descriptor may be of type <B>05</B> (DOS extended partition),
70 <B>0f</B> (W95 extended partition), <B>85</B> (Linux extended partition),
71 or <B>c5</B> (DRDOS/secured extended partition),
72 in which case it points to another partition table sector.
73 In this way, we obtain a quaternary tree of partitions.
74 Linux accepts <B>85</B> as a synonym for <B>05</B> - this is useful if one
75 wants to have extended partitions past the 1024 cylinder limit
76 (to prevent DOS fdisk from crashing or hanging).
77 Windows 95 uses <B>0f</B> for LBA mapped extended partitions.
78 Thus, an extended partition is not a partition containing data,
79 but is a box containing other partitions.
80 Nevertheless, the partition table sector that starts an extended partition
81 has enough room left to contain a boot loader like LILO, so that it is
82 possible to boot an extended partition.
83 <P>Most operating systems severely restrict the accepted trees.
84 Usually branching is not allowed, and one gets a linear chain of
85 partition table sectors.
86 Linux will accept several extended primary partitions.
87 <P>
88 <P>
89 <H2><A NAME="ss2.3">2.3 Partition descriptors</A>
90 </H2>
91
92 <P>
93 <P>A partition table entry is 16 bytes long and contains 6 items
94 (not listed in order).
95 1. A byte that is 0x80 or 0 denoting 'bootable' or not.
96 The standard DOS MBR will not boot a partition unless it is the unique
97 bootable primary partition. For nonprimary partitions this byte is
98 unused. 
99 2. A byte that gives the type.
100 3. A 4-byte starting sector number.
101 4. A 4-byte length (in sectors).
102 5. A 3-byte starting sector given in C/H/S (cylinder/head/sector) format.
103 6. A 3-byte final sector given in C/H/S format.
104 Linux only uses items 2-4, and hence is not interested in the 'geometry'
105 of the disk, and can use disks with up to 2^32 sectors (4 TB).
106 DOS uses 5-6 instead of 3-4, and this leads to the well-known problems
107 with geometry, with the 1024 cylinder limit, the 500 MB limit, the 8 GB
108 limit. For some details, see the
109 <A HREF="http://www.win.tue.nl/~aeb/linux/largedisk.html">large disk HOWTO</A>.
110 <P>For an extended partition, only the first sector is important -
111 it contains the descriptors for its logical partitions.
112 There are various conventions about how the descriptor of an
113 extended partition (different from the outer one) should look like.
114 There is the paradigm of 'nested boxes', where each extended partition
115 covers a disk area containing all the logical partitions inside.
116 There is also the paradigm of 'chained boxes', where each extended
117 partition (except possibly the outer one) just contains the next
118 logical partition.
119 I don't know which systems follow which paradigms.
120 (David A. Burton <CODE>&lt;dburton@burtonsys.com&gt;</CODE> reports
121 that System Commander uses the nested style.)
122 However, for the outer (primary) extended partition it is common
123 to contain all logical partitions inside (i.e., have a start and length
124 field that describes a piece of the disk that contains all logical
125 partitions).
126 Of course the 'chained boxes' paradigm is more flexible since it
127 allows logical partitions with a primary partition in between.
128 <P>
129 <P>
130 <H2><A NAME="ss2.4">2.4 Partition hiding</A>
131 </H2>
132
133 <P>
134 <P>The OS/2 Boot Manager does not want you to have more than one
135 primary DOS partition (MS-DOS itself does not mind), and will
136 change the type from <B>01</B>, <B>04</B>, <B>06</B>, <B>07</B>
137 to <B>11</B>, <B>14</B>, <B>16</B>, <B>17</B>.
138 <P>Also other programs or systems use this 'partition hiding'.
139 For example, 
140 <A HREF="http://www.v-com.com/syscomm.html">System Commander</A> will OR the type with 0x10,
141 changing the Linux <B>83</B> into the Amoeba <B>93</B>.
142 <P>
143 <H2><A NAME="ss2.5">2.5 CHS vs LBA</A>
144 </H2>
145
146 <P>Some partition IDs imply a particular method of disk access.
147 In particular, IDs <B>0c</B>, <B>0e</B>, <B>0f</B>
148 (the LBA versions of <B>0b</B>, <B>06</B>, <B>05</B>)
149 go with partition table entries that have C/H/S = 1023/255/63
150 and expect access via the extended INT-13 functions (AH=4x)
151 of the BIOS.
152 <P>
153 <H2><A NAME="logsectfat"></A> <A NAME="ss2.6">2.6 Logically sectored FAT</A>
154 </H2>
155
156 <P>Some systems use a filesystem that is fully compatible with
157 a standard FAT12 or FAT16 partition, except for using a
158 sector size larger than the usual 512 bytes, up to 8192 bytes.
159 This is what is meant by "logically sectored FAT" in the above.
160 <P>Logically sectored FATs have been a way to circumvent the dreaded 32 MB
161 partition size limit before the introduction of DOS 3.31. Since the
162 count of sectors was restricted to 16-bit on FAT16 (type 04h) the only
163 way to grow the partition above the 32 MB limit in a reasonably compatible
164 fashion was to increase the sector size instead. Physical sectors at
165 ROM BIOS INT 13h level are always 512 bytes in size, but other devices
166 may require support for other sector sizes in the operating system.
167 Hence, when DOS logs in drives during bootstrap it will record the
168 sector size values indicated in each partition it finds and if it
169 is larger than the previously recorded value, it will slide up the
170 maximum supported sector size to the found value. Very old DOS versions
171 seem to have started with an initial value of 128 (showing some
172 CP/M heritance here), but recent DOS versions use an initial value
173 of 512 bytes. Once DOS has logged in all drives (including those
174 not represented on INT 13h level, for example, SCSI disk, RAM disk
175 or such), it will set up its internal buffering logic to use the
176 maximum sector size found. This mechanism is present in all
177 DOS versions (although it was partially broken in DOS 5.0 - 6.22).
178 <P>(Matthias Paul)
179 <P>
180 <P>
181 <H2><A NAME="ss2.7">2.7 What does FDISK /MBR do?</A>
182 </H2>
183
184 <P>
185 <P>People often recommend the undocumented DOS command FDISK /MBR
186 to solve problems with the MBR.  This command however does not
187 rewrite the entire MBR - it just rewrites the boot code, the first
188 446 bytes of the MBR, but leaves the 64-byte partition information
189 alone.  Thus, it won't help when the partition table has problems.
190 Moreover, it can be dangerous to restore the boot code to its
191 original state:
192 if the cause of the problems was a boot sector virus, then
193 vital information may have been stored elsewhere by the virus,
194 and killing the virus may mean killing access to this information.
195 (For example, the stoned.empire.monkey virus encrypts the original
196 MBR to sector 0/0/3.)
197 However, people who want to uninstall LILO, and do not know that
198 LILO has a -u option, can use FDISK /MBR for this purpose.
199 <P>In a Linux environment, one can wipe all of the MBR with a command
200 like "dd if=/dev/zero of=/dev/hda count=1 bs=512".
201 If only the boot code must be removed, but not the partition table,
202 then "dd if=/dev/zero of=/dev/hda count=1 bs=446" will do.
203 Be very careful with such commands. Usually one regrets them later.
204 <P>
205 <H2><A NAME="ss2.8">2.8 Structure of the MBR - OS additions</A>
206 </H2>
207
208 <P>As we saw, the structure of the MBR (Master Boot Record, sector 0)
209 is as follows:
210 First 446 bytes boot loader code, then 64 bytes partition table
211 (starting at offset 0x1be = 446), finally 2 bytes signature 0xaa55.
212 <P>Just before the partition table some operating systems save some
213 interesting stuff. For example, DRDOS stores a password starting
214 at offset 0x1b6.
215 <P>Windows NT stores a 4-byte "disk signature" or "volume ID"
216 starting at offset 0x1b8. It is used to map drive letters to disks:
217 in the HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices registry item
218 the drive letter is coupled with this disk signature.
219 It is used as a disk label to map disk info to disks
220 in the HKEY_LOCAL_MACHINE\SYSTEM\DISK registry item.
221 This signature is generated by the Disk Administrator when it
222 initializes the disk, unless there already was a nonzero value there.
223 <P>Grub had a 4-byte stage2 start address at 0x1b8, and a 2-byte
224 version at 0x1bc, but recent versions preserve 0x1b8-0x1bd.
225 Also LILO v20 and later preserves this area.
226 <P>Some operating systems are reported to have 8 instead of 4
227 partition descriptors in the MBR. Cf. AST DOS under <B>14</B>
228 and NEC DOS under <B>24</B> above.
229 <P>
230 <H2><A NAME="ss2.9">2.9 The Advanced Active Partition of PTS</A>
231 </H2>
232
233 <P>As mentioned above, the DOS MBR boot code will boot the
234 (unique) primary partition that has been marked active.
235 Usually, in a multi-boot situation, the boot manager toggles
236 the active bit of the partition that is to be booted.
237 PTS chose a different solution.
238 <P>Matthias Paul writes:
239 "So far the only DOS being able to boot out of a logical drive
240 in an extended partition is PTS-DOS by use of so called
241 "Advanced Active Partition" entries in the MBR. In order to
242 remain as compatible as possible with existing DOS standards,
243 this works a little bit different and requires a special 5th
244 partition entry in front of the other four entries in the MBR
245 and corresponding AAP-aware MBR bootstrap code. If the MBR
246 contains a special AAP signature and this special entry exists
247 and is flagged bootable, the MBR will use this instead of one
248 of the other four entries. The entry may either point to the
249 bootsector of a logical drive or to a 512 bytes long file
250 (with system-attribute, so it won't be moved around during
251 disk defragmentation) somewhere inside the filesystem, which
252 makes up a boot sector (same "IBM" signature, same load address,
253 same register interface). In contrast to the usual MBR code,
254 this MBR code interprets the boot flag byte as physical drive
255 unit (80h..FEh), instead of using it only as a active flag
256 (80h or 00h in older DOS issues or bit 7 set or cleared in
257 newer DOS issues). This way, the AAP MBR could even load a
258 boot sector from other than the first harddisk."
259 <P>
260 <H2><A NAME="ss2.10">2.10 Naming</A>
261 </H2>
262
263 <P>
264 <P>DOS uses drive letters A: and B: for floppy disk drives, and
265 assigns drive letters C: ... Z: in the order: first all primary
266 DOS partitions on the first disk, then all primary DOS partitions
267 on the second disk, ..., then all logical DOS partitions on first
268 disk, etc. DOS will stop investigating logical partitions in a given
269 extended partition as soon as a non-DOS partition is encountered.
270 (DOS recognizes partition types 1, 4, 6 and 5 for extended.)
271 <P>Systems like Windows 95, Windows 98, Windows NT, Windows 2000 and OS/2
272 follow a similar convention, but recognize different partition types.
273 Thus, a drive can have a different drive letter for each of these
274 operating systems. For details, see the Microsoft KnowledgeBase, e.g.
275 <A HREF="http://support.microsoft.com/support/kb/articles/q93/3/73.ASP">Drive letters in Windows NT</A>,
276 <A HREF="http://support.microsoft.com/support/kb/articles/Q254/9/66.ASP">Drive letters in Windows 2000 for unsupported partition types</A>.
277 <P>
278 <H2><A NAME="ss2.11">2.11 Limits</A>
279 </H2>
280
281 <P>The partition table describes the location of partitions both
282 in 1-dimensional ('LBA') and in 3-dimensional (CHS) form.
283 The former is easy enough, but for the latter one needs to
284 know the disk geometry. Note that these days this geometry
285 is entirely fake, and different systems use different faked
286 geometries for the same disk, giving lots of problems.
287 (For example, a modern disk may have 2 or 4 heads, but will
288 probably report 15 or 16 heads to the BIOS, which in turn may
289 report 255 heads to DOS or Windows.)
290 <P>
291 <DL>
292 <P>
293 <DT><B>ATA Specification (for IDE disks) - the 137 GB limit</B><DD><P>At most 65536 cylinders (numbered 0-65535), 16 heads (numbered 0-15),
294 255 sectors/track (numbered 1-255), for a maximum total capacity of
295 267386880 sectors (of 512 bytes each), that is, 136902082560 bytes (137 GB).
296 <P>
297 <DT><B>BIOS Int 13 - the 8.4 GB limit</B><DD><P>At most 1024 cylinders (numbered 0-1023), 256 heads (numbered 0-255),
298 63 sectors/track (numbered 1-63) for a maximum total capacity of
299 8455716864 bytes (8.4 GB). This is a serious limitation today.
300 It means that DOS cannot use present day large disks.
301 <P>
302 <DT><B>The DOS 528 MB limit</B><DD><P>If the same values for c,h,s are used for the BIOS Int 13 call and
303 for the IDE disk I/O, then both limitations combine, and one can
304 use at most 1024 cylinders, 16 heads, 63 sectors/track, for a
305 maximum total capacity of 528482304 bytes (528MB), the infamous
306 504 MB limit (if one takes M=2^20).
307 This was already a problem many years ago, and all kinds of software,
308 firmware and hardware solutions were invented. On the software side,
309 there are Disk Managers, that circumvent the BIOS and go directly to
310 the hardware. On the firmware side there are translating BIOSes,
311 that use one geometry when talking to the disk, and another one
312 when talking to the user program. (At best, this again allows access
313 to 8.4 GB.) On the hardware side, there is LBA disk access,
314 that no longer uses (c,h,s).
315 <P>
316 <DT><B>The 2.1 GB limit</B><DD><P>Some older BIOSes only allocate 12 bits for the field in CMOS RAM that
317 gives the number of cylinders. Consequently, this number can be at most
318 4095, and only 4095*16*63*512=2113413120 bytes are accessible.
319 See 
320 <A HREF="http://www.firmware.com/support/bios/over2gb.htm">over2gb.htm</A>.
321 <P>
322 <DT><B>The 3.2 GB limit</B><DD><P>There was a bug in the Phoenix 4.03 and 4.04 BIOS firmware that would
323 cause the system to lock up in the CMOS setup for drives with a capacity
324 over 3277 MB. See 
325 <A HREF="http://www.firmware.com/support/bios/over3gb.htm">over3gb.htm</A>.
326 <P>
327 <DT><B>The 4.2 GB limit</B><DD><P>Simple BIOS translation (ECHS=Extended CHS, sometimes called 'Large 
328 disk support' or just 'Large')
329 works by repeatedly doubling the number of heads and halving the number
330 of cylinders shown to DOS, until the number of cylinders is at most 1024.
331 Now DOS and Windows 95 cannot handle 256 heads or more,
332 and in the common case that the disk reports 16 heads, this means that
333 this simple mechanism only works up to 8192*16*63*512=4227858432 bytes
334 (with a fake geometry with 1024 cylinders, 128 heads, 63 sectors/track).
335 Note that ECHS does not change the number of sectors per track, so if
336 that is not 63, the limit will be lower.
337 See 
338 <A HREF="http://www.firmware.com/support/bios/over2gb.htm">over4gb.htm</A>.
339 <P>
340 <DT><B>The 7.9 GB limit</B><DD><P>Slightly smarter BIOSes avoid the previous problem by first adjusting the
341 number of heads to 15 ('revised ECHS'), so that a fake geometry with
342 240 heads can be obtained, good for 1024*240*63*512=7927234560 bytes.
343 <P>
344 <DT><B>The 8.4 GB limit</B><DD><P>Finally, if the BIOS does all it can to make this translation a success,
345 and uses 255 heads and 63 sectors/track ('assisted LBA' or just 'LBA')
346 it may reach 1024*255*63*512=8422686720 bytes, slightly less than the
347 earlier 8.4 GB limit because the geometries with 256 heads must be avoided.
348 (This translation will use for the number of heads the first value H
349 in the sequence 16, 32, 64, 128, 255 for which the total disk capacity
350 fits in 1024*H*63*512, and then computes the number of cylinders C as
351 total capacity divided by (H*63*512).)
352 <P>
353 <DT><B>The 33.8 GB limit</B><DD><P>Large disks report 16 heads, 63 sectors/track and 16383 cylinders.
354 Many BIOSes compute an actual number of cylinders by dividing
355 the total capacity by 16*63. For disks larger than 33.8 GB this
356 leads to a number of cylinders larger than 65535. Now the BIOS
357 crashes or hangs. The solution is to upgrade the BIOS. If that is
358 impossible, it sometimes helps to take the disk out of the BIOS,
359 but that won't work if one has to boot from the disk, and may also
360 fail because the BIOS already hangs during initial probing.
361 Usually one can use a jumper to make the disk appear smaller.
362 Also many operating systems have problems - only the most recent
363 versions work with these disks.
364 <P>
365 <DT><B>The 137 GB limit</B><DD><P>As already noted, the old ATA specification does not allow access
366 to all of a disk that is larger than 137 GB. Indeed, it uses only
367 28 bits to specify a sector number. However, ATA-6 defines an extension
368 with 48-bit sector number. The first disks needing the extension were
369 Maxtor 160 GB disks, that came to market in Fall 2001.
370 </DL>
371 <P>For another discussion of this topic, see
372 <A HREF="http://www.maxtor.com/products/DiamondMax/techsupport/Q&amp;A/30004.html">Breaking the Barriers</A>, and, with more details,
373 <A HREF="http://www.maxtor.com/technology/whitepapers/63001.html">IDE Hard Drive Capacity Barriers</A>.
374 <P>Hard drives over 8.4 GB are supposed to report their geometry as 16383/16/63.
375 This in effect means that the 'geometry' is obsolete, and the total disk
376 size can no longer be computed from the geometry.
377 <P>
378 <H2><A NAME="ss2.12">2.12 Details for various operating systems</A>
379 </H2>
380
381 <P>
382 <P>Early MSDOS filled the partition table starting at the end.
383 In particular, in the case of only one partition, the descriptor
384 was stored in the fourth primary slot. These days DOS FDISK
385 starts at the beginning, but other systems, like Unixware, still
386 start at the end.
387 Also Iomega writes the single partition of a ZIP disk
388 in the last entry (so that it has to be mounted as /dev/sda4 or
389 /dev/hdc4 or so).
390 <P>MSDOS 6.22 FDISK creates the four entries in the partition table sector
391 that starts an extended partition as 1. a data partition (or empty),
392 2. the next extended partition, 3. and 4. empty.
393 (But old versions of MS-DOS start at the end, and first fill entry 4.)
394 If the first logical partition (that is not the last one) is removed,
395 only the link in position 2 remains.
396 An extended partition table sector can describe only a single
397 data partition (the first one encountered). When reading a table,
398 FDISK accepts the entries in any order and position, but it will
399 write the sector normalized as described.
400 <P>DRDOS on the other hand expects zero to four entries in an extended
401 partition table sector. Data partitions,
402 possibly followed by the link to the next extended partition.
403 Thus, this link is always the last significant entry, and will
404 be the first entry if there is no data partition (because
405 it has been deleted).
406 <P>Many systems are willing to accept more than two nonempty parts
407 in an extended partition, but will not create such themselves.
408 <P>It is rumoured that the outer extended partition should be the 4th
409 in the MBR, but I don't know any systems that have this restriction.
410 DRDOS FDISK always puts the extended partition in the fourth entry
411 no matter how many other entries you may have.
412 <P>MSDOS fdisk shows 4 primary partitions, and of the logical partitions
413 only those that have a DOS type (1, 4 or 6). It will list the type of
414 a logical partition as 'Unknown' if the partition is not formatted.
415 <P>It is rumoured that DRDOS ignores the high-order bit of the ID
416 (and that is the reason for the additional Linux IDs 41, 42, 43),
417 but I don't know whether that is true (and for which versions of DRDOS).
418 It is also rumoured that DRDOS will write 1 sector past the end
419 of a partition - I have never seen this either. Confirmation?
420 It is however true, that DRDOS fdisk only looks at the last 4 bits
421 when printing a type, so that types 11, 21, etc are printed as DOS 2.0,
422 but such types are not acceptable for DRDOS itself.
423 <P>The OS/2 Warp fdisk is very instable, and hangs or crashes with
424 general protection fault as soon as the partition table is somewhat
425 unusual, cf. 
426 <A HREF="http://www.teamos2.org/pharmacy/FDISKbug.html">Cannot set an installable partition with FDISK</A>.
427 <P>The Windows NT Disk Administrator will corrupt your disk
428 when it writes a signature on a disk with two or more
429 logical partitions. See
430 <A HREF="http://support.microsoft.com/support/kb/articles/Q135/3/08.asp">Disk Administrator Corrupts Partitions</A>.
431 <P>The use of Win95/Win98 FDISK in a mixed system is dangerous.
432 It will delete a non-FAT logical partition when you had actually
433 told it to delete a FAT partition somewhere farther down the chain
434 of logical partitions. See
435 <A HREF="http://support.microsoft.com/support/kb/articles/q179/1/44.asp">Cannot View NTFS Logical Drive After Using FDISK</A>.
436 <P>The system partition in Windows NT 4 must be contained in the first
437 7.8 GB of the disk (or less, in case the BIOS geometry does not have
438 255 heads and 63 sectors/track; the actual restriction is that all of it
439 must be accessible using BIOS Int 13).
440 It must not be larger than 4 GB because Windows NT 4 first installs
441 into a FAT16 partition and then converts it into NTFS during
442 the second phase of the installation.
443 It must start before the 4 GB mark (bug fixed in Service Pack 5).
444 See
445 <A HREF="http://support.microsoft.com/support/kb/articles/Q224/5/26.ASP">Windows NT 4.0 Supports Maximum of 7.8-GB System Partition</A>
446 and 
447 <A HREF="http://support.microsoft.com/support/kb/articles/Q138/3/64.asp">Windows NT Partitioning Rules During Setup</A>
448 and 
449 <A HREF="http://support.microsoft.com/support/kb/articles/Q119/4/97.ASP">Boot Partition Created During Setup Limited to 4 Gigabytes</A>
450 and 
451 <A HREF="http://support.microsoft.com/support/kb/articles/Q197/2/95.ASP">Windows NT Does Not Boot to a Partition That Starts More Than 4 GB into Disk</A>.
452 <P>Windows NT and Windows 2000 use for SCSI disks whatever the BIOS says
453 (usually C/H/S=C/255/63) for the boot drive, and C/64/32
454 for all other SCSI drives. See
455 <A HREF="http://support.microsoft.com/support/kb/articles/Q161/5/63.asp">How Windows NT Handles Drive Translation</A>.
456 <P>Windows 2000 seems to require that the partition order agrees
457 with the disk order.
458 <P>The OS/2 fdisk writes some strange length in the descriptor of the
459 last extended partition. This is probably a bug.
460 OS/2 fdisk fails to update the length of the (outer) extended partition
461 when a primary partition is created in the free space (space not used
462 by a logical partition) at the end of this extended partition.
463 This can lead to overlapping partitions.
464 <P>OS/2 FDISK does not know about type f, but accepts DOS Extended Partitions
465 extending beyond cylinder 1023. When some other partition handler,
466 like Partition Magic 4.0, changes the type of a large extended
467 partition from 05 to 0f, OS/2 loses access.
468 <P>OS/2 Boot Manager keeps a private copy of the partition table data.
469 This leads to problems when changing the partition table
470 with 3rd party tools.
471 <P>
472 <A NAME="w2kandos2bm"></A> 
473 Windows 2000 tries to destroy OS/2 Boot Manager. Upon boot it ignores
474 the 0a partition ID, and sees something resembling a FAT boot sector
475 describing 2 FAT copies. When FASTFAT.SYS marks this partition as clean
476 in the first reserved FAT entry, the mirror (2nd) FAT sector is also updated.
477 However, there is no mirror FAT, and FASTFAT.SYS writes into the middle of
478 the OS/2 Boot Manager code. This aggression was built into FASTFAT.SYS
479 at a fairly late stage, and prerelease versions work without problems.
480 See also 
481 <A HREF="http://support.microsoft.com/default.aspx?scid=kb;en-us;265003">kb/q265003</A>.
482 Update both \WINNT\SYSTEM\DRIVERS\FASTFAT.SYS and
483 \WINNT\SYSTEM\DLLCACHE\FASTFAT.SYS .
484 <P>
485 <A NAME="above1024chs"></A> 
486 Then there is the problem of what to write in
487 (<I>c</I>,<I>h</I>,<I>s</I>) if the numbers
488 do not fit. The main strategies seem to be
489 <P>1.  Mark (<I>c</I>,<I>h</I>,<I>s</I>) as invalid by writing
490 some fixed value.
491 <P>1a.  Write (1023,255,63) for any nonrepresentable CHS.
492 <P>1b.  Write (1022,254,63) for any nonrepresentable CHS.
493 <P>1c.  Write (1023,0,1) for the begin CHS of a partition that
494 starts at or past cylinder 1024, and write (1023,255,63) for the end.
495 <P>2.  Leave <I>h</I>, <I>s</I> but do something to <I>c</I>.
496 Of course, these fail if <I>h</I> or <I>s</I> does not fit.
497 <P>2a.  Truncate <I>c</I> to 1023, writing
498 (1023, #heads-1, #sectors).
499 <P>2b.  Truncate <I>c</I> to 1022, writing
500 (1022, #heads-1, #sectors).
501 <P>2c.  Reduce <I>c</I> mod 1024, writing only its last 10 bits.
502 <P>Solaris 8 follows 1b or 2b.
503 Andreas Jellinghaus reports that Partition Magic follows 1c
504 and detects a problem if start CHS is set to (1023,255,63).
505 Jeff Merkey reports that Novell Netware follows 2b.
506 He writes: <I>If you do not use their methods on NetWare
507 partitions, NetWare will not recognize the partition entries correctly,
508 and will attempt to reinitialize the entire partition table on a system
509 if they are wrong (Ouch!).</I>
510 Some versions of Linux fdisk used 2a or 2c, and this confuses OS/2 fdisk - cf.
511 <A HREF="http://www.os2forum.or.at/pharmacy/HDDlinux.html">Linux, OS/2 and >1024 Cylinder HDDs</A>.
512 David A. Burton <CODE>&lt;dburton@burtonsys.com&gt;</CODE> reports
513 that System Commander Deluxe (from 
514 <A HREF="http://www.v-com.com/">V Communications</A>) uses
515 <P>1c.  Mark (<I>c</I>,<I>h</I>,<I>s</I>) as invalid by writing
516 <I>c</I>=1022.
517 (Maybe this is really 2b?)
518 <P>
519 <P>
520 <H2><A NAME="ss2.13">2.13 Partition Magic</A>
521 </H2>
522
523 <P>A very convenient tool for manipulating partitions is Partition Magic,
524 a commercial program from PowerQuest. Below a description of some of
525 its error numbers. (The URL that gave this information no longer exists.)
526 This is of interest also for those who do not have this program: it indicates
527 what conditions the PowerQuest people think a partition table should satisfy.
528 <P>(Not all of these conditions are complied with by DRDOS or OS/2 or Linux
529 or Windows NT on Alpha, so a partition manipulator should accept a much
530 wider range of partition tables, but such a program might try to follow
531 these rules when creating partitions.)
532 <P>
533 <DL>
534 <P>
535 <DT><B>100 - A forked extended partition</B><DD><P>The MBR or some EPBR contains two extended partitions.
536 (PowerQuest uses the acronym EPBR for a link in the chain of
537 extended partition table sectors.)
538 (Linux comment: there are three partition types indicating an
539 extended partition, namely 0x5, 0xf, 0x85. DOS only recognizes the first.
540 Recent Windows only recognizes the first two. Linux will accept
541 two or more extended partitions in the MBR, and often it is useful
542 to have a 0x5 chain for use by DOS (where this chain
543 stays below the 1024 cylinder boundary) and a 0x85 chain for use by Linux.
544 Nothing is wrong with having both 0x85 and one of 0x5, 0xf in the MBR.
545 However, it is bad to have both 0x5 and 0xf. This is sometimes seen when
546 people use some fdisk-type program that does not yet know about 0xf on a
547 disk that already contains such an extended partition.)
548 <P>
549 <DT><B>104 - Partition contains no sectors</B><DD><P>The LBA Number of sectors value in the partition table is 0.
550 <P>
551 <DT><B>105 - Partition does not start on cylinder boundary</B><DD><P>The Head value of CHS begin is not 0 or 1.
552 PartitionMagic expects all FAT, HPFS and NTFS partitions to start
553 and end on cylinder boundaries.
554 (Comment: Windows NT on Alpha does not comply with this rule, and
555 can create partitions starting on arbitrary sectors. There is no
556 known operating system that requires this restriction. However,
557 there exists software that tries to guess the disk geometry by
558 looking at the CHS start and end values in a partition table.
559 Note that with large disks CHS values are entirely meaningless.)
560 <P>
561 <DT><B>106 - Partition does not start with sector 1</B><DD><P>The Sector value of CHS begin is not 1. (Same comment.)
562 <P>
563 <DT><B>107 - Partition begins beyond the end of the disk</B><DD><P>The Cylinder value of CHS begin is larger than the number
564 of cylinders that the BIOS reports.
565 (Comment: Usually this means that programs or operating systems
566 that use the BIOS cannot use this partition. It may help to
567 change the BIOS translation. For Linux it does not matter,
568 except that the <CODE>/boot</CODE> partition containing LILO stuff
569 should be accessible.)
570 <P>
571 <DT><B>108 - Partition does not end on cylinder boundary</B><DD><P>The Head value of CHS end is not one less than the number of
572 heads that the BIOS reports, or the Sector value of CHS end
573 is not equal to the number of sectors per track that the BIOS reports.
574 (See above under 105.)
575 <P>
576 <DT><B>109 - Partition ends after end of disk</B><DD><P>The Cylinder value of CHS end is larger than the number
577 of cylinders that the BIOS reports.
578 <P>
579 <DT><B>110 - Partition has different CHS and LBA lengths</B><DD><P>
580 <P>
581 <DT><B>111 - Logical partition starts outside extended</B><DD><P>(Comment: the model here is that the extended partition is one
582 big box, taking a consecutive piece of disk area, containing
583 the logical partitions. Linux allows the logical partitions
584 to be anywhere on the disk, also with primary partitions in between.)
585 <P>
586 <DT><B>112 - Logical partition ends outside extended</B><DD><P>
587 <P>
588 <DT><B>113 - Partitions overlap</B><DD><P>A partition ends past the start of another.  If the filesystems
589 don't actually overlap, which they rarely do, then this can be
590 fixed by truncating the overlapping partition.
591 (Sometimes overlapping partitions are created by OS/2 fdisk:
592 if there is still room in an extended partition it allows the creation
593 of a primary partition that overlaps the end of the extended partition.
594 Now if someone afterwards creates a logical partition inside the
595 extended partition, data loss might occur.)
596 <P>
597 <DT><B>114 - Logical partition does not start one head away from EPBR</B><DD><P>If the EPBR is found at sector N, and there are 63 sectors per track,
598 then Partition Magic expects the logical partition to start at sector
599 N+63.
600 <P>
601 <DT><B>115 - Logical partition does not end where Partition Magic expects</B><DD><P>(Comment: Partition Magic expects the extended partition to be
602 a big box containing a chain of pairwise disjoint boxes.
603 Here each logical partition except for the first one has the
604 same ending sector as the surrounding box.
605 Another model one finds is a big box containing a smaller
606 box, containing a smaller box ... In that model all EPBR extended
607 partition entries will show the same end sector.
608 In reality the end sector of an EPBR does not play a role anywhere.)
609 <P>
610 <DT><B>116 - Partition has different CHS and LBA begin</B><DD><P>
611 <P>
612 <DT><B>120 - Logical partitions not in ascending order</B><DD><P>PowerQuest states: DOS, OS/2, Windows 95 and Windows NT require
613 that logical partitions occur in the chain in the on-disk order.
614 (Comment: Linux does not require this. However, reordering the
615 links in the chain is trivial (for example with sfdisk). Note
616 that disk names will be different after reordering.)
617 <P>
618 </DL>
619 <P>
620 <H2><A NAME="ss2.14">2.14 Acknowledgements</A>
621 </H2>
622
623 <P>A lot of useful information was supplied by various people:
624 Thomas Wolfram (<CODE>thomas@aeon.in-berlin.de</CODE>) - the author of os-bs,
625 Peter Gutmann (<CODE>pgut01@cs.auckland.ac.nz</CODE>) - the author of SFS,
626 Cody Batt (<CODE>codyb@powerquest.com</CODE>),
627 Christian Carey (<CODE>ccarey@CapAccess.ORG</CODE>),
628 Dan Fandrich (<CODE>dan@fch.wimsey.bc.ca</CODE>),
629 David Faulks (<CODE>david@santana.ca</CODE>),
630 Kai Henningsen (<CODE>kai@khms.westfalen.de</CODE>),
631 Dan Hildebrand (<CODE>danh@qnx.com</CODE>),
632 Todd Larason (<CODE>jtl@molehill.org</CODE>),
633 Mark Morgan Lloyd (<CODE>markMLl.in@telemetry.co.uk</CODE>).
634 Marek Michalkiewicz (<CODE>marekm@i17linuxb.ists.pwr.wroc.pl</CODE>),
635 David C. Niemi (<CODE>niemidc@clark.net</CODE>),
636 Matthias Paul (<CODE>Matthias.Paul@post.rwth-aachen.de</CODE>),
637 Loek Weerd (<CODE>loekw@worldonline.nl</CODE>),
638 S. Widlake (<CODE>s.widlake@rl.ac.uk</CODE>).
639 <HR>
640 Next
641 <A HREF="partition_types-1.html">Previous</A>
642 <A HREF="partition_types.html#toc2">Contents</A>
643 </BODY>
644 </HTML>