2. Technical info

2.1. Disks

A hard disk is made of sectors numbered from 0 to the max.

dmesg gives, for example:

hdb: ST34321A, 4103MB w/128kB Cache, CHS=523/255/63
   

CHS means Cylinders, Heads, Sectors.

523*255*63=8401995 sectors of 512 bytes, thus the 4103 Mbytes. This is only a logical map, it's not necessarily what is written on the disk cover (except for the total size).

The true size of the sectors is of no interest for us given we don't want to modify anything but restore a previous state. For us, the default size given by fdisk is alright.

The size seen by the system is directly dependent of the work of the BIOS (Basic Input/Output System - the PC's ROM). The mode of the hard disk indicated in the BIOS is essential. On a new disk, it's better to use BIOS automatic hard disk recognition and say “yes”. Anyway, any modification at this level may destroy all the data of the disk, so don't play with this without essential reason.

This is probably what your disk use, so don't be afraid.

2.2. Partitions

Disk are now huge, 40 Gb are not rare, so that it's not really handy to have all this stuff packed in only one part. Only Windows do so, and if you use Linux, may be it's because you are aware of how inefficient the other is.

So a hard disk is usually cut in some pieces called “partitions” (see the “partition HOWTO” for details, also read /usr/share/doc/package/util/README.fdisk)

Let's get a look at (part of) my own print of fdisk -l :

Disk /dev/hdb: 255 heads, 63 sectors, 523 cylinders
Units = cylinders of 16065 * 512 bytes 
Device Boot Start End Blocks Id System 
/dev/hdb1 1 153 1228941 83 Linux 
/dev/hdb2 154 166 104422+ 82 Linux swap 
/dev/hdb3 * 167 291 1004062+ 83 Linux 
/dev/hdb4 295 523 1839442+ 5 Extended 
/dev/hdb5 295 422 1028128+ 83 Linux 
/dev/hdb6 423 523 811251 6 FAT16 
   

This is my second hard disk, tied to guesses and tries (the first is too simple to be interesting).

/dev/hdb is my second ide disk (slave on the primary interface),

/dev/hdb1 is the first primary partition, running from the first (1) block to the block 153.

There can be four of such primary partitions. If one wants more than 4, one of them must be an “extended” one (not necessarily the fourth) and all other partitions are named “logical” and are located inside the extended one. Notice that partition number 5 and partition number 4 have the same beginning. Number five is logical, number 4 extended. Logicals begin always at 5, even if there are not 4 primary ones.

Here the fdisk -u -l listing of an other disk:

Disque /dev/hda : 240 têtes, 63 secteurs, 2584
cylindres Unités = secteurs sur 1 * 512 octets
Périphérique Amorce Début Fin Blocs Id Système 
/dev/hda1 * 63 10357199 5178568+ c Win95 FAT32 (LBA)
/dev/hda2 15452640 39070079 11808720 83 Linux
/dev/hda3 10357200 15150239 2396520 f Win95 Etdue (LBA) 
/dev/hda4 15150240 15452639 151200 84 Lecteur C: caché OS/2 
/dev/hda5 10357263 10463039 52888+ 83 Linux 
/dev/hda6 10463103 10780559 158728+ 82 Echange Linux
/dev/hda7 10780623 15150239 2184808+ 6 FAT16 
Les entrées de la table de partitions ne suivent pas l'ordre du disque.
   

Don't worry for the french part, I'm french... look at your own disk listing. Of course numbers are bigger.

2.3. Why is there a problem ?

Problem is all the installed Operating Systems must share the disks and as at start the BIOS only scan the first one, there must be a so called “partition table” in the very beginning of this disk. This partition table is located in the Master Boot Record (MBR) side by side with the boot loader.

Any misuse of the MBR by any of the OS's leads to problems. When trying to install any system, yes answer at a question like “automatic partitioning?” is likely to give problems... This is specially true with Windows, especially with custom windows installation made by special makes PC's (when no true “Windows” CD is included, as with many laptops). But it's also true with new “smart” (not so smart!) Linux installation programs given with some recent distributions.