Friday, December 26, 2008

Something about hard disk partition naming !

With GNUnify 09 coming up in a month or so... its about time i started this.

Been using Linux (Ubuntu Hardy Heron mostly, but tried out a Fedora 9 as well openSuse 11 and Mandriva Spring 2008) for 6-7 months now.
And as a newbie user, I have done a fair bit of tinkering around ( as much as could grasp with my limited knowledge so far).

This will be where I'll just be putting down stuff that I have been able to do since then, so that I dont lose it and can use it sometime in the future... quite apart from putting the knowledge out there ;)

So here is some gyaan on how hard disk partions are named by Linux and by GRUB, since, while installing Linux, this is probably crucial for newbies so that they dont kick their earlier OS off.

Something basic first.
Every computer can only have 4 partitions. Thats been fixed from ancient times and nobody has changed it. This means that you can have 4 primary partitions and no more.
To counter this issue the extended partition has been used which can have multiple logical partitions within it.
This means that you can have at max 3 primary partitions with the 4th being an extended partition within which there may be multiple logical partitions.
There is no issue if you only have 1 primary partition and the rest as logical partitions within the extended partition.

So with that issue settled.....

For GRUB :

Points to remember -
  • naming always includes a pair of parenthesis ( .... )
  • numbering starts from zero not one.

(hd0) - the first physical hard disk (also the Master Boot Record on the first hard disk). And thats a 'zero' btw.

(hd1) - the second physical hard disk (~~~ same as above ~~~)
... and so on

(hd0,0) - the first partition on the first hard disk.

(hd0,4) - the first extended partition on the first hard disk. It will always be this regardless of whether there are 1,2 or 3 primary partitions on the disk. This number is given to the logical partition created within the extended partition.

All the logical partitions within the extended partition will always be (hdx,y).
x = the physical hard disk
y = number greater than or equal to 4

(hd1,6) - the 7th partition( logical partition since y > 3) on the 2nd physical hard disk.

For Linux:

hda or sda -
first physical hard disk.
'h' and 's' depends on whether it is an IDE (or ATA) or a SCSI (or SATA) respectively

hdb or sdb - second physical disk .... and so on

hda1 or sda1 - first primary partition on the first disk

hda5 or sda5 - the first logical partition within the extended partition.

Logical partitions will always have their numbering start from 5, irrespective of whether there are 3 or less primary partitions excluding the extended partition.

One example of this:

hda1 - first partition of first hard disk which is an IDE ATA disk
hda2 - second partition of the first disk

sdb1 - first partition of the second hard disk which is a SATA disk
sdb5 - the first logical partition within the extended (notice that even though there is only one primary partition the logical partitions will always start from 5)
sdb6 - second logical partition on the second disk
sdb7 - third logical partition on the second disk
... and so on...

Just giving the GRUB equivalent names for the above to make it clear.

hda1 = (hd0,0)
hda2 = (hd0,1)
sdb1 = (hd1,0)
sdb5 = (hd1,4)
sdb6 = (hd1,5)
sdb7 = (hd1,6)

So there. Hope that helps.

A good link to look up on more details about GRUB:
GRUB manual on the GNU website

Feeback welcome

No comments:

Post a Comment

Follow this blog !!!