![]() |
![]() |
![]() |
Primary partitions on a disk are 1, 2, 3 and 4. So /dev/hda1
is
the first primary partition on the first IDE disk and so on.
Logical partitions have numbers 5 and up, so /dev/sdb5
is the
first logical partition on the second SCSI disk.
Each partition entry has a starting and an ending block address assigned to it and a type. The type is a numerical code (a byte) which designates a particular partition to a certain type of operating system. For the benefit of computing consultants partition type codes are not really unique, so there is always the probability of two operating systems using the same type code.
Linux reserves the type code 0x82 for swap partitions and 0x83 for "native" file systems (that's ext2 for almost all of you). The once popular, now outdated Linux/Minix file system used the type code 0x81 for partitions. OS/2 marks it's 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. The extended partition which is used as a container for logical partitions has a type of 0x05, by the way.
Partitions are created and deleted with the fdisk
program.
Every self respecting operating system program comes with an
fdisk
and traditionally it is even called fdisk
(or FDISK.EXE
)
in almost all OSes. Some fdisk
s, noteable the DOS one, are
somehow limited when they have to deal with other operating
systems partitions. Such limitations include the complete
inability to deal with anything with a foreign type code, the
inability to deal with cylinder numbers above 1024 and the
inability to create or even understand partitions that do not
end on a cylinder boundary. For example, the MS-DOS fdisk can't
delete NTFS partitions, the OS/2 fdisk has been known to
silently "correct" partitions created by the Linux fdisk that
do not end on a cylinder boundary and both, the DOS and the
OS/2 fdisk, have had problems with disks with more than 1024
cylinders (see the "large-disk" Mini-Howto for details on such
disks).
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. When it became clear that people needed more partitions on their systems, logical partitions were invented. The number of logical partitions is not limited: Each logical partition contains a pointer to the next logical partition, so you can have a potentially unlimited chain of partition entries.
For compatibility reasons, the space occupied by all logical
partitions had to be accounted for. If you are using logical
partitions, one primary partition entry is marked as "extended
partition" and its starting and ending block mark the area
occupied by your logical partitions. This implies that the
space assigned to all logical partitions has to be contiguous.
There can be only one extended partition: no fdisk
program
will create more than one extended partition.
Linux cannot handle more than a limited number of partitions per
drive. So in Linux you have 4 primary partitions (3 of them
useable, if you are using logical partitions) and at most 15
partitions altogether on an SCSI disk (63 altogether on an IDE
disk).
![]() |
![]() |
![]() |