Creating extended partition - RHEL 5.4
Hello,
I'm following the book RHCE book (5th edition) by Michael Jang. On the exercise on pg.140, creating partitions, I've created /boot (hda1), swap (hda2) and / (hda3). So far so good. Next, I'm supposed to make an extended partition, containing the rest of the disk. So this should be hda4, right? But when I try to create either an LVM, or RAID partition, it creates hda4 AND hda5 under hda4. Why is that? Am I doing something wrong? The book next asks me to create /var as hda5, so if hda5 is already created automatically above, how am I supposed to create /var? Going crazy here. Please help! Thanks Prasad |
The basic rule is that a disk can only have a max of 4 'primary' partitions. However, you can also have eg 3 primaries and 1 'extended' partition. 'extended' is just a marker, not a real partition, but inside/ after that marker, you can have a lot of 'logical' partitions. so for you that'd be
hda1 - primary hda2 - p hda3 - p had4 - extended; no data, just a marker hda5 - 1st logical partition hda6 - 2nd logical etc HTH. Try googling or see wikipedia http://en.wikipedia.org/wiki/Disk_partitioning |
/dev/xxx4 is reserved for the extended partition itself, the first logical partition you create *inside* the extended partition will be /dev/xxx5
eg. Code:
/dev/sda1 - 1st primary Code:
/dev/sda1 - 1st primary hth |
Quote:
The book says 8. Create an extended partition containing all of the remaining disk space, make it growable. 9. Create the first logical partition, fifth in number, assign it to /var" Fifth in number - hda5, is already taken when I created the LVM. So how can I assign it to var? If I create a partition inside of the LVM, it assigns hda6. Or am I completely misunderstanding the question? |
I think you're mixing the instructions, to create /var as /dev/hda5 you wouldn't be using LVM or RAID as the device names would be different
|
It is a little difficult not having a copy of the RHCE book, but I agree with kbp, it looks like it wants you to create partitions to contain filesystems and not to create an LVM PV or a partition to contain a software RAID partition. At least not yet.
The explanations already given are excellent, but maybe I can expand on them a little bit, and explain the kludge known as a "DOS format drive". (And it is a kludge, which sometimes makes it difficult to understand -- or explain...) And you may know aspects of this already so please bear with me. The Master Boot Record, sector 0 of the physical drive, has a "4 slot" partition table 446 bytes into that sector. Each entry in that table is 16 bytes long and contains the starting address, ending address, partition type and a few other bits of information. These four slots describe the four primary partitions, so if we are talking about drive sda, the slots represent sda1, sda2, sda3 and sda4. The rules for how you can partition a drive says that one of those four can be an extended partition. It's usually the last one you define (but doesn't have to be). Like all of the other primary partitions it has a start and end address, but you don't format it or make it an LVM PV like a regular partiton, it is just a "container" for logical partitions. When you create logical partitions they go into the extended partition and are actually chained together. The first in the chain would be sda5, the next sda6, etc. One of the pitfalls of this scheme is that if you delete a logical partition, all of the ones that follow it in the chain get their partition number reduced by one. (They're not really numbered, their number is derived from their position, just as a primary partition number is derived from what slot describes it in the MBR) Finally, the maximum number of partitions is now 15 (4 primaries, plus 11 logical ones). (An odd piece of trivia, the limit was once 63.) A little long winded, but I hope that helps. And good luck with you RHCE studies. |
Thanks all! I was actually trying to "create" the extended partition, by allocating it size, etc. Now I understand, it is not a partition you actually create.
|
Quote:
In the tools I typically use, you do create and size an extended partition and then create logical partitions inside it. I expect there are other tools in which you can simply tell the tool to create the logical partition and it will know that is only possible inside an extended partition, so it will create that for you. An extended partition is not set up with any kind of file system nor mount point, so if you try to create a partition with a specified file system or mount point, the tool should know that it can't be an extended partition. So the tool might choose logical for you in addition to knowing that once logical is chosen an extended partition is also needed. An extended partition is also not an LVM nor RAID partition (though it could contain them). So rereading your initial post, I would guess you created an LVM or RAID partition and the program deduced that it should be a logical partition and put an extended partition under it. Probably you didn't really want LVM or RAID. You just wanted an ordinary file system partition (ext3 or similar). So maybe you should have created an extended partition first (in case the tool's automatic choices for that partition aren't what you want). Or maybe you just needed to ask for the /var partition you wanted and let the tool automatically create the extended partition under it. |
All times are GMT -5. The time now is 01:46 AM. |