Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

If all four primary partitions exist on an IDE drive, they are numbered as follows:

  • /dev/hda1
  • /dev/hda2
  • /dev/hda3
  • /dev/hda4

We have also the partitions on a disk with one primary partition and the sole extended partition might be numbered as follows:

  • /dev/hda1 (primary)
  • /dev/hda2 (extended)

This naming strategy leads to confusion :
How it is named : /dev/hda2 in both of cases :

  • Primary partition
  • Extended Partition

Another way to express the issue : How to distinct if it is primary or extended partition

share|improve this question

3 Answers 3

You can always try sudo cfdisk /dev/hda to display a table with all partitions. It also shows whether it is a primary or extended partition.

share|improve this answer
    
cfdisk Does not existed on red-hat . There is sfdisk –  عبد النور التومي Jun 9 at 11:00
    
Can't you download it from repositories? –  makos Jun 9 at 11:04

From terminal, you type parted /dev/hda then type print as result:

Number  Start   End    Size   Type     File system  Flags     
 1      32.3kB  107MB  107MB  primary  ext3         boot, raid
 2      107MB   250GB  250GB  primary               raid 
share|improve this answer

Check the output of fdisk -l /dev/hda or a similar tool (sfdisk -l /dev/hda, parted -l, …).

You can't tell whether a partition is primary or extended from its number. In the classic PC partition scheme, each partition numbered 1, 2, 3 or 4 can be either primary or extended. (It's possible but not recommended to have multiple extended partitions; Linux itself doesn't mind but some management tools do.)

There's an almost-guaranteed way to check without root access: you can look up the size of each partition in /proc/partitions. The size of extended partitions is always reported as a single block. For instance, in the example below, sda4 is an extended partition.

major minor  #blocks  name
…
   8        1     489951 sda1
   8        4          1 sda4
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.