LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   fdisk command (https://www.linuxquestions.org/questions/linux-newbie-8/fdisk-command-887855/)

gardenair 06-22-2011 10:45 PM

fdisk command
 
hi,
I want to clear the Fdisk command in Linux. Normally I use default disk partition during installation on my Fedora.I use fdisk and choose "n" it show ask me for

PHP Code:

Command (for help): n
Command action
   e   extended
   p   primary partition 
(1-4

In windows I know that we can make up to four primary partitions i think same logic in Linux as well.

If I create custom partitions during installation
like

/dev/hda1
/dev/hda2
/dev/hda3
/dev/hda4
/dev/hda5
/dev/hda6
/dev/hda7

Now in this case If i choose "n" to create new partion ,Linux does not ask for "extended and primary " partition as I ask in if we have created default partitions by the Linux operating system.

Kindly guide me.

thanks
garden

Diantre 06-22-2011 11:11 PM

Quote:

Originally Posted by gardenair (Post 4393372)
Now in this case If i choose "n" to create new partion ,Linux does not ask for "extended and primary " partition as I ask in if we have created default partitions by the Linux operating system.

You can have either 4 primary partitions or 3 primary partitions and an extended partition. Take a look at this wikipedia page, it's quite informative: http://en.wikipedia.org/wiki/Disk_partitioning

The fdisk prompt that you describe, is actually asking you what type of partition you want to create, primary or extended.

Aquarius_Girl 06-22-2011 11:48 PM

Try cfdisk, much friendlier than fdisk.

Wim Sturkenboom 06-23-2011 01:57 AM

I think (I know that that is dangerous ;)) that once fdisk can't make primary partitions any longer, it will not offer you the option.

This wil be the case once you've made an extended partition following a primary partition, so if
  • you made hda2 an extended partition
  • you have used hda1, hda2 and hda3 for primary and hda4 for extended

I however stand corrected.


Note:
an extended partition is not a 'usuable' partition; hda1, hda2 and hda3 will be usable partitions in your setup as will be hda5, hda6 etc

gardenair 06-23-2011 04:39 AM

thanks all for the reply. well "Wim Sturkenboom" as you said

PHP Code:

you made hda2 an extended partition
    you have used hda1
hda2 and hda3 for primary and hda4 for extended 

I just want to elaborate if I have understand it correct.

you made hda2 an extended partition
If I attach an other hard disk then I will use an extended partition.

you have used hda1, hda2 and hda3 for primary and hda4 for extended
To make an extended partition with a single hard disk the 1st three partition should be primary and the last hda4 will be used for extended partition.

thanks again for your kind help.
garden

Wim Sturkenboom 06-23-2011 06:12 AM

Quote:

If I attach an other hard disk then I will use an extended partition.
If you attach another HD, it will be hdb and you can start with hdb1 as a primary.

Quote:

To make an extended partition with a single hard disk the 1st three partition should be primary and the last hda4 will be used for extended partition.
What I was trying to say is that if you want 3 primary partitions, the extended partition should be hda4. You can straight away start with an extended partition if I'm not mistaken. But once you have an extended partition, you can not add primary partitions with a higher number. To my knowledge, if Windows is involved, it needs to be installed on a primary partition.

gardenair 06-23-2011 11:23 PM

thanks for the reply. well "Linux numbers Logical partitions starting with 5: The numbers 1,2,3 and 4 are reserved for the primaries, even if you have just one primary partition"
The question is why 1st 4 are reserved for primaries.

Suppose I have a hard disk

Disk /dev/hda: 64 heads, 63 sectors, 621 cylinders
Units = cylinders of 4032 * 512 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 196 395104+ 83 Linux
/dev/hda2 197 262 133056 82 Linux swap
/dev/hda3 263 458 395136 83 Linux
/dev/hda4 459 621 328608 83 Linux

Are these 4 partitions are primaries ? How can I say yes ? If it is true then what is technical login that 1st 4 partitions should be primaries and then /dev/hda5 will be our logical partition by which we can create extended partitions.


thanks,
garden

tommcd 06-24-2011 01:09 AM

Quote:

Originally Posted by gardenair (Post 4394232)
thanks for the reply. well "Linux numbers Logical partitions starting with 5: The numbers 1,2,3 and 4 are reserved for the primaries, even if you have just one primary partition"
The question is why 1st 4 are reserved for primaries.

If you already have 4 primary partitions, then I don't believe you can create an extended partition after that. You can have 3 primary partitions plus an extended partition. The extended partition can have a number of logical partitions inside it.
Quote:

Originally Posted by gardenair (Post 4394232)
Suppose I have a hard disk

Device Boot Start End Blocks Id System
/dev/hda1 * 1 196 395104+ 83 Linux
/dev/hda2 197 262 133056 82 Linux swap
/dev/hda3 263 458 395136 83 Linux
/dev/hda4 459 621 328608 83 Linux

Are these 4 partitions are primaries ? How can I say yes ?

They must all be primary partitions. If you have an extended partition then the output of fdisk would look something like this:
Code:

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          63    81915434    40957686    7  HPFS/NTFS/exFAT
/dev/sda2        81915904  120977407    19530752  83  Linux
/dev/sda3      120977408  122931199      976896  82  Linux swap
/dev/sda4      122933246  201054207    39060481    5  Extended
/dev/sda5      122933248  161992703    19529728  83  Linux
/dev/sda6      161994752  201054207    19529728  83  Linux

Note that /dev/sda4 is identified as an extended partition in this example from my computer.

gardenair 06-24-2011 02:30 AM

wonderfull "tommcd" .One think more i want to clear.If I just go back to windows where normally we have one primary partition and one extended partition which keep many local partitions.

Now in Linux which is different than windows os. Here it keep upto 4 primary partition in Intel based system.If we create customize partitions like 8 partitions then in that case our 1st 4 partitions should be primary and rest of it will be extended. (if I am correct).

I hope you understand my point why four primary partition in a single hard drive using Linux?

thanks again for your valuable guidance,

garden

tommcd 06-24-2011 11:57 PM

Quote:

Originally Posted by gardenair (Post 4394319)
Here it keep upto 4 primary partition in Intel based system.If we create customize partitions like 8 partitions then in that case our 1st 4 partitions should be primary and rest of it will be extended. (if I am correct).

If you want to create logical partitions, then you can have up to 3 primary partitions. Then create as many logical partitions as you want. When you create logical partitions the extended partition that contains the logical partitions is automatically created.

That is what I did when I partitioned the /dev/sda hard drive on my computer that I gave as an example in my last post. The /dev/sda1-3 partitions are all primary, while the rest (/dev/sda5-6) are logical. The /dev/sda4 is the extended partition that was automatically created for the 2 logical partitions.
I have some more room on that hard drive. So I can add other logical partitions after /dev/sda6 if I need them.


All times are GMT -5. The time now is 03:01 AM.