8. Partition Types

8.1. Linux Partition Types

A partition is labeled to host a certain kind of file
system (not to be confused with a volume label. Such a file
system could be the linux standard ext3 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
0x83and linux swap is
0x82(0x mean hexadecimal).

8.2. Foreign Partition Types

The partition type codes have been arbitrarily chosen
(you can't figure out what they should be) 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. 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.

8.3. Swap Partitions

Every process running on your computer is allocated a
number of blocks of RAM. 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 RAM if possible.

If you have too many processes running on a machine,
the kernel will try to free up RAM 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
about a hundred times slower than reading from and writing to
RAM. Consider this emergency memory and not extra
memory.

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 RAM.