Linux-Mandrake:
Install Guide

MandrakeSoft

 
 
January 2000
http://www.linux-mandrake.com


Next : Installation with DrakX
Previous : Using Lnx4Win
Up

(Back to the table of contents)

Chapter 6 : Disks and partitions


If you are reading this chapter, it means that you have decided on a standard installation of Linux-Mandrake, which will require re-partitioning. Or, you are simply curious, and you are right :)

Most of you won't have ever used the DOS fdisk program, and so have never re-partitioned a disk. For those of you who have already used it, forget what you know: this program only offers a very limited view of what partitioning really is.

Structure of a hard disk

To simplify, a hard disk is merely a sequence of sectors. A sector is the smallest data unit on a hard disk, and its size is 512 bytes. The sectors on a hard disk of n sectors are numbered from 0 to n-1 .

The first sector (including the sector number 0) contains, amongst others, the table of partitions. As its name suggests, this table contains data on the various partitions on the disk. It can contain a maximum of 4 entries, dividing the disk into four partitions called primary partitions. Each entry on the partition table contains various data, and in particular the number of the sector where the partition begins, the number of the sector where it ends and, finally, its type. An entry may contain nothing.

Normally the partition type specifies the filesystem which the partition is supposed to contain. Each operating system recognizes some of them, but not others. Windows, for example, assumes that each partition whose type proves the presence of a FAT in fact contains a FAT[1]. For Windows, this sort of partition becomes a drive. But there is also a very special type which ensures that a primary partition becomes a partition called extended.

Extended partitions

There can only be one extended partition per disk. This type of partition exists for various reasons: mainly because it can partition a large hard disk into more than 4 partitions. Then, because of the limitations of the DOS/Windows fdisk, which is unable to create more than one primary partition per disk[2].

Apart from its type, which distinguishes it, an extended partition has the same features as a primary partition, that is a start and end sector number. The space thus allocated to the extended partition is then subdivided into logical partitions using another table with a different format from the table of primary partitions, since the number of logical partitions is only restricted by the space on the disk. It should also be said that there can only be a single extended partition per disk.

The first entry of a logical partition table can be found on the first sector of the extended partition. The start and end sector of the logical partition of each entry appears in the same way, as does its type and the sector number where the following table entry can be found.

Examples

The illustrations in this section will help you to understand the partitioning of a disk. For this, the most standard cases have been shown in illustration.

One primary partition
Figure 6.1 One primary partition

Two primary partitions
Figure 6.2 Two primary partitions

A primary and an extended partition
Figure 6.3 A primary and an extended partition

What you could do, for example, is to partition a disk in the state of the first diagram and take it into the state of the second diagram (which is what System Commander can do, for example). Finally, we should add that the partitioning of a disk does not have to cover all the space on the disk. So you can keep some unused space on your disk and use it later.

Conventions for naming the disks and partitions

To complicate things further, the method used by Windows to name the partitions, and that used by Linux, are totally different. The main difference is due to the fact that Windows depends on the partition type to allocate letters to the "drives", while Linux depends on the position of the disk in the chain (IDE or SCSI) and on the partitioning of each of the disks, but does not take the partition types into account at all.

Under Windows

As we have already said, Windows allocates letters to the drives depending on the partitions that it finds of a type that it recognizes. Windows never names a disk, only partitions.

So there is never a disk C:, but a drive C:. This C: "drive" is subject to certain restrictions: it has to be a primary partition of a type which is recognized by Windows, and on the first disk seen by BIOS. And finally, this partition must be enabled... This, as a general rule, is the first IDE disk on a PC equipped only with IDE disks or the first SCSI disk on a PC on which SCSI alone has been installed.

The allocation rules for the remaining "drives" are somewhat quaint:

These few diagrams will help you: they show a computer with two disks installed, one being a master primary IDE and the other the slave primary, partitioned in a different way each time:

First example of naming of the partitions under
Windows
Figure 6.4 First example of naming of the partitions under Windows

Second example of naming the partitions under
Windows
Figure 6.5 Second example of naming the partitions under Windows

Under Linux

Linux uses a far more logical method for naming partitions. Firstly, it does not take into account the type of partitions that you may have, and secondly it names the partitions according to the disk on which they are located. First of all, this is how the disks are named:

The partitions are named after the disk on which they are found, in the following way (in the example, we have used the case of partitions on a primary master IDE disk):

By referring again to the two diagrams 6.4 and 6.5, Linux will name the partitions as follows:

First example of naming the partitions under
Linux
Figure 6.6 First example of naming the partitions under Linux

Second example of naming the partitions under
Linux
Figure 6.7 Second example of naming the partitions under Linux

So now you can name the various partitions and hard disks when you need them. You will also see that Linux names the partitions even if it does not know how to manage them initially.


Next : Installation with DrakX
Previous : Using Lnx4Win
Up

Copyright © 2000 MandrakeSoft