<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html><head><title>Partition Types</title>
<link href="Partition-2.html" rel="previous">
<link href="Partition-4.html" rel="next"><base href="file:///var/tmp/kdecache-templin/krun/19381.0.partition-3.html"></head>
<body>
<center>
<table>
<tbody><tr>
<td><a href="partition-2.html">
<img src="prev.gif" alt="Previous" border="0"></a>
</td><td><a href="Partition.html">
<img src="toc.gif" alt="Contents" border="0"></a>
</td><td><a href="partition-4.html">
<img src="next.gif" alt="Next" border="0"></a>
</td></tr></tbody></table>
</center>
<hr>
<h2><a name="types">Partition Types</a></h2>
<p>
<!-- Tony 1 Sept 00-->
A partition is labeled to host a certain kind of file system. Such a
file system could be the linux standard ext2 file system or linux swap
space, or even foreign file systems like (Microsoft) NTFS or (Sun)
UFS. There is a numerical code associated with each partition
type. For example, the code for ext2 is 0x83 and linux swap is 0x82.
</p><h3>Foreign Partition Types</h3> The partition type codes have been
arbitrarily chosen (you can't derive them) and they
are particular to a given operating system. Therefore, it is
theoretically possible that if you use two operating systems with the
same hard drive, the same code might be used to designate two
different partition types.
<!-- Kristan 3 Nov 97-->
OS/2 marks its partitions with a 0x07 type and so
does Windows NT's NTFS. MS-DOS allocates several type codes for its
various flavors of FAT file systems: 0x01, 0x04 and 0x06 are known.
DR-DOS used 0x81 to indicate protected FAT partitions, creating a type
clash with Linux/Minix at that time, but neither Linux/Minix nor
DR-DOS are widely used any more.
<br><p></p>
<h3><a name="primary">Primary Partitions</a></h3>
The number of partitions on an Intel-based system was limited
from the very beginning: The original partition table was
installed as part of the boot sector and held space for only
four partition entries. These partitions are now called primary
partitions.
<p>
</p><h3><a name="logical">Logical Partitions</a></h3><!--Tony 1 Sep 00-->
One primary partition of a hard drive may be subpartitioned. These are
logical partitions. This effectively allows us to skirt the historical
four partition limitation.<br>
<br>
<center>
<table border="1" cellspacing="10" width="200">
<tbody><tr>
<td>
hdb
<center>
<table border="1" cellspacing="10" width="150">
<tbody><tr>
<td valign="top">
hdb1
<br>
</td>
</tr>
</tbody></table><!-- hdb1 -->
<br>
<table border="1" height="150" width="150">
<tbody><tr>
<td height="50" valign="top">
hdb2
<center>
<table border="1" cellspacing="10" width="100">
<tbody><tr>
<td align="center" height="30">
hdb5
</td>
</tr>
</tbody></table>
<br>
<table border="1" cellspacing="10" width="100">
<tbody><tr>
<td align="center" height="30">
hdb6
</td>
</tr>
</tbody></table>
</center> </td>
</tr>
</tbody></table>
<br>
</center>
</td>
</tr>
</tbody></table>
<br><br>
<table align="center" border="1">
<tbody><tr><th align="center">drive<br>name
</th><th align="center">drive<br>controller
</th><th align="center">drive<br>number
</th><th align="center">partition<br>type
</th><th align="center">partition<br>number </th></tr><tr>
<td align="center"><code>/dev/hdb1
</code></td><td align="center">1
</td><td align="center">2
</td><td align="center">primary
</td><td align="center">1
</td></tr><tr>
<td align="center"><code>/dev/hdb2
</code></td><td align="center">1
</td><td align="center">2
</td><td align="center">extended
</td><td align="center">NA
</td></tr><tr>
<td align="center"><code>/dev/hdb5
</code></td><td align="center">1
</td><td align="center">2
</td><td align="center">logical
</td><td align="center">2
</td></tr><tr>
<td align="center"><code>/dev/hdb6
</code></td><td align="center">1
</td><td align="center">2
</td><td align="center">logical
</td><td align="center">3
</td></tr></tbody></table>
<br>
</center>
<br>
The primary partition used to house the logical partitions is called
an extended partition and it has its own file system type (0x05).
Unlike primary partitions, logical partitions must be contiguous. Each
logical partition contains a pointer to the next logical partition,
which implies that the number of logical partitions is
unlimited. However, linux imposes limits on the total number of
partitions on a drive, so this effectively limits the number of
logical partitions. This is 15 partitions total on an SCSI
disk and 63 total on an IDE disk.
<a name="swap"><h3>Swap Partitions</h3></a>
Every process running on your computer is allocated a number of blocks
of <font size="-1">RAM</font>. These blocks are called pages. The set of
in-memory pages which will be referenced by the processor in the very
near future is called a "working set." Linux tries to predict these
memory accesses (assuming that recently used pages will be used again
in the near future) and keeps these pages in <font size="-1">RAM</font> if possible.<br>
<br>
If you have too many processes running on a machine, the kernel will try
to free up <font size="-1">RAM</font> by writing pages to disk. This is
what swap space is for. It effectively increases the amount of memory
you have available. However, disk I/O is very slow compared to reading
from and writing to <font size="-1">RAM</font>. Expect performance to drop
by approximately the ratio between memory access speed and disk access
speed.<br>
<br>
If memory becomes so scarce that the kernel pages out from the working
set of one process in order to page in for another, the machine is said
to be thrashing. Some readers might have inadvertenly experienced this:
the hard drive is grinding away like crazy, but the computer is slow to
the point of being unusable. Swap space is something you need to have,
but it is no substitute for sufficient <font size="-1">RAM</font>. See the discussion in <a href="partition-4.html#SwapSize">Section 4</a> for tips on determining
the size of swap space you need.<p>
</p><hr>
<center>
<table>
<tbody><tr>
<td><a href="partition-2.html">
<img src="prev.gif" alt="Previous" border="0"></a>
</td><td><a href="Partition.html">
<img src="toc.gif" alt="Contents" border="0"></a>
</td><td><a href="partition-4.html">
<img src="next.gif" alt="Next" border="0"></a>
</td></tr></tbody></table>
</center>
</body></html>