LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-18-2010, 07:11 PM   #1
prasadcm
LQ Newbie
 
Registered: Apr 2010
Posts: 5

Rep: Reputation: 0
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
 
Old 04-18-2010, 08:53 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,362

Rep: Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377
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
 
Old 04-18-2010, 08:53 PM   #3
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650
/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
/dev/sda2 - 2nd primary
/dev/sda3 - 3rd primary
/dev/sda4 - 4th primary
or

Code:
/dev/sda1 - 1st primary
/dev/sda2 - 2nd primary
/dev/sda3 - 3rd primary
/dev/sda4 - extended
  \ /dev/sda5 - 1st logical
    /dev/sda5 - 2nd logical
Basically, if you need more than 4 partitions you will be using an extended partition at some point. Because you can't have more than 4 primaries or 3 primaries and an extended, the first logical partition will always be /dev/xxx5

hth
 
1 members found this post helpful.
Old 04-18-2010, 09:47 PM   #4
prasadcm
LQ Newbie
 
Registered: Apr 2010
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by kbp View Post
/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
/dev/sda2 - 2nd primary
/dev/sda3 - 3rd primary
/dev/sda4 - 4th primary
or

Code:
/dev/sda1 - 1st primary
/dev/sda2 - 2nd primary
/dev/sda3 - 3rd primary
/dev/sda4 - extended
  \ /dev/sda5 - 1st logical
    /dev/sda5 - 2nd logical
Basically, if you need more than 4 partitions you will be using an extended partition at some point. Because you can't have more than 4 primaries or 3 primaries and an extended, the first logical partition will always be /dev/xxx5

hth
Thanks Chris ad kbp.

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?
 
Old 04-18-2010, 11:18 PM   #5
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650
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
 
Old 04-18-2010, 11:42 PM   #6
tommylovell
Member
 
Registered: Nov 2005
Distribution: Fedora, Redhat
Posts: 372

Rep: Reputation: 101Reputation: 101
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.
 
Old 04-20-2010, 10:27 AM   #7
prasadcm
LQ Newbie
 
Registered: Apr 2010
Posts: 5

Original Poster
Rep: Reputation: 0
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.
 
Old 04-20-2010, 10:43 AM   #8
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190Reputation: 1190
Quote:
Originally Posted by prasadcm View Post
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.
That may depend on the partitioning tool you are using.

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.

Last edited by johnsfine; 04-20-2010 at 10:49 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Safety: Primary Partition and Extended (Logical) Partition MBA Whore Linux - Security 11 01-03-2007 02:05 PM
Slackware on an extended partition? AxXium Slackware 6 06-17-2005 11:18 AM
Moving from extended partition to primary partition joelbudgor Linux - General 5 05-26-2004 06:08 PM
Booting from an extended partition - need a partition table editor Ouch_Taser Linux - General 2 02-10-2004 06:22 PM
Mounting Extended XP Partition silkmaze Linux - General 4 08-20-2003 06:03 AM


All times are GMT -5. The time now is 08:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration